Git Product home page Git Product logo

npm-check's Introduction

npm-check

Build Status NPM version npm

Check for outdated, incorrect, and unused dependencies.

npm-check -u

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.
  • Supports ES6-style import from syntax.
  • Upgrades your modules using your installed version of npm, including the new npm@3, so dependencies go where you expect them.
  • Works with any public npm registry, private registries, and alternate registries like Sinopia.
  • Does not query registries for packages with private: true in their package.json.
  • Emoji in a command-line app, because command-line apps can be fun too.
  • Works with npm@2 and npm@3, as well as newer alternative installers like ied and pnpm.

Requirements

  • Node >= 10.9.0

On the command line

This is the easiest way to use npm-check.

Install

npm install -g npm-check

Use

npm-check

npm-check

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

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.
  -y, --update-all      Uninteractive update. Apply all updates without prompting.
  -g, --global          Look at global modules.
  -s, --skip-unused     Skip check for unused packages.
  -p, --production      Skip devDependencies.
  -d, --dev-only        Look at devDependencies only (skip dependencies).
  -i, --ignore          Ignore dependencies based on succeeding glob.
  -E, --save-exact      Save exact version (x.y.z) instead of caret (^x.y.z) in package.json.
  --specials            List of depcheck specials to include in check for unused dependencies.
  --no-color            Force or disable color output.
  --no-emoji            Remove emoji support. No emoji in default in CI environments.
  --debug               Show 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 -gu       # Update globally installed modules by picking which ones to upgrade.

npm-check-u

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

npm-check -g -u

Update using ied or pnpm

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=always

You can also use this for dry-run testing:

NPM_CHECK_INSTALLER=echo npm-check -u

-y, --update-all

Updates your dependencies like --update, just without any prompt. This is especially useful if you want to automate your dependency updates with npm-check.

-g, --global

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

-d, --dev-only

Ignore dependencies and only check devDependencies.

This option will let it ignore outdated and unused checks for packages listed as dependencies.

-i, --ignore

Ignore dependencies that match specified glob.

$ npm-check -i babel-* will ignore all dependencies starting with 'babel-'.

-E, --save-exact

Install packages using --save-exact, meaning exact versions will be saved in package.json.

Applies to both dependencies and devDependencies.

--specials

Check 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-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. Automatically disabled in CI servers.

--spinner, --no-spinner

Enable or disable the spinner. Useful for terminals that don't support them. Automatically disabled in CI servers.

API

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')));

update

  • Interactive update.
  • default is false

global

  • Check global modules.
  • default is false
  • cwd is automatically set with this option.

skipUnused

  • Skip checking for unused packages.
  • default is false

ignoreDev

  • Ignore devDependencies.
  • This is called --production on the command line to match npm.
  • default is false

devOnly

  • Ignore dependencies and only check devDependencies.
  • default is false

ignore

  • Ignore dependencies that match specified glob.
  • default is []

saveExact

  • Update package.json with exact version x.y.z instead of semver range ^x.y.z.
  • default is false

debug

  • Show debug output. Throw in a gist when creating issues on github.
  • default is false

cwd

  • Override where npm-check checks.
  • default is process.cwd()

specials

  • List of depcheck special parsers to include.
  • default is ''

currentState

The 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:

{
  moduleName: 'lodash',                 // name of the module.
  homepage: 'https://lodash.com/',      // url to the home page.
  regError: undefined,                  // error communicating with the registry
  pkgError: undefined,                  // error reading the package.json
  latest: '4.7.0',                      // latest according to the registry.
  installed: '4.6.1',                   // version installed
  isInstalled: true,                    // Is it installed?
  notInstalled: false,                  // Is it installed?
  packageWanted: '4.7.0',               // Requested version from the package.json.
  packageJson: '^4.6.1',                // Version or range requested in the parent package.json.
  devDependency: false,                 // Is this a devDependency?
  usedInScripts: undefined,             // Array of `scripts` in package.json that use this module.
  mismatch: false,                      // Does the version installed not match the range in package.json?
  semverValid: '4.6.1',                 // Is the installed version valid semver?
  easyUpgrade: true,                    // Will running just `npm install` upgrade the module?
  bump: 'minor',                        // What kind of bump is required to get the latest, such as patch, minor, major.
  unused: false                         // Is this module used in the code?
},

