UNPKG

9.25 kBMarkdownView Raw
1## npm-check [![Build Status](http://img.shields.io/travis/dylang/npm-check.svg)](https://travis-ci.org/dylang/npm-check) [![npm-check](http://img.shields.io/npm/dm/npm-check.svg)](https://www.npmjs.org/package/npm-check)
2
3> Check for outdated, incorrect, and unused dependencies.
4
5
6
7<img width="796" alt="npm-check -u" src="https://cloud.githubusercontent.com/assets/51505/9569917/96947fea-4f48-11e5-9783-2d78077256f2.png">
8
9
10
11
12
13
14
15
16
17
18
19### Features
20
21* Tells you what's out of date.
22* Provides a link to the package's documentation so you can decide if you want the update.
23* Kindly informs you if a dependency is not being used in your code.
24* Works on your globally installed packages too, via `-g`.
25* **Interactive Update** for less typing and fewer typos, via `-u`.
26* Supports public and private [@scoped/packages](https://docs.npmjs.com/getting-started/scoped-packages).
27* Supports ES6-style [`import from`](http://exploringjs.com/es6/ch_modules.html) syntax.
28* Upgrades your modules using your installed version of npm, including the new `npm@3`, so dependencies go where you expect them.
29* Works the public registry, [private registries](https://www.npmjs.com/onsite), and [Sinopia](https://github.com/rlidwka/sinopia).
30* Avoids querying npm registries for packages with `private: true` in their package.json.
31* Emoji in a command-line app, because command-line apps can be fun too.
32
33
34
35
36### On the command line
37
38This is how you should use `npm-check`.
39
40#### Install
41
42
43```bash
44$ npm install -g npm-check
45```
46
47#### Use
48
49
50```bash
51$ npm-check
52```
53
54<img width="882" alt="npm-check" src="https://cloud.githubusercontent.com/assets/51505/9569919/99c2412a-4f48-11e5-8c65-e9b6530ee991.png">
55
56The result should look like the screenshot, or something nice when your packages are all up-to-date and in use.
57
58
59#### Options
60
61```
62$ npm-check --help
63
64 Usage: npm-check [options]
65
66 Options:
67
68 -h, --help output usage information
69 -V, --version output the version number
70 -u, --update Interactive update.
71 -g, --global Look at global modules.
72 -s, --skip-unused Skip check for unused packages.
73 -p, --production Ignore devDependencies.
74```
75
76
77![npm-check-u](https://cloud.githubusercontent.com/assets/51505/9569912/8c600cd8-4f48-11e5-8757-9387a7a21316.gif)
78
79##### -u, --update
80
81Show an interactive UI for choosing which modules to update.
82
83Automatically updates versions referenced in the `package.json`.
84
85_Based on recommendations from the `npm` team, `npm-check` only updates using `npm install`, not `npm update`.
86To avoid using more than one version of `npm` in one directory, `npm-check` will automatically install updated modules
87using the version of `npm` installed globally._
88
89<img width="669" alt="npm-check -g -u" src="https://cloud.githubusercontent.com/assets/51505/9569921/9ca3aeb0-4f48-11e5-95ab-6fdb88124007.png">
90
91##### -g, --global
92
93Check the versions of your globally installed packages.
94
95_Tip: Use `npm-check -u -g` to do a safe interactive update of global modules, including npm itself._
96
97##### -s, --skip-unused
98
99By default `npm-check` will let you know if any of your modules are not being used by looking at `require` statements
100in your code.
101
102This option will skip that check.
103
104This is enabled by default when using `global` or `update`.
105
106##### -p, --production
107
108By default `npm-check` will look at packages listed as `dependencies` and `devDependencies`.
109
110This option will let it ignore outdated and unused checks for packages listed as `devDependencies`.
111
112
113
114### API
115
116The API is here in case you want to wrap this with your CI toolset.
117
118```js
119var npmCheck = require('npm-check');
120
121npmCheck(options)
122 .then(result);
123```
124
125#### `npmCheck(options)` returns `promise`
126
127##### options
128
129###### global `boolean`
130
131* default is `false`
132
133Use the globally installed packages. When `true`, the `path` is automatically set.
134
135###### update `boolean`
136
137* default is `false`
138
139Interactive update.
140
141###### skipUnused `boolean`
142
143* default is `false`
144
145Skip checking for unused packages.
146
147###### ignoreDev `boolean`
148
149* default is `false`
150
151Ignore `devDependencies`.
152
153###### path `string`
154
155* default is `cwd`
156
157Override where `npm-check` checks.
158
159#####`result`
160
161`object of module names : data`
162
163`data` looks like this:
164
165About the module
166
167* moduleName: name of the module.
168* homepage: url to the home page.
169
170Versions
171
172* latest: latest according to the registry.
173* installed: version in node_modules.
174* packageJson: version or range in package.json.
175* devDependency: Is this a devDependency?
176* usedInScripts: Is this used in the scripts section of package.json?
177* mismatch: Is the version installed not match the range in package.json?
178* semverValidRange: Is the package.json range valid?
179* semverValid: Is the installed version valid semver?
180* easyUpgrade: Will using npm install upgrade the module?
181* bump: What kind of bump is required to get the latest, such as patch, minor, major.
182* unused: Is this module used in the code?
183
184
185### Inspiration
186
187* [npm outdated](https://www.npmjs.org/doc/cli/npm-outdated.html) - awkward output, requires --depth=0 to be grokable.
188* [david](https://github.com/alanshaw/david) - does not work with private registries.
189* [update-notifier](https://github.com/yeoman/update-notifier) - for single modules, not everything in package.json.
190* [depcheck](https://github.com/rumpl/depcheck) - only part of the puzzle. npm-check uses depcheck.
191
192
193
194
195
196### About the Author
197
198Hi! Thanks for checking out this project! My name is **Dylan Greene**. When not overwhelmed with my two young kids I enjoy contributing
199to the open source community. I'm also a tech lead at [Opower](http://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)
200
201Here's some of my other Node projects:
202
203| Name | Description | npm&nbsp;Downloads |
204|---|---|---|
205| [`grunt‑notify`](https://github.com/dylang/grunt-notify) | Automatic desktop notifications for Grunt errors and warnings using Growl for OS X or Windows, Mountain Lion and Mavericks Notification Center, and Notify-Send. | [![grunt-notify](https://img.shields.io/npm/dm/grunt-notify.svg?style=flat-square)](https://www.npmjs.org/package/grunt-notify) |
206| [`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) |
207| [`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) |
208| [`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) |
209| [`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) |
210| [`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) |
211| [`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) |
212| [`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) |
213| [`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) |
214| [`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) |
215
216_This list was generated using [anthology](https://github.com/dylang/anthology)._
217
218
219### License
220Copyright (c) 2015 Dylan Greene, contributors.
221
222Released under the [MIT license](https://tldrlegal.com/license/mit-license).
223
224Screenshots are [CC BY-SA](http://creativecommons.org/licenses/by-sa/4.0/) (Attribution-ShareAlike).
225
226***
227_Generated using [grunt-readme](https://github.com/assemble/grunt-readme) with [grunt-templates-dylang](https://github.com/dylang/grunt-templates-dylang) on Sunday, October 11, 2015._
228_To make changes to this document look in `/templates/readme/`
229