slow-deps

    1.4.0 • Public • Published

    slow-deps JavaScript Style Guide

    CLI to measure which dependencies in a project are the slowest to npm install.

    Usage

    npm install -g slow-deps
    slow-deps
    

    Example output

    Analyzing 7 dependencies...
    [====================] 100% 0.0s
    --------------------------------------------------
    | Dependency           | Time  | Size   | # Deps |
    --------------------------------------------------
    | browserify           | 22.2s | 14 MB  | 94     |
    | jshint               | 7.9s  | 4.6 MB | 26     |
    | istanbul             | 7s    | 5.1 MB | 27     |
    | promises-aplus-tests | 5.4s  | 2.4 MB | 24     |
    | uglify-js            | 4.4s  | 1.7 MB | 18     |
    | mocha                | 4.3s  | 924 KB | 16     |
    | immediate            | 1.3s  | 24 KB  | 0      |
    --------------------------------------------------
    Total time (non-deduped): 52.6s
    Total size (non-deduped): 29 MB
    

    Details

    Run this in a directory with a package.json, and it will take all the dependencies, devDependencies, and optionalDependencies, then npm install each one in a temporary directory with a temporary cache, then measure the install times. Each dependency is then listed from slowest to fastest.

    In addition to the install time, the size on disk and the total number of transitive dependencies are also printed.

    Note that this doesn't measure the cost of npm de-duplicating the sub-dependencies; it only measures the time for installing each dependency independently. So the "total time" and "total size" are both just rough estimates, as are the per-package times, because you may have packages with many common dependencies that would therefore get de-duped.

    It's also worth noting that because this tool creates a temporary npm cache while it works, you'll be seeing the uncached time for each package. Therefore your actual npm install should run a bit faster, assuming everything is cached.

    Options

    Usage: slow-deps [options]
    
    Options:
      --production, --prod  Skip devDependencies                           [boolean]
      --no-optional         Skip optionalDependencies                      [boolean]
      --no-shrinkwrap       Ignore npm-shrinkwrap.json                     [boolean]
      -h, --help            Show help                                      [boolean]
    
    Examples:
      slow-deps                             measure all deps in the current project
      slow-deps --production --no-optional  skip both optional and dev dependencies
    

    Credits

    Huge shout-out to Michael Hart for the inspiration for this tool!

    Also a big thanks to all contributors!

    Related

    Install

    npm i slow-deps

    DownloadsWeekly Downloads

    143

    Version

    1.4.0

    License

    Apache-2.0

    Last publish

    Collaborators

    • nolanlawson