You will also see this if you use --debug on the command line.

RC File Support

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"]

Inspiration

  • npm outdated - awkward output, requires --depth=0 to be grokable.
  • david - does not work with private registries.
  • update-notifier - for single modules, not everything in package.json.
  • depcheck - only part of the puzzle. npm-check uses depcheck.

About the Author

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. @dylang @dylang

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. grunt-notify
shortid Amazingly short non-sequential url-friendly unique id generator. shortid
space‑hogs Discover surprisingly large directories from the command line. space-hogs
rss RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS. rss
grunt‑prompt Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields. grunt-prompt
xml Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. xml
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
grunt‑attention Display attention-grabbing messages in the terminal grunt-attention
observatory Beautiful UI for showing tasks running on the command line. observatory
anthology Module information and stats for any @npmjs user anthology
grunt‑cat Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. grunt-cat

This list was generated using anthology.

License

Copyright (c) 2016 Dylan Greene, contributors.

Released under the MIT license.

Screenshots are CC BY-SA (Attribution-ShareAlike).

npm-check's People

Contributors

aaronasachimp avatar amilajack avatar dylang avatar dyun8080 avatar eldinoyev avatar garethtalty avatar hypercubed avatar jeffersonsimaogoncalves avatar joeycozza avatar kessiler avatar lcxfs1991 avatar lijunle avatar linusu avatar loris avatar mansona avatar nickheiner avatar omrilotan avatar pgilad avatar readmecritic avatar renovate[bot] avatar rouanw avatar sandro-pasquali avatar sbrl avatar simlu avatar systemparadox avatar timc13 avatar vinnymac avatar vith avatar woodb avatar zkochan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

npm-check's Issues

Awesome!

Not actually an issue - just wanted to say thank you for the good work! Works like a charm for me. 👍 ✨

npm-check-updates -u doesn't upgrade package.json

Hi,

I'm logged as root so no privs issue here. Original package.json has:

"devDependencies": {
    "grunt": "~0.4.5",
    "grunt-contrib-watch": "~0.4.1",
    "grunt-contrib-concat": "~0.5.0",
    "grunt-contrib-uglify": "~0.6.0",
    "grunt-assets-versioning": "~0.5.0",
    "grunt-string-replace": "~1.0.0",
    "grunt-contrib-clean": "~0.6.0",
    "grunt-angular-templates": "~0.5.7",
    "grunt-cli": "~0.1.13",
    "grunt-contrib-cssmin": "~0.11.0"
}

Running these:

[root@web dev]# npm-check-updates
"grunt-contrib-watch" can be updated from ~0.4.1 to ~0.6.1 (Installed: 0.4.4, Latest: 0.6.1)
"grunt-contrib-uglify" can be updated from ~0.6.0 to ~0.7.0 (Installed: 0.6.0, Latest: 0.7.0)
"grunt-assets-versioning" can be updated from ~0.5.0 to ~1.0.4 (Installed: 0.5.0, Latest: 1.0.4)
"grunt-contrib-cssmin" can be updated from ~0.11.0 to ~0.12.1 (Installed: 0.11.0, Latest: 0.12.1)
Run with '-u' to upgrade your package.json

[root@web dev]# npm-check-updates -u
"grunt-contrib-watch" can be updated from ~0.4.1 to ~0.6.1 (Installed: 0.4.4, Latest: 0.6.1)
"grunt-contrib-uglify" can be updated from ~0.6.0 to ~0.7.0 (Installed: 0.6.0, Latest: 0.7.0)
"grunt-assets-versioning" can be updated from ~0.5.0 to ~1.0.4 (Installed: 0.5.0, Latest: 1.0.4)
"grunt-contrib-cssmin" can be updated from ~0.11.0 to ~0.12.1 (Installed: 0.11.0, Latest: 0.12.1)
package.json upgraded

No changes:

"devDependencies": {
    "grunt": "~0.4.5",
    "grunt-contrib-watch": "~0.6.1",
    "grunt-contrib-concat": "~0.5.0",
    "grunt-contrib-uglify": "~0.7.0",
    "grunt-assets-versioning": "~1.0.4",
    "grunt-string-replace": "~1.0.0",
    "grunt-contrib-clean": "~0.6.0",
    "grunt-angular-templates": "~0.5.7",
    "grunt-cli": "~0.1.13",
    "grunt-contrib-cssmin": "~0.12.1"
}

