Home > Software engineering >  Is there a pnpm CLI equivalent to "yarn workspace"?
Is there a pnpm CLI equivalent to "yarn workspace"?

Time:02-28

I'm trying https://pnpm.io/ with workspaces and I can't seem to be able to install packages and run commands in specific workspaces as I do with Yarn.

Using yarn, I could do, for example:

# adds express to the server workspace
yarn workspace server add express

# run the build script in the common workspace
yarn workspace common run build

How do I achieve the same with the pnpm CLI?

CodePudding user response:

Yes, see https://pnpm.io/filtering

# adds express to the server workspace
pnpm --filter server add express

# run the build script in the common workspace
pnpm --filter common run build

Instead of --filter you may also use -F.

  • Related