<commit_before>## 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)

> Check for outdated, incorrect, and unused dependencies.



<img width="796" alt="npm-check -u" src="https://cloud.githubusercontent.com/assets/51505/9569917/96947fea-4f48-11e5-9783-2d78077256f2.png">











### Features

* Tells you what's out of date.
* Provides a link to the package's documentation so you can decide if you want the update.
* Kindly informs you if a dependency is not being used in your code.
* Works on your globally installed packages too, via `-g`.
* **Interactive Update** for less typing and fewer typos, via `-u`.
* Supports public and private [@scoped/packages](https://docs.npmjs.com/getting-started/scoped-packages).
* Supports ES6-style [`import from`](http://exploringjs.com/es6/ch_modules.html) syntax.
* Upgrades your modules using your installed version of npm, including the new `npm@3`, so dependencies go where you expect them.
* Works the public registry, [private registries](https://www.npmjs.com/onsite), and [Sinopia](https://github.com/rlidwka/sinopia).
* Avoids querying npm registries for packages with `private: true` in their package.json.
* Emoji in a command-line app, because command-line apps can be fun too.




### On the command line

This is how you should use `npm-check`. 

#### Install


```bash
$ npm install -g npm-check
```

#### Use


```bash
$ npm-check
```

<img width="882" alt="npm-check" src="https://cloud.githubusercontent.com/assets/51505/9569919/99c2412a-4f48-11e5-8c65-e9b6530ee991.png">

The result should look like the screenshot, or something nice when your packages are all up-to-date and in use.


#### Options

```
Usage
  $ npm-check <path> <options>
  
Path
  Where to check. Defaults to current directory. Use -g for checking global modules.

Options
  -u, --update          Interactive update.
  -g, --global          Look at global modules.
  -s, --skip-unused     Skip check for unused packages.
  -p, --production      Skip devDependencies.
  -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.

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


![npm-check-u](https://cloud.githubusercontent.com/assets/51505/9569912/8c600cd8-4f48-11e5-8757-9387a7a21316.gif)

##### -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._

<img width="669" alt="npm-check -g -u" src="https://cloud.githubusercontent.com/assets/51505/9569921/9ca3aeb0-4f48-11e5-95ab-6fdb88124007.png">

##### -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`.

###### -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. 



### API

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

```js
var npmCheck = require('npm-check');

npmCheck(options)
  .then(result);
```

#### `npmCheck(options)` returns `promise`

##### options

###### global `boolean`

* default is `false`

Use the globally installed packages. When `true`, the `path` is automatically set.

###### update `boolean`

* default is `false`

Interactive update.

###### skipUnused `boolean`

* default is `false`

Skip checking for unused packages.

###### ignoreDev `boolean`

* default is `false`

Ignore `devDependencies`.

###### path `string`

* default is `cwd`

Override where `npm-check` checks.

####### saveExact `boolean`
 
* default is `false`

Save exact versions to package.json

#####`result`

`object of module names : data`

`data` looks like this:

About the module

* moduleName: name of the module.
* homepage: url to the home page.

Versions

* latest: latest according to the registry.<commit_msg>API options used #cwd, not #path<commit_after>## 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)

> Check for outdated, incorrect, and unused dependencies.



<img width="796" alt="npm-check -u" src="https://cloud.githubusercontent.com/assets/51505/9569917/96947fea-4f48-11e5-9783-2d78077256f2.png">











### Features

* Tells you what's out of date.
* Provides a link to the package's documentation so you can decide if you want the update.
* Kindly informs you if a dependency is not being used in your code.
* Works on your globally installed packages too, via `-g`.
* **Interactive Update** for less typing and fewer typos, via `-u`.
* Supports public and private [@scoped/packages](https://docs.npmjs.com/getting-started/scoped-packages).
* Supports ES6-style [`import from`](http://exploringjs.com/es6/ch_modules.html) syntax.
* Upgrades your modules using your installed version of npm, including the new `npm@3`, so dependencies go where you expect them.
* Works the public registry, [private registries](https://www.npmjs.com/onsite), and [Sinopia](https://github.com/rlidwka/sinopia).
* Avoids querying npm registries for packages with `private: true` in their package.json.
* Emoji in a command-line app, because command-line apps can be fun too.




### On the command line

This is how you should use `npm-check`. 

#### Install


```bash
$ npm install -g npm-check
```

#### Use


```bash
$ npm-check
```

<img width="882" alt="npm-check" src="https://cloud.githubusercontent.com/assets/51505/9569919/99c2412a-4f48-11e5-8c65-e9b6530ee991.png">

The result should look like the screenshot, or something nice when your packages are all up-to-date and in use.


#### Options

```
Usage
  $ npm-check <path> <options>
  
Path
  Where to check. Defaults to current directory. Use -g for checking global modules.

Options
  -u, --update          Interactive update.
  -g, --global          Look at global modules.
  -s, --skip-unused     Skip check for unused packages.
  -p, --production      Skip devDependencies.
  -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.

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


![npm-check-u](https://cloud.githubusercontent.com/assets/51505/9569912/8c600cd8-4f48-11e5-8757-9387a7a21316.gif)

##### -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._

<img width="669" alt="npm-check -g -u" src="https://cloud.githubusercontent.com/assets/51505/9569921/9ca3aeb0-4f48-11e5-95ab-6fdb88124007.png">

##### -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`.

###### -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. 



### API

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

```js
var npmCheck = require('npm-check');

npmCheck(options)
  .then(result);
```

#### `npmCheck(options)` returns `promise`

##### options

###### global `boolean`

* default is `false`

Use the globally installed packages. When `true`, the `path` is automatically set.

###### update `boolean`

* default is `false`

Interactive update.

###### skipUnused `boolean`

* default is `false`

Skip checking for unused packages.

###### ignoreDev `boolean`

* default is `false`

Ignore `devDependencies`.

###### cwd `string`

* default is `cwd`

Override where `npm-check` checks.

####### saveExact `boolean`
 
* default is `false`

Save exact versions to package.json

#####`result`

`object of module names : data`

`data` looks like this:

About the module

* moduleName: name of the module.
* homepage: url to the home page.

Versions

* latest: latest according to the registry.
{'fraction_non_alphanumeric': 0.12646520146520146, 'fraction_numerical': 0.028021978021978023, 'mean_word_length': 3.663108454312553, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 18, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7497884', 'n_tokens_mistral': 3688, 'n_tokens_neox': 3301, 'n_words': 1244}