unused-bundle-deps v1.0.1
unused-bundle-deps
For a given browserify bundle, lists all the dependencies in your package.json which do not appear in that bundle. In large codebases this can be useful to find dependencies that are no longer relevant in production (i.e. for your legal teams).
Note: This works on dependencies through the entire bundle; for top-level dependencies you can use dependency-check.
#install
npm install -g unused-bundle-deps
#use it like so
browserify index.js | unused-bundle-deps -pExample output with -p (pretty) flag:
dependencies [5]
├── abs-svg-path
├── adaptive-bezier-curve
├── normalize-svg-path
├── svg-path-contours
└── vec2-copyUsage
API
unused(src, [opt], [cb])
Finds unused dependencies in src (browser-pack bundle) by looking through your "dependencies" of the closest package.json file. Options can be:
cwdthe dir to search for pakage.json, defualtprocess.cwd()filtera filter function for closest-package
Callback is called with (err, unusedDeps) where unusedDeps is an array of names like [ "xtend", "lodash" ]. If there was an error reading the source bundle, finding the closest package, or reading it, err will be non-null.
CLI
Usage:
unused-bundle-deps [opts] < bundle.js
Options:
--pretty, -p pretty-print the results
--cwd current dir to search for package.jsonAlso See
License
MIT, see LICENSE.md for details.