Yet when running again:

[root@web dev]# npm-check-updates
All dependencies match the latest package versions :)

Looks to the wrong registry for scoped packages

Hey,

I'm using NPM's support for directing some specific scopes to different registries. Given the error below it seems to be npm-check is still looking for that package in the main registry.

                            �  NPM ERR!  https://registry.npmjs.org/ returned Not found : @some_scope

Cheers

npm v3 compatibility

It seems that because npm v3 has a flat structure, you get too many results back from npm-check.

I guess it needs to look at the top level dependencies by scanning the package.json?

Fix: "Installed version does not match package.json"

TL;DR: I suggest that npm-check -u gives you the option to update the module version required in package.json when there is a newer version of a module installed in node_modules/


If you somehow get a new version of a module into the 'node_modules/' so the required version in´package.json is less than what is installed then running a npm-check will give

Installed version does not match package.json

Great! lets zap that thing - by running npm-check -u - but suddenly I get

Your modules look amazing. Keep up the great work.

In my logic the -u flag will always help you solve whatever issues was found without the -u flag.

Problem with npm updating

Hi!
When I try to check latest updates of my packages, npm-check offers me to update npm:

$ npm-check -u -g
? Choose which packages to update. (Press to select)

Minor Update New backwards-compatible features.
❯◯ npm 2.11.3 ❯ 2.14.2 https://docs.npmjs.com/

But I have already updated npm 2.14.2 through npm-check!
I tried to re-install npm-check and npm separately but problem is still present. If it will help, I use OS X 10.10.5.
Probably my English is not so good as I wanted it to be, sorry for this :)

Install required packages

Could you please also tell when a package is required in the code but not yet installed ? It would make it easier to make quick prototypes: just write the require in the code, then let npm-check install all required packages.

It should not be too hard: you already know which require() are in the code, and you already know which packages are installed.

What do you think ?

*react-redux and *classnames package bug

Hi,

We have tested the npm-check package with a sample todo react app, but its not recognizing the *react-redux and *classnames package. We are using the npm version : 2.11.3 and node version: v0.12.7.

You can see in the code where they have used react-redux and classnames packages
https://github.com/rackt/redux/blob/master/examples/todomvc/containers/App.js
import { connect } from 'react-redux';

https://github.com/rackt/redux/blob/master/examples/todomvc/components/TodoTextInput.js
import classnames from 'classnames';

Providing the output below

npm-check

D:\todomvc>npm-check

classnames ? NOTUSED? Possibly never referenced in the code.
npm uninstall --save classnames to remove.
?? NPM ERR! Registry error connect ETIMEDOUT

react ?? NPM ERR! Registry error connect ETIMEDOUT

react-redux ? NOTUSED? Possibly never referenced in the code.
npm uninstall --save react-redux to remove.
?? NPM ERR! Registry error connect ETIMEDOUT

redux ?? NPM ERR! Registry error connect ETIMEDOUT

raw-loader ? NOTUSED? Possibly never referenced in the code.
npm uninstall --save-dev raw-loader to remove.
?? NPM ERR! Registry error connect ETIMEDOUT

babel-core ?? NPM ERR! Registry error connect ETIMEDOUT

jsdom ? NOTUSED? Possibly never referenced in the code.
npm uninstall --save-dev jsdom to remove.
?? NPM ERR! Registry error connect ETIMEDOUT

mocha-jsdom ?? NPM ERR! Registry error connect ETIMEDOUT

babel-loader ? NOTUSED? Possibly never referenced in the code.
npm uninstall --save-dev babel-loader to remove.
?? NPM ERR! Registry error connect ETIMEDOUT

mocha ?? NPM ERR! Registry error connect ETIMEDOUT

expect ?? NPM ERR! Registry error connect ETIMEDOUT

node-libs-browser ? NOTUSED? Possibly never referenced in the code.
npm uninstall --save-dev node-libs-browser to remove.
?? NPM ERR! Registry error connect ETIMEDOUT

react-hot-loader ? NOTUSED? Possibly never referenced in the code.
npm uninstall --save-dev react-hot-loader to remove.
?? NPM ERR! Registry error connect ETIMEDOUT

