Skip to content

Commit 74c0231

Browse files
committed
Add Find The Version Of An Installed Dependency as a JavaScript til
1 parent 48299a7 commit 74c0231

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
1212

13-
_1163 TILs and counting..._
13+
_1164 TILs and counting..._
1414

1515
---
1616

@@ -382,6 +382,7 @@ _1163 TILs and counting..._
382382
- [Easy Date Comparison With DayJS](javascript/easy-date-comparison-with-dayjs.md)
383383
- [Expand Emojis With The Spread Operator](javascript/expand-emojis-with-the-spread-operator.md)
384384
- [Fill An Input With A Ton Of Text](javascript/fill-an-input-with-a-ton-of-text.md)
385+
- [Find The Version Of An Installed Dependency](javascript/find-the-version-of-an-installed-dependency.md)
385386
- [Find Where Yarn Is Installing Binaries](javascript/find-where-yarn-is-installing-binaries.md)
386387
- [for...in Iterates Over Object Properties](javascript/for-in-iterates-over-object-properties.md)
387388
- [Formatting Values With Units For Display](javascript/formatting-values-with-units-for-display.md)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Find The Version Of An Installed Dependency
2+
3+
I recently ran into a bug related to a specific version of a dependency. As
4+
part of tracking it down, I needed to figure out what version I had installed.
5+
6+
The [`yarn list`](https://classic.yarnpkg.com/en/docs/cli/list) command can
7+
help with this. Without any flags, it will show a tree structure listing _every
8+
single_ dependency and sub-dependency that is installed for your project.
9+
10+
Here is an example of what that looks like restricted to a pattern of `jest`.
11+
12+
```bash
13+
$ yarn list --pattern jest
14+
15+
yarn list v1.22.10
16+
├─ @testing-library/[email protected]
17+
├─ @types/[email protected]
18+
├─ @types/[email protected]
19+
│ ├─ @jest/[email protected]
20+
│ ├─ @types/[email protected]
21+
22+
23+
...
24+
```
25+
26+
I can look through this list and find the dependency and version of interest.
27+
28+
It's still a lot of results to comb through, so what I like to do instead is
29+
pipe it to [`fzf`](https://github.com/junegunn/fzf).
30+
31+
```bash
32+
$ yarn list | fzf
33+
```
34+
35+
Then I can interactively narrow down the results with the power of FZF's fuzzy
36+
finding functionality.

0 commit comments

Comments
 (0)