1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00

Add List The Installed Version Of A Specific Package as a pnpm TIL

This commit is contained in:
jbranchaud
2023-03-29 11:48:13 -05:00
parent ab60deea73
commit fd3da2c985
2 changed files with 34 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1294 TILs and counting..._
_1295 TILs and counting..._
---
@@ -590,6 +590,7 @@ _1294 TILs and counting..._
- [Execute A Command From The Workspace Root](pnpm/execute-a-command-from-the-workspace-root.md)
- [Install Command Runs For Entire Workspace](pnpm/install-command-runs-for-entire-workspace.md)
- [List The Installed Version Of A Specific Package](pnpm/list-the-installed-version-of-a-specific-package.md)
### PostgreSQL

View File

@@ -0,0 +1,32 @@
# List The Installed Version Of A Specific Package
`pnpm` is a Node-ecosystem package manager with first-class support for
monorepos. In a monorepo with many apps and packages that each have their own
`package.json` file, it can be tricky to know what version of a package is
installed for a specific app or package.
The `pnpm list` command can help with that. First navigate to a specific app or
package whose dependencies you want to know about. Then run a command like the
following, replacing `@trpc/next` with your package of interest.
```bash
$ pnpm list '@trpc/next'
Legend: production dependency, optional only, dev only
epic-react /Users/jbranchaud/code/clients/egghead/products/apps/epic-react
dependencies:
@trpc/next 10.7.0
```
It tells you the exact version of that dependency that is isntalled for the
current app/package.
This command can also be used with regex. Let's say you want to know about all
`next`-related dependencies. You could do the following:
```bash
$ pnpm list '*next*'
```
[source](https://pnpm.io/cli/list)