{"id":13396585,"url":"https://github.com/dylang/npm-check","last_synced_at":"2025-05-12T05:28:44.799Z","repository":{"id":17770356,"uuid":"20633857","full_name":"dylang/npm-check","owner":"dylang","description":"Check for outdated, incorrect, and unused dependencies.","archived":false,"fork":false,"pushed_at":"2025-05-10T22:33:46.000Z","size":2698,"stargazers_count":6624,"open_issues_count":235,"forks_count":237,"subscribers_count":47,"default_branch":"master","last_synced_at":"2025-05-12T02:43:34.997Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/npm-check","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dylang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-06-09T03:56:25.000Z","updated_at":"2025-05-11T05:01:29.000Z","dependencies_parsed_at":"2024-01-02T23:42:14.713Z","dependency_job_id":"0f9093da-2801-4a4b-9491-b2a028a12c40","html_url":"https://github.com/dylang/npm-check","commit_stats":{"total_commits":313,"total_committers":48,"mean_commits":6.520833333333333,"dds":0.5942492012779552,"last_synced_commit":"d66fcac8b511217279c260f93b8856d430bad091"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylang%2Fnpm-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylang%2Fnpm-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylang%2Fnpm-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylang%2Fnpm-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dylang","download_url":"https://codeload.github.com/dylang/npm-check/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253672706,"owners_count":21945481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T18:00:57.466Z","updated_at":"2025-05-12T05:28:44.776Z","avatar_url":"https://github.com/dylang.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Development","Packages","*.js","工程","others","npm","Uncategorized","Maintenance Managers"],"sub_categories":["Time Series","Other","Node","redux 扩展","macros","Uncategorized","调试","A11y (accessibility)"],"readme":"npm-check\n=========\n[![Build Status](https://travis-ci.org/dylang/npm-check.svg?branch=master)](https://travis-ci.org/dylang/npm-check)\n[![NPM version](https://badge.fury.io/js/npm-check.svg)](http://badge.fury.io/js/npm-check)\n[![npm](https://img.shields.io/npm/dm/npm-check.svg?maxAge=2592000)]()\n\n\u003e Check for outdated, incorrect, and unused dependencies.\n\n\u003cimg width=\"796\" alt=\"npm-check -u\" src=\"https://cloud.githubusercontent.com/assets/51505/9569917/96947fea-4f48-11e5-9783-2d78077256f2.png\"\u003e\n\n### Features\n\n* Tells you what's out of date.\n* Provides a link to the package's documentation so you can decide if you want the update.\n* Kindly informs you if a dependency is not being used in your code.\n* Works on your globally installed packages too, via `-g`.\n* **Interactive Update** for less typing and fewer typos, via `-u`.\n* Supports public and private [@scoped/packages](https://docs.npmjs.com/getting-started/scoped-packages).\n* Supports ES6-style [`import from`](http://exploringjs.com/es6/ch_modules.html) syntax.\n* Upgrades your modules using your installed version of npm, including the new `npm@3`, so dependencies go where you expect them.\n* Works with any public npm registry, [private registries](https://www.npmjs.com/enterprise), and alternate registries like [Sinopia](https://github.com/rlidwka/sinopia).\n* Does not query registries for packages with `private: true` in their package.json.\n* Emoji in a command-line app, because command-line apps can be fun too.\n* Works with `npm@2` and `npm@3`, as well as newer alternative installers like `ied` and `pnpm`.\n\n### Requirements\n* Node \u003e= 10.9.0\n\n### On the command line\n\nThis is the easiest way to use `npm-check`.\n\n### Install\n```bash\nnpm install -g npm-check\n```\n\n### Use\n```bash\nnpm-check\n```\n\n\u003cimg width=\"882\" alt=\"npm-check\" src=\"https://cloud.githubusercontent.com/assets/51505/9569919/99c2412a-4f48-11e5-8c65-e9b6530ee991.png\"\u003e\n\nThe result should look like the screenshot, or something nice when your packages are all up-to-date and in use.\n\nWhen updates are required it will return a non-zero response code that you can use in your CI tools.\n\n### Options\n\n```\nUsage\n  $ npm-check \u003cpath\u003e \u003coptions\u003e\n\nPath\n  Where to check. Defaults to current directory. Use -g for checking global modules.\n\nOptions\n  -u, --update          Interactive update.\n  -y, --update-all      Uninteractive update. Apply all updates without prompting.\n  -g, --global          Look at global modules.\n  -s, --skip-unused     Skip check for unused packages.\n  -p, --production      Skip devDependencies.\n  -d, --dev-only        Look at devDependencies only (skip dependencies).\n  -i, --ignore          Ignore dependencies based on succeeding glob.\n  -E, --save-exact      Save exact version (x.y.z) instead of caret (^x.y.z) in package.json.\n  --specials            List of depcheck specials to include in check for unused dependencies.\n  --no-color            Force or disable color output.\n  --no-emoji            Remove emoji support. No emoji in default in CI environments.\n  --debug               Show debug output. Throw in a gist when creating issues on github.\n\nExamples\n  $ npm-check           # See what can be updated, what isn't being used.\n  $ npm-check ../foo    # Check another path.\n  $ npm-check -gu       # Update globally installed modules by picking which ones to upgrade.\n```\n\n![npm-check-u](https://cloud.githubusercontent.com/assets/51505/9569912/8c600cd8-4f48-11e5-8757-9387a7a21316.gif)\n\n#### `-u, --update`\n\nShow an interactive UI for choosing which modules to update.\n\nAutomatically updates versions referenced in the `package.json`.\n\n_Based on recommendations from the `npm` team, `npm-check` only updates using `npm install`, not `npm update`.\nTo avoid using more than one version of `npm` in one directory, `npm-check` will automatically install updated modules\nusing the version of `npm` installed globally._\n\n\u003cimg width=\"669\" alt=\"npm-check -g -u\" src=\"https://cloud.githubusercontent.com/assets/51505/9569921/9ca3aeb0-4f48-11e5-95ab-6fdb88124007.png\"\u003e\n\n##### Update using [ied](https://github.com/alexanderGugel/ied) or [pnpm](https://github.com/rstacruz/pnpm)\n\nSet environment variable `NPM_CHECK_INSTALLER` to the name of the installer you wish to use.\n\n```bash\nNPM_CHECK_INSTALLER=pnpm npm-check -u\n## pnpm install --save-dev foo@version --color=always\n```\n\nYou can also use this for dry-run testing:\n\n```bash\nNPM_CHECK_INSTALLER=echo npm-check -u\n```\n\n#### `-y, --update-all`\n\nUpdates your dependencies like `--update`, just without any prompt. This is especially useful if you want to automate your dependency updates with `npm-check`.\n\n#### `-g, --global`\n\nCheck the versions of your globally installed packages.\n\nIf the value of `process.env.NODE_PATH` is set, it will override the default path of global node_modules returned by package [`global-modules`](https://www.npmjs.com/package/global-modules).\n\n_Tip: Use `npm-check -u -g` to do a safe interactive update of global modules, including npm itself._\n\n#### `-s, --skip-unused`\n\nBy default `npm-check` will let you know if any of your modules are not being used by looking at `require` statements\nin your code.\n\nThis option will skip that check.\n\nThis is enabled by default when using `global` or `update`.\n\n#### `-p, --production`\n\nBy default `npm-check` will look at packages listed as `dependencies` and `devDependencies`.\n\nThis option will let it ignore outdated and unused checks for packages listed as `devDependencies`.\n\n#### `-d, --dev-only`\n\nIgnore `dependencies` and only check `devDependencies`.\n\nThis option will let it ignore outdated and unused checks for packages listed as `dependencies`.\n\n#### `-i, --ignore`\n\nIgnore dependencies that match specified glob.\n\n`$ npm-check -i babel-*` will ignore all dependencies starting with 'babel-'.\n\n#### `-E, --save-exact`\n\nInstall packages using `--save-exact`, meaning exact versions will be saved in package.json.\n\nApplies to both `dependencies` and `devDependencies`.\n\n#### `--specials`\n\nCheck special (e.g. config) files when looking for unused dependencies.\n\n`$ npm-check --specials=bin,webpack` will look in the `scripts` section of package.json and in webpack config.\n\nSee [https://github.com/depcheck/depcheck#special](https://github.com/depcheck/depcheck#special) for more information.\n\n#### `--color, --no-color`\n\nEnable or disable color support.\n\nBy default `npm-check` uses colors if they are available.\n\n#### `--emoji, --no-emoji`\n\nEnable or disable emoji support. Useful for terminals that don't support them. Automatically disabled in CI servers.\n\n#### `--spinner, --no-spinner`\n\nEnable or disable the spinner. Useful for terminals that don't support them. Automatically disabled in CI servers.\n\n### API\n\nThe API is here in case you want to wrap this with your CI toolset.\n\n```js\nconst npmCheck = require('npm-check');\n\nnpmCheck(options)\n  .then(currentState =\u003e console.log(currentState.get('packages')));\n```\n\n#### `update`\n\n* Interactive update.\n* default is `false`\n\n#### `global`\n\n* Check global modules.\n* default is `false`\n* `cwd` is automatically set with this option.\n\n#### `skipUnused`\n\n* Skip checking for unused packages.\n* default is `false`\n\n#### `ignoreDev`\n\n* Ignore `devDependencies`.\n* This is called `--production` on the command line to match `npm`.\n* default is `false`\n\n#### `devOnly`\n\n* Ignore `dependencies` and only check `devDependencies`.\n* default is `false`\n\n#### `ignore`\n\n* Ignore dependencies that match specified glob.\n* default is `[]`\n\n#### `saveExact`\n\n* Update package.json with exact version `x.y.z`  instead of semver range `^x.y.z`.\n* default is `false`\n\n#### `debug`\n\n* Show debug output. Throw in a gist when creating issues on github.\n* default is `false`\n\n#### `cwd`\n\n* Override where `npm-check` checks.\n* default is `process.cwd()`\n\n#### `specials`\n\n* List of [`depcheck`](https://github.com/depcheck/depcheck) special parsers to include.\n* default is `''`\n\n#### `currentState`\n\nThe result of the promise is a `currentState` object, look in [state.js](lib/state/state.js) to see how it works.\n\nYou will probably want `currentState.get('packages')` to get an array of packages and the state of each of them.\n\nEach item in the array will look like the following:\n\n```js\n{\n  moduleName: 'lodash',                 // name of the module.\n  homepage: 'https://lodash.com/',      // url to the home page.\n  regError: undefined,                  // error communicating with the registry\n  pkgError: undefined,                  // error reading the package.json\n  latest: '4.7.0',                      // latest according to the registry.\n  installed: '4.6.1',                   // version installed\n  isInstalled: true,                    // Is it installed?\n  notInstalled: false,                  // Is it installed?\n  packageWanted: '4.7.0',               // Requested version from the package.json.\n  packageJson: '^4.6.1',                // Version or range requested in the parent package.json.\n  devDependency: false,                 // Is this a devDependency?\n  usedInScripts: undefined,             // Array of `scripts` in package.json that use this module.\n  mismatch: false,                      // Does the version installed not match the range in package.json?\n  semverValid: '4.6.1',                 // Is the installed version valid semver?\n  easyUpgrade: true,                    // Will running just `npm install` upgrade the module?\n  bump: 'minor',                        // What kind of bump is required to get the latest, such as patch, minor, major.\n  unused: false                         // Is this module used in the code?\n},\n```\n\nYou will also see this if you use `--debug` on the command line.\n\n### RC File Support\nAdditional options can be sent to the depcheck process.  See [depcheck API](https://github.com/depcheck/depcheck#api).  Create a .npmcheckrc{.json,.yml,.js} file and set the depcheck options under depcheck property.\n\nFor example, to skip packages for unused check, but still want them in the outdated check (so can't use the --ignore option):\n```\n# .npmcheckrc\n\ndepcheck:\n  ignoreMatches: [\"replace-in-file\",\"snyk\",\"sonarqube-scanner\"]\n\n```\n\n### Inspiration\n\n* [npm outdated](https://docs.npmjs.com/cli/v7/commands/npm-outdated) - awkward output, requires --depth=0 to be grokable.\n* [david](https://github.com/alanshaw/david) - does not work with private registries.\n* [update-notifier](https://github.com/yeoman/update-notifier) - for single modules, not everything in package.json.\n* [depcheck](https://github.com/depcheck/depcheck) - only part of the puzzle. npm-check uses depcheck.\n\n### About the Author\n\nHi! Thanks for checking out this project! My name is **Dylan Greene**. When not overwhelmed with my two young kids I enjoy contributing\nto the open source community. I'm also a tech lead at [Opower](https://opower.com/). [![@dylang](https://img.shields.io/badge/github-dylang-green.svg)](https://github.com/dylang) [![@dylang](https://img.shields.io/badge/twitter-dylang-blue.svg)](https://twitter.com/dylang)\n\nHere's some of my other Node projects:\n\n| Name | Description | npm\u0026nbsp;Downloads |\n|---|---|---|\n| [`grunt‑notify`](https://github.com/dylang/grunt-notify) | Automatic desktop notifications for Grunt errors and warnings. Supports OS X, Windows, Linux. | [![grunt-notify](https://img.shields.io/npm/dm/grunt-notify.svg?style=flat-square)](https://www.npmjs.org/package/grunt-notify) |\n| [`shortid`](https://github.com/dylang/shortid) | Amazingly short non-sequential url-friendly unique id generator. | [![shortid](https://img.shields.io/npm/dm/shortid.svg?style=flat-square)](https://www.npmjs.org/package/shortid) |\n| [`space‑hogs`](https://github.com/dylang/space-hogs) | Discover surprisingly large directories from the command line. | [![space-hogs](https://img.shields.io/npm/dm/space-hogs.svg?style=flat-square)](https://www.npmjs.org/package/space-hogs) |\n| [`rss`](https://github.com/dylang/node-rss) | RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS. | [![rss](https://img.shields.io/npm/dm/rss.svg?style=flat-square)](https://www.npmjs.org/package/rss) |\n| [`grunt‑prompt`](https://github.com/dylang/grunt-prompt) | Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields. | [![grunt-prompt](https://img.shields.io/npm/dm/grunt-prompt.svg?style=flat-square)](https://www.npmjs.org/package/grunt-prompt) |\n| [`xml`](https://github.com/dylang/node-xml) | Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. | [![xml](https://img.shields.io/npm/dm/xml.svg?style=flat-square)](https://www.npmjs.org/package/xml) |\n| [`changelog`](https://github.com/dylang/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](https://img.shields.io/npm/dm/changelog.svg?style=flat-square)](https://www.npmjs.org/package/changelog) |\n| [`grunt‑attention`](https://github.com/dylang/grunt-attention) | Display attention-grabbing messages in the terminal | [![grunt-attention](https://img.shields.io/npm/dm/grunt-attention.svg?style=flat-square)](https://www.npmjs.org/package/grunt-attention) |\n| [`observatory`](https://github.com/dylang/observatory) | Beautiful UI for showing tasks running on the command line. | [![observatory](https://img.shields.io/npm/dm/observatory.svg?style=flat-square)](https://www.npmjs.org/package/observatory) |\n| [`anthology`](https://github.com/dylang/anthology) | Module information and stats for any @npmjs user | [![anthology](https://img.shields.io/npm/dm/anthology.svg?style=flat-square)](https://www.npmjs.org/package/anthology) |\n| [`grunt‑cat`](https://github.com/dylang/grunt-cat) | Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. | [![grunt-cat](https://img.shields.io/npm/dm/grunt-cat.svg?style=flat-square)](https://www.npmjs.org/package/grunt-cat) |\n\n_This list was generated using [anthology](https://github.com/dylang/anthology)._\n\n### License\nCopyright (c) 2016 Dylan Greene, contributors.\n\nReleased under the [MIT license](https://tldrlegal.com/license/mit-license).\n\nScreenshots are [CC BY-SA](https://creativecommons.org/licenses/by-sa/4.0/) (Attribution-ShareAlike).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylang%2Fnpm-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdylang%2Fnpm-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylang%2Fnpm-check/lists"}