2 个版本

1.0.0-rc32022年11月15日
1.0.0-rc22022年5月10日

命令行实用工具 中排名 1935

GPL-3.0-or-later

25KB
526 代码行

yarn-why

version ci license

yarn why,但更快

安装

下载预构建的二进制文件之一 (链接)

或运行

cargo install yarn-why

帮助

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

基准测试

基准测试在 Thinkpad T460s 上运行

(必须使用 -y,因为 hyperfine 会触发 stdin 输入)

$ 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

许可证

yarn-why 根据 GNU GPL 许可证(版本 3 或任何后续版本)分发。

有关详细信息,请参阅 LICENSE 文件。

依赖关系

~1.9–3MB
~61K SLoC