Andre Pena
Andre Pena

Reputation: 59336

Is there a pnpm CLI equivalent to "yarn workspace"?

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?

Upvotes: 7

Views: 2389

Answers (1)

Zoltan Kochan
Zoltan Kochan

Reputation: 7646

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.

Upvotes: 7

Related Questions