style-loader ? NOTUSED? Possibly never referenced in the code.
npm uninstall --save-dev style-loader to remove.
?? NPM ERR! Registry error connect ETIMEDOUT

todomvc-app-css ? NOTUSED? Possibly never referenced in the code.
npm uninstall --save-dev todomvc-app-css to remove.
?? NPM ERR! Registry error connect ETIMEDOUT

webpack ?? NPM ERR! Registry error connect ETIMEDOUT

webpack-dev-server ?? NPM ERR! Registry error connect ETIMEDOUT

Modules required in Mocha.opts are marked as unused

To replicate, create a mocha.opts file in your test folder and populate it as so:

--require chai
--ui bdd
--reporter spec
--harmony
--recursive

Then run npm-check with chai as one of your dev-deps.

I'm sure I could open a PR for this, but don't know how the users of this module would feel about adding this.

TypeError: Cannot read property 'replace' of null

I am using npm-check 3.2.10

when I run it on my project following error is thrown

X:\Source\myproject>npm-check
X:\sdk\npm\node_modules\npm-check\node_modules\depcheck\index.js:54
          return module.replace ? module.replace(/\/.*$/, '') : module;
                       ^
TypeError: Cannot read property 'replace' of null
    at X:\sdk\npm\node_modules\npm-check\node_modules\depcheck\index.js:54:24
    at Array.map (native)
    at EventEmitter.<anonymous> (X:\sdk\npm\node_modules\npm-check\node_modules\depcheck\index.js:53:43)
    at EventEmitter.emit (events.js:118:17)
    at fn (X:\sdk\npm\node_modules\npm-check\node_modules\depcheck\node_modules\walkdir\walkdir.js:82:19)
    at FSReqWrap.oncomplete (fs.js:95:15)

TypeError: undefined is not a function

I have the following error when using npm-check -u. However, npm-check work just fine.

[npm-check] TypeError: undefined is not a function
    at Prompt._run (/usr/lib/node_modules/npm-check/lib/prompts/alt-checkbox.js:80:9)
    at Prompt.run (/usr/lib/node_modules/npm-check/node_modules/inquirer/lib/prompts/base.js:57:8)
    at Object.<anonymous> (/usr/lib/node_modules/npm-check/node_modules/inquirer/lib/ui/prompt.js:84:12)
    at module.exports (/usr/lib/node_modules/npm-check/node_modules/inquirer/node_modules/run-async/index.js:15:21)
    at AnonymousObservable.__subscribe (/usr/lib/node_modules/npm-check/node_modules/inquirer/lib/utils/utils.js:16:7)
    at AnonymousObservable.tryCatcher (/usr/lib/node_modules/npm-check/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:63:31)
    at setDisposable (/usr/lib/node_modules/npm-check/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:5741:44)
    at AnonymousObservable.innerSubscribe [as _subscribe] (/usr/lib/node_modules/npm-check/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:5755:9)
    at AnonymousObservable.Rx.Observable.observableProto.subscribe.observableProto.forEach (/usr/lib/node_modules/npm-check/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:1604:19)
    at AnonymousObservable.__subscribe (/usr/lib/node_modules/npm-check/node_modules/inquirer/node_modules/rx-lite/rx.lite.js:2112:21)

Few informations :

  • npm-check -> 4.0.2
  • npm -> 2.14.3
  • node -> v0.12.7
  • os -> ArchLinux with 4.1.2-2 kernel

Can't install

npm i -g npm-check
leaves me with
npm WARN install Couldn't install optional dependency: shasum check failed for /tmp/npm-8548-7875fd00/registry.npmjs.org/depcheck-es6/-/depcheck-es6-0.5.4.tgz npm WARN install Expected: 7cfa907d49a6db295acfd0da89b326d9e8a5a071 npm WARN install Actual: a4e35e665e4d13d749edddeb1419dd4621175c4a npm WARN install From: https://registry.npmjs.org/depcheck-es6/-/depcheck-es6-0.5.4.tgz

my node version is 4.1.1, npm is 3.3.6
npm cache clean didn't help either

Support for private repositories with always-auth

Hi.

