Skip to content

Commit 554246c

Browse files
committed
Updated documentation
1 parent 24b0aea commit 554246c

File tree

2 files changed

+61
-40
lines changed

2 files changed

+61
-40
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66

77
### Added
88
- display the output as an ASCII tree
9+
- new option `--filter`, to limit which versions to search for
10+
- new ption `--dedup` to remove duplicate results
911
- colorize output when using a TTY
10-
- MAX_PKG_VISITS can be set with an env var
11-
- remove duplicate results using --dedup
12+
- env var MAX_PKG_VISITS can be set to bypass hypotetical infinite loops.
13+
It stops searching children of a package when it was visited already more than
14+
MAX_PKG_VISITS times
1215
- fixed a bug detecting dependencies on newer versions of yarn.lock
1316
- fix duplication caused by dependencies using patch protocol
1417

README.md

Lines changed: 56 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,44 @@ OPTIONS:
3636
-h, --help Prints this help and exit
3737
-V, --version Prints version information
3838
-y, --yarn-lock-file Path to a yarn.lock file to parse
39+
--filter [descriptors] Keep only matching versions
40+
(e.g. --filter '>=1.3.0, <2.0.0')
3941
4042
ARGS:
4143
package[@range] Package to search for, with or without range.
4244
The range must match one in yarn.lock
4345
```
4446

45-
Example output (searching for `lodash`)
46-
47+
Example output (searching for `fs-minipass`)
48+
49+
```bash
50+
└─ [email protected] (via ^5.2.0)
51+
├─ [email protected] (via ~2.3.3)
52+
│ └─ [email protected] (via latest)
53+
│ ├─ [email protected] (via ^13.0.0)
54+
│ │ └─ [email protected] (via ^18.0.0)
55+
│ │ ├─ [email protected] (via ^3.0.0)
56+
│ │ └─ [email protected] (via ^6.1.11)
57+
│ │ └─ [email protected] (via ^2.0.0)
58+
│ └─ [email protected] (via ^6.1.2)
59+
│ └─ [email protected] (via ^2.0.0)
60+
└─ [email protected] (via ^4.13.0)
61+
└─ [email protected] (via ~2.3.2)
62+
└─ [email protected] (via latest)
4763
```
48-
├─ standard@^11.0.0
49-
│ └─ eslint@~4.18.0
50-
│ ├─ inquirer@^3.0.6
51-
│ │ └─ lodash@^4.3.0
52-
│ ├─ lodash@^4.17.4
53-
54-
│ └─ lodash@^4.17.4
55-
56-
57-
└─ async@^2.1.2
58-
└─ lodash@^4.14.0
64+
65+
Similar search, but filtered for `fs-minipass --filter '>=3.0, <4.0.0'`
66+
67+
```bash
68+
└─ [email protected] (via ^5.2.0)
69+
├─ [email protected] (via ~2.3.3)
70+
│ └─ [email protected] (via latest)
71+
│ └─ [email protected] (via ^13.0.0)
72+
│ └─ [email protected] (via ^18.0.0)
73+
│ └─ [email protected] (via ^3.0.0)
74+
└─ [email protected] (via ^4.13.0)
75+
└─ [email protected] (via ~2.3.2)
76+
└─ [email protected] (via latest)
5977
```
6078

6179
Defaults:
@@ -65,35 +83,35 @@ Defaults:
6583

6684
## Benchmarks
6785

68-
Benchmarks run on Thinkpad T460s
69-
- node 17.9.0
70-
- yarn 1.22.18 / yarn 3.2.0
86+
Benchmarks run on Framework Laptop 14 AMD Ryzen 7 7840U
87+
- node 21.7.1
88+
- yarn 1.22.22 / yarn 4.1.0
7189
- using [renovate 35.45.5 yarn.lock file](https://github.com/renovatebot/renovate/blob/32.45.5/yarn.lock) (v1 first, then updating it)
7290

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

75-
```
76-
$ hyperfine 'yarn-why -y yarn.lock lodash'
77-
Benchmark #1: yarn-why -y yarn.lock lodash
78-
Time (mean ± σ): 9.4 ms ± 1.6 ms [User: 8.3 ms, System: 1.1 ms]
79-
Range (min … max): 7.8 ms … 22.7 ms 191 runs
80-
81-
$ hyperfine 'yarn why lodash'
82-
Benchmark #1: yarn why lodash
83-
Time (mean ± σ): 1.012 s ± 0.012 s [User: 1.686 s, System: 0.101 s]
84-
Range (min … max): 0.994 s 1.026 s 10 runs
85-
86-
# again, after updating yarn.lock using `yarn 3.2.0`
87-
88-
$ hyperfine 'yarn why lodash'
89-
Benchmark #1: yarn why lodash
90-
⠏ Current estimate: 45.455 s █████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ETA 00:05:17
91-
^C # was taking too long, I stopped it
92-
93-
hyperfine 'yarn-why -y yarn.lock lodash'
94-
Benchmark #1: yarn-why -y yarn.lock lodash
95-
Time (mean ± σ): 11.8 ms ± 0.8 ms [User: 10.6 ms, System: 1.3 ms]
96-
Range (min … max): 9.8 ms … 14.5 ms 179 runs
93+
```bash
94+
$ hyperfine -w 3 './target/release/yarn-why lodash' # yarn.lock v1
95+
Benchmark 1: ./target/release/yarn-why lodash
96+
Time (mean ± σ): 4.9 ms ± 0.6 ms [User: 3.8 ms, System: 1.1 ms]
97+
Range (min … max): 2.3 ms … 7.8 ms 398 runs
98+
99+
$ hyperfine -w 3 'yarn why lodash' # yarn v1.22.22 / yarn.lock v1
100+
Benchmark 1: yarn why lodash
101+
Time (mean ± σ): 416.0 ms ± 76.7 ms [User: 691.7 ms, System: 75.0 ms]
102+
Range (min … max): 367.9 ms608.7 ms 10 runs
103+
104+
# again, after updating the same yarn.lock to v8 using `yarn 4.1.0`
105+
106+
$ hyperfine -w 3 './target/release/yarn-why lodash' # yarn.lock v8
107+
Benchmark 1: ./target/release/yarn-why lodash
108+
Time (mean ± σ): 6.0 ms ± 0.6 ms [User: 4.6 ms, System: 1.4 ms]
109+
Range (min … max): 3.6 ms … 8.5 ms 340 runs
110+
111+
$ hyperfine 'yarn why lodash' # yarn v4.1.0 / yarn.lock v8
112+
Benchmark 1: yarn why lodash
113+
Time (mean ± σ): 295.0 ms ± 57.7 ms [User: 316.1 ms, System: 58.1 ms]
114+
Range (min … max): 229.9 ms … 361.0 ms 10 runs
97115
```
98116

99117
## LICENSE

0 commit comments

Comments
 (0)