unused-bundle-deps
lists unused dependencies in a bundle
Last updated 5 years ago by mattdesl .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install unused-bundle-deps 
SYNC missed versions from official npm registry.

unused-bundle-deps

stable

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

Example output with -p (pretty) flag:

dependencies [5]
├── abs-svg-path
├── adaptive-bezier-curve
├── normalize-svg-path
├── svg-path-contours
└── vec2-copy

Usage

NPM

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:

  • cwd the dir to search for pakage.json, defualt process.cwd()
  • filter a 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.json

Also See

License

MIT, see LICENSE.md for details.

Current Tags

  • 1.0.1                                ...           latest (5 years ago)

2 Versions

  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |