pnpm run and pnpm -r run
pnpm run executes a package script; add -r to run it everywhere.
In a pnpm monorepo, pnpm -r run build builds every package, optionally in topological order.
Common usage
pnpm run <script>pnpm -r run <script>- all workspacespnpm --filter <pkg> run <script>--workspace-concurrency- limit parallelism
Example in CI
Test only changed packages and their dependents.
shell
pnpm --filter "...[origin/main]" run testIn CI
The ...[ref] filter needs full git history (fetch-depth: 0). A non-zero script exit fails the job.
Key takeaways
pnpm -r runruns across workspaces.--filter "...[ref]"needsfetch-depth: 0.- Non-zero exit fails CI.