UNPKG

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