pnpm
pnpm — fast, disk-efficient package manager with workspace monorepo and content-addressable store.
SKILL.mdconfig/skills/pnpm/SKILL.md
GitHubpnpm
Workspace Monorepo
pnpm-workspace.yaml:packages: - 'apps/*' - 'packages/*'— define workspace members.- Local dependencies:
"@repo/ui": "workspace:*"— resolved from workspace. pnpm addrespects workspace protocol;pnpm publishrewritesworkspace:semver.
Content-Addressable Store
- Single global store (
~/.pnpm-store) — deduplicated by content hash. - Hard links inside
node_modules— saves disk space across projects. pnpm store prune— remove unreferenced packages;pnpm store status— check integrity.
Dependency Resolution
- Strict hoisting: only direct deps in
node_modules/.pnpm— prevents phantom dependencies. pnpm.overridesinpackage.json— force version resolution.pnpm.peerDependencyRules.allowedVersions— allow specific peer ranges..npmrc—shamefully-hoist=truefor legacy compat.
Filter & Recursive
pnpm --filter <name> add dep— scoped to workspace member.pnpm -r build— run across all packages;pnpm -r --parallel— concurrent.pnpm --filter "{packages/*}..."— glob filters with dependents graph.
Publishing
pnpm publish --recursive— publish changed packages.pnpm pack— create tarball;pnpm publish --dry-run— preview.- Package patching:
pnpm patch <pkg>/pnpm patch-commit <dir>.