Check for outdated, incorrect, and unused dependencies.
Check for outdated, incorrect, and unused dependencies.
Check for outdated, incorrect, and unused dependencies.
-g.-u.import from syntax.npm@3, so dependencies go where you expect them.private: true in their package.json.npm@2 and npm@3, as well as newer alternative installers like ied and pnpm.This is the easiest way to use npm-check.
npm install -g npm-checknpm-checkThe result should look like the screenshot, or something nice when your packages are all up-to-date and in use.
When updates are required it will return a non-zero response code that you can use in your CI tools.
…-u, --updateShow 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.
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=alwaysYou can also use this for dry-run testing:
NPM_CHECK_INSTALLER=echo npm-check -u-y, --update-allUpdates your dependencies like --update, just without any prompt. This is especially useful if you want to automate your dependency updates with npm-check.
-g, --globalCheck the versions of your globally installed packages.
If the value of process.env.NODE_PATH is set, it will override the default path of global node_modules returned by package global-modules.
Tip: Use npm-check -u -g to do a safe interactive update of global modules, including npm itself.
-s, --skip-unusedBy 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, --productionBy 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.
-d, --dev-onlyIgnore dependencies and only check devDependencies.
This option will let it ignore outdated and unused checks for packages listed as dependencies.
-i, --ignoreIgnore dependencies that match specified glob.
$ npm-check -i babel-* will ignore all dependencies starting with 'babel-'.
-E, --save-exactInstall packages using --save-exact, meaning exact versions will be saved in package.json.
Applies to both dependencies and devDependencies.
--specialsCheck special (e.g. config) files when looking for unused dependencies.
$ npm-check --specials=bin,webpack will look in the scripts section of package.json and in webpack config.
See https://github.com/depcheck/depcheck#special for more information.
--color, --no-colorEnable or disable color support.
By default npm-check uses colors if they are available.
--emoji, --no-emojiEnable or disable emoji support. Useful for terminals that don't support them. Automatically disabled in CI servers.
--spinner, --no-spinnerEnable or disable the spinner. Useful for terminals that don't support them. Automatically disabled in CI servers.
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')));updatefalseglobalfalsecwd is automatically set with this option.skipUnusedfalseignoreDevdevDependencies.--production on the command line to match npm.falsedevOnlydependencies and only check devDependencies.falseignore[]saveExactx.y.z instead of semver range ^x.y.z.falsedebugfalsecwdnpm-check checks.process.cwd()specialsdepcheck special parsers to include.''currentStateThe 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:
…You will also see this if you use --debug on the command line.
Additional options can be sent to the depcheck process. See depcheck API. Create a .npmcheckrc{.json,.yml,.js} file and set the depcheck options under depcheck property.
For example, to skip packages for unused check, but still want them in the outdated check (so can't use the --ignore option):
# .npmcheckrc
depcheck:
ignoreMatches: ["replace-in-file","snyk","sonarqube-scanner"]
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.
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. | |
shortid |
Amazingly short non-sequential url-friendly unique id generator. | |
space‑hogs |
Discover surprisingly large directories from the command line. | |
rss |
RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS. | |
grunt‑prompt |
Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields. | |
xml |
Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. | |
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. | |
grunt‑attention |
Display attention-grabbing messages in the terminal | |
observatory |
Beautiful UI for showing tasks running on the command line. | |
anthology |
Module information and stats for any @npmjs user | |
grunt‑cat |
Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. |
This list was generated using anthology.
Copyright (c) 2016 Dylan Greene, contributors.
Released under the MIT license.
Screenshots are CC BY-SA (Attribution-ShareAlike).
Dependency Dashboard
Respect npm `min-release-age` when checking for updates
command npm-check -g throw error
Dependency scan results and suggested fixes (OWASP CVE Lite CLI)
DEP0169: DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications.
[v6.0.1] NPM reports moderate issues in dependencies
Not working
is this package still maintained?
Updating package-lock.json file after npm-update -u
Tests failing