I would love to use npm-check but at the moment I can't convince it to use my ~/.npmrc settings. Specifically, we use an internal private npm registry (sinopa), which requires always-auth.

Is there any chance this could be supported somehow?

Thanks very much.

some used packages are listed as not used

As an example. When I run npm-check on my current project I got this:
screen shot 2015-03-09 at 3 40 09 pm

It's saying that fluxible-plugin-routr is not being used but actually it's being used on app.js (root level):

import React        from 'react';
import FluxibleApp  from 'fluxible';
import routrPlugin  from 'fluxible-plugin-routr';

var app = new FluxibleApp({
  appComponent: React.createFactory(require('./components/Application.jsx'))
});

// setup routes
app.plug(routrPlugin({ routes: require('./configs/routes') }));

// setup stores
app.registerStore(require('./stores/ApplicationStore'));

module.exports = app;

The same is happening with other packages too.

Looking for grunt support

Would it be possible to run npm-check as a grunt task? (eventually, tie it up as a continuous task on the CI) Thanks.

scoped modules marked as unused

Scoped packages, that are npm installed in package.json and required() are marked as not used when running npm-check.

For example: add "@jigsaw/ansi-canvas": "0.1.0" to package.json and require it somewhere. Running npm-check reports that it is not used.

@jigsaw/ansi-canvas 😕  NOTUSED?  Possibly never referenced in the code.

looks horrible in Windows

At least with default colors it's just ugly.

The interactive UI works in Windows but it's difficult to see when a module is selected to install.

Not finding outdated modules

I ran it once and it showed all of my outdated deps. I ran it a few hours later and now it only shows 3 out of ~20 that are outdated.

npm outdated shows all of the outdated packages still

Can I use npm-check with bower?

Hello,

Can I use npm-check with bower?

I really like npm-check and I use it for my backend dependencies, but I would like to use it for the frontend stuff. I really like the -u option since I can upgrade only the minor stuff for security and stability :P

Thank you for building this package!

exitcode !== 0 on major updates

Hey there,
for my CI Server it would be nice to add an Option "Exit Code 1 on Major up" so my Builds fail on Major updates...

Is that possible?

'exact' mode

I prefer to use --save-exact when doing npm install. Can we have an option to use that?

TypeError: Object 10 has no method 'replace'

Hey! Great module before all!

Now, I'm getting this error:

jam$ npm-check

/usr/local/lib/node_modules/npm-check/node_modules/depcheck/index.js:54
          return module.replace(/\/.*$/, '');
                        ^
TypeError: Object 10 has no method 'replace'
    at /usr/local/lib/node_modules/npm-check/node_modules/depcheck/index.js:54:25
    at Array.map (native)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm-check/node_modules/depcheck/index.js:53:43)
    at EventEmitter.emit (events.js:106:17)
    at fn (/usr/local/lib/node_modules/npm-check/node_modules/depcheck/node_modules/walkdir/walkdir.js:82:19)
    at Object.oncomplete (fs.js:107:15)

It only happens with npm-check, if I run npm-check -u it works well.

Can you help me please?

In Update, selecting and arrow keys not working

I'm using Windows 10. When I run npm-check -u I get the expected screen below, but pressing space or using the arrow keys does not update the screen. What I've found does work is to run npm-check -u, press space and then enter. There is no asterisk indicating the selection, but it does the update. I then repeat for each package.

image

npm version issue on Windows?

Just a quick qualification ... I am new to node, npm, github and open source projects in general.

Issue

On Windows i have updated npm to version 2.13.0 but npm-check thinks the latest version is 2.11.3.

On Windows

> npm list -g --depth=0

returns:

C:\Users\Warren\AppData\Roaming\npm
├── [email protected]
├── [email protected]
├── [email protected]
...

But:

> npm-check -g

returns:

npm   ?  MINOR UP  Minor update available: https://docs.npmjs.com/
                   npm install --save [email protected] to go from 2.11.3 to 2.13.0

Other Details

The Windows node installer (.msi) installs npm in the same directory as it installs node.

In my case it installed npm 2.11.3 to C:\Program Files\nodejs\node_modules\npm.

I then updated npm using:

npm -g install npm@latest

And it installed npm 2.13.0 to %APP_PATH% which in my case is C:\Users\Warren\AppData\Roaming\npm

