2 releases

1.0.0-rc3 Nov 15, 2022
1.0.0-rc2 May 10, 2022

#1911 in Command line utilities

33 downloads per month

GPL-3.0-or-later

25KB
526 lines

yarn-why

version ci license

yarn why, but fast

Install

Download one of the prebuilt binaries

or run

cargo install yarn-why

Help

yarn-why 1.0.0-rc2

Usage:
    yarn-why [OPTIONS] package[@range] # read ./yarn.lock
    yarn-why [OPTIONS] package[@range] < /path/to/yarn.lock
    yarn-why [OPTIONS] package[@range] -y /path/to/yarn.lock

Example:
    yarn-why lodash@^4.17.15

OPTIONS:
    -d, --max-depth [depth]  Truncate dependencies at that level [Default: 10]
    -D, --no-max-depth       Ignore max-depth (both default and user defined)
        --(no)-dedup         Display packages at most once [Default: true]
    -j, --json               Format the output as JSON
    -h, --help               Prints this help and exit
    -V, --version            Prints version information
    -y, --yarn-lock-file     Path to a yarn.lock file to parse

ARGS:
    package[@range]          Package to search for, with or without range.
                             The range must match one in yarn.lock

Benchmarks

Benchmarks run on Thinkpad T460s

(had to use -y because hyperfine would trigger stdin input)

$ hyperfine 'yarn-why -y yarn.lock lodash'
Benchmark #1: yarn-why -y yarn.lock lodash
  Time (mean ± σ):       9.4 ms ±   1.6 ms    [User: 8.3 ms, System: 1.1 ms]
  Range (min … max):     7.8 ms …  22.7 ms    191 runs

$ hyperfine 'yarn why lodash'
Benchmark #1: yarn why lodash
  Time (mean ± σ):      1.012 s ±  0.012 s    [User: 1.686 s, System: 0.101 s]
  Range (min … max):    0.994 s …  1.026 s    10 runs

# again, after updating yarn.lock using `yarn 3.2.0`

$ hyperfine 'yarn why lodash'
Benchmark #1: yarn why lodash
 ⠏ Current estimate: 45.455 s     █████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ETA 00:05:17
^C # was taking too long, I stopped it

hyperfine 'yarn-why -y yarn.lock lodash'
Benchmark #1: yarn-why -y yarn.lock lodash
  Time (mean ± σ):      11.8 ms ±   0.8 ms    [User: 10.6 ms, System: 1.3 ms]
  Range (min … max):     9.8 ms …  14.5 ms    179 runs

LICENSE

yarn-why is distributed under the GNU GPL license (version 3 or any later version).

See LICENSE file for details.

Dependencies

~1.8–3MB
~59K SLoC