Get package properties in pnpm monorepo

pnpm, package.json, monorepo - published at 24/08/2023

npm has a npm pkg command to retrieve package properties from package.json. https://docs.npmjs.com/cli/v7/commands/npm-pkg

In pnpm workspace, you can do the same for each pacakges using pnpm --filter exec.

pnpm --filter @org/package-name exec npm pkg get name
#=> @org/package-name

pnpm --filter @org/package-name exec npm pkg get version
#=> 1.0.0

pnpm --filter has an ability to filter pnpm commands in specified packages.
See more details at pnpm doc.