From fd3da2c9855d8fd4fc980bff1f587877d9864f20 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Wed, 29 Mar 2023 11:48:13 -0500 Subject: [PATCH] Add List The Installed Version Of A Specific Package as a pnpm TIL --- README.md | 3 +- ...installed-version-of-a-specific-package.md | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 pnpm/list-the-installed-version-of-a-specific-package.md diff --git a/README.md b/README.md index 727678a..c1986d4 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pnpm/list-the-installed-version-of-a-specific-package.md b/pnpm/list-the-installed-version-of-a-specific-package.md new file mode 100644 index 0000000..f85666d --- /dev/null +++ b/pnpm/list-the-installed-version-of-a-specific-package.md @@ -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)