So there are two versions of npm on my computer.

This issue is described further here:
https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

It appears that npm-check is checking (using?) the version installed by the node installer (2.11.3). While powershell is using the updated version installed via npm itself (2.13.0)

NOTE: I did also test out Option 2 described in the link above and had the same results.

Respect package.json update policy for packages

In my package.json I'm using pinned versions. It would be cool to keep it that away after doing updates.

I would even expect that it can be set per-package. So if one package uses ~ or ^ or exact version (installed with --save-exact) it should not be altered in the resulting package.json

Potential Logical Mismatch

If you have modules in your node_modules folder that aren't in your package.json file, it will warn you if they are not up to date, but not warn you if they aren't used anywhere. This seems a mismatch to other behavior. If the module is in your package.json file it will warn you that it's not used.

Suppress color output

Could we have an option to suppress color output? I find it difficult to read the color output.

Support for coffee?

How difficult would it be to add coffee-script support so that the "unused" checks are accurate in coffee projects?

Registry errors

I'm seeing a lot of errors like Registry error Request to https://registry.npmjs.org/jshint-stylish/ failed when running npm-check.

The modules for which the request fails change every time I run npm-check.

missing modules on node v4

I have node v4 installed using n (the node version manager), and npm-check is not finding any global packages other than npm itself. Morover, it's unable to update npm itself. everytime I re-run npm-check -g -u it tells me npm can be updated, and I upate it, but to no avail.

Finding unused deps based on a transpiled file

Hey there,

I'm using JSX in my code which, to my understanding, messes with detective's ability to parse the require statements correctly and figure out what's used and what isn't.

I'm just wondering if there is an easy way to point npm-check at my webpack-bundled file (which contains no JSX), and have detective correctly parse that and tell me what's used/unused.

Thanks for the excellent tool!

Ignore private modules

It would be preferable if npm-check does not query the npm registry for private modules (those with a package.json with private set to true).

BTW, this module is exactly what I was looking for and a significant improvement over npm-check-updates. So thanks!

Search in all js files from the module

...not only in the main one. The common use-case is when I have the bin directory containing a command line tool. It could require things that are not used in the library (e.g. command line parser).

Running npm-check gives me the following:

image

They are used in the bin/something.

Nice tool, btw! 😄

Having trouble with npm-check -u

Hi!

I was trying out this npm package, but I'm having trouble with using npm-check -u to select packages to update.

The "caret" used to navigate and select packages, disappears when I move it up or down so much that scrolling the list is started.

I'm using zsh with agnoster theme in iterm2.

Regards
Ruben

Node Engine Not Specified (Diff output w/diff versions)

What Node engine npm-check is attended to be ran in? The engine is not specified in the nmp-check package.json?

e.g.:

{ "engines" : { "node" : ">=0.10.3 <0.12" } }

I happen to notice after switching to a different Node release, a known-outdated dependency was not being detected anymore. I ran tests using v0.10.3, v0.12.0 & v4.2.1 and with each node environment, npm-check outputted different results (see attached screenshot) as well with npm-check -u. If I ran the same test within the same Node environment, the results were consistent with that node version.

Also, I have known outdated dependencies at --depth=3 and --depth=7 and node-check misses them. I tested by randomly picking a module at various depths and:

npm uninstall <random-dependency>
npm i <random-dependency@DEPRECIATED_VERSION>
//and then ran:
npm-check

and it missed them.

npm-check_issue

Also, Thnx for spending the extra time implementing the interactive mode! The Team will love it once I know I can use it. -j

Support ES6 import

That would be nice.
I think right now, it's not supported since almost all my modules imported via es6 module syntax are listed as unused.

undefined is not a function utils.hideCursor(this.rl);

I just updated and encountered this error:

[npm-check] TypeError: undefined is not a function
    at Prompt._run (/usr/local/lib/node_modules/npm-check/lib/prompts/alt-checkbox.js:80:9)
...

The issue seems to be with utils.hideCursor(this.rl);.
https://github.com/dylang/npm-check/blob/master/lib/prompts/alt-checkbox.js#L80

I could not find that method in inquirer/lib/utils/readline.

I removed that line for now and it showed the packages to be updated. Then it failed on the reverse utils.showCursor(this.rl). Worked okay after removing that too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.