npm-check package で依存 package の更新情報と未使用を検出します
インストール
$ npm install -g npm-check
サンプル
npm 版の cowsay に対して試してみます。
2件の更新対象がみつかりました。
$ pwd
<cowsay project root>
$ npm-check
get-stdin 😎 MAJOR UP Major update available. https://github.com/sindresorhus/get-stdin
npm install --save get-stdin@5.0.1 to go from 4.0.1 to 5.0.1
nodeunit 😎 NEW VER! NonSemver update available. https://github.com/caolan/nodeunit#readme
npm install --save-dev nodeunit@0.10.0 to go from 0.9.3 to 0.10.0
Use npm-check -u for interactive update.
まとめ
更新情報を検出するだけなら npm outdated
と変わりませんが、
package.json にあるが未使用の Package や、逆にコード内で利用しているが
package.json に依存の記載がない Package も警告してくれます。
ただし精度に問題があるようです。
依存性のチェックは depcheck/depcheck package で行っていますが、
このリポジトリのREADMEでも以下のように明言しています。
The logic of a special is not perfect. There might be false alerts. If this happens, please open an issue for us.
とはいえ、有益であることに変わらないのでしょう。
npm-check の star が 2016/08/31 現在で 2,697 もついているので。