Wondering what’s next for npm?Check out our public roadmap! »

    unused-bundle-deps

    1.0.1 • Public • Published

    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.

    Install

    npm i unused-bundle-deps

    DownloadsWeekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • avatar