pnpm -r (recursive) in Monorepos
pnpm -r applies a command to every package in the workspace.
Recursive commands are the backbone of pnpm monorepo CI: install once, then build and test across packages.
Common usage
pnpm -r installpnpm -r run build- topological by defaultpnpm -r --filter <scope>- subsetpnpm -r exec <cmd>
Example in CI
Build all packages in dependency order.
shell
pnpm -r run buildIn CI
pnpm orders builds by the dependency graph automatically. For large graphs, faster managed runners shorten the critical path.
Key takeaways
pnpm -rruns across all packages.- Builds are topological by default.
- Combine with
--filterfor subsets.