npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vueclear

v0.1.2

Published

测试版本.

Downloads

8

Readme

ncheck

检查项目中是否存在 过时 错误 多余 的模块.

特点

  • 帮你找出项目引用的模块是否有更新.
  • 提供更新详情以及提供模块主页,让你可以判断是否更新.
  • 告知项目中没有用到的模块.
  • 可以在全局中工作, 通过 -g.

需求

  • Node >= 4.0.0

安装

$ npm install -g ncheck

使用

$ ncheck

参数

使用
  $ ncheck <path> <options>

Path
  Where to check. Defaults to current directory. Use -g for checking global modules.

Options
  -u, --update          只检查是否有包裹需要更新.
  -g, --global          Look at global modules.
  -s, --skip-unused     Skip check for unused packages.
  -p, --production      Skip devDependencies.
  -i, --ignore          Ignore dependencies based on succeeding glob.
  -E, --save-exact      Save exact version (x.y.z) instead of caret (^x.y.z) in package.json.
  --no-color            Force or disable color output.
  --no-emoji            Remove emoji support. No emoji in default in CI environments.
  --debug               Debug output. Throw in a gist when creating issues on github.

实例
  $ npm-check           # See what can be updated, what isn't being used.
  $ npm-check ../foo    # Check another path.
  $ npm-check -gu       # Update globally installed modules by picking which ones to upgrade.

npm-check-u

-u, --update

Show an interactive UI for choosing which modules to update.

Automatically updates versions referenced in the package.json.

Based on recommendations from the npm team, npm-check only updates using npm install, not npm update. To avoid using more than one version of npm in one directory, npm-check will automatically install updated modules using the version of npm installed globally.

Update using ied or pnpm

Set environment variable NPM_CHECK_INSTALLER to the name of the installer you wish to use.

NPM_CHECK_INSTALLER=pnpm npm-check -u
## pnpm install --save-dev foo@version --color=always

You can also use this for dry-run testing:

NPM_CHECK_INSTALLER=echo npm-check -u

-g, --global

Check the versions of your globally installed packages.

Tip: Use npm-check -u -g to do a safe interactive update of global modules, including npm itself.

-s, --skip-unused

By default npm-check will let you know if any of your modules are not being used by looking at require statements in your code.

This option will skip that check.

This is enabled by default when using global or update.

-p, --production

By default npm-check will look at packages listed as dependencies and devDependencies.

This option will let it ignore outdated and unused checks for packages listed as devDependencies.

-i, --ignore

Ignore dependencies that match specified glob.

$ npm-check -i babel-* will ignore all dependencies starting with 'babel-'.

-E, --save-exact

Install packages using --save-exact, meaning exact versions will be saved in package.json.

Applies to both dependencies and devDependencies.

--color, --no-color

Enable or disable color support.

By default npm-check uses colors if they are available.

--emoji, --no-emoji

Enable or disable emoji support. Useful for terminals that don't support them. Automatically disabled in CI servers.

--spinner, --no-spinner

Enable or disable the spinner. Useful for terminals that don't support them. Automatically disabled in CI servers.

API

The API is here in case you want to wrap this with your CI toolset.

const npmCheck = require('npm-check');

npmCheck(options)
  .then(currentState => console.log(currentState.get('packages')));

global

  • Check global modules.
  • default is false
  • cwd is automatically set with this option.

update

  • Interactive update.
  • default is false

skipUnused

  • Skip checking for unused packages.
  • default is false

ignoreDev

  • Ignore devDependencies.
  • This is called --production on the command line to match npm.
  • default is false

cwd

  • Override where npm-check checks.
  • default is process.cwd()

saveExact

  • Update package.json with exact version x.y.z instead of semver range ^x.y.z.
  • default is false

currentState

The result of the promise is a currentState object, look in state.js to see how it works.

You will probably want currentState.get('packages') to get an array of packages and the state of each of them.

Each item in the array will look like the following:

{
  moduleName: 'lodash',                 // name of the module.
  homepage: 'https://lodash.com/',      // url to the home page.
  regError: undefined,                  // error communicating with the registry
  pkgError: undefined,                  // error reading the package.json
  latest: '4.7.0',                      // latest according to the registry.
  installed: '4.6.1',                   // version installed
  isInstalled: true,                    // Is it installed?
  notInstalled: false,                  // Is it installed?
  packageWanted: '4.7.0',               // Requested version from the package.json.
  packageJson: '^4.6.1',                // Version or range requested in the parent package.json.
  devDependency: false,                 // Is this a devDependency?
  usedInScripts: undefined,             // Array of `scripts` in package.json that use this module.
  mismatch: false,                      // Does the version installed not match the range in package.json?
  semverValid: '4.6.1',                 // Is the installed version valid semver?
  easyUpgrade: true,                    // Will running just `npm install` upgrade the module?
  bump: 'minor',                        // What kind of bump is required to get the latest, such as patch, minor, major.
  unused: false                         // Is this module used in the code?
},

You will also see this if you use --debug on the command line.

Inspiration

  • npm outdated - awkward output, requires --depth=0 to be grokable.
  • david - does not work with private registries.
  • update-notifier - for single modules, not everything in package.json.
  • depcheck - only part of the puzzle. npm-check uses depcheck.

About the Author

Hi! Thanks for checking out this project! My name is Dylan Greene. When not overwhelmed with my two young kids I enjoy contributing to the open source community. I'm also a tech lead at Opower. @dylang @dylang

Here's some of my other Node projects:

| Name | Description | npm Downloads | |---|---|---| | grunt‑notify | Automatic desktop notifications for Grunt errors and warnings. Supports OS X, Windows, Linux. | grunt-notify | | shortid | Amazingly short non-sequential url-friendly unique id generator. | shortid | | space‑hogs | Discover surprisingly large directories from the command line. | space-hogs | | rss | RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS. | rss | | grunt‑prompt | Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields. | grunt-prompt | | xml | Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. | xml | | changelog | Command line tool (and Node module) that generates a changelog in color output, markdown, or json for modules in npmjs.org's registry as well as any public github.com repo. | changelog | | grunt‑attention | Display attention-grabbing messages in the terminal | grunt-attention | | observatory | Beautiful UI for showing tasks running on the command line. | observatory | | anthology | Module information and stats for any @npmjs user | anthology | | grunt‑cat | Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. | grunt-cat |

This list was generated using anthology.

License

Copyright (c) 2016 Dylan Greene, contributors.

Released under the MIT license.

Screenshots are CC BY-SA (Attribution-ShareAlike).


Generated using grunt-readme with grunt-templates-dylang on Thursday, April 7, 2016. _To make changes to this document look in /templates/readme/