Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
pnpm 10.x reference skill covering workspaces, catalogs, patches, peer deps, overrides, and CI/CD caching strategies.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/core-cli.md
1---2name: pnpm-cli-commands3description: Essential pnpm commands for package management, running scripts, and workspace operations4---56# pnpm CLI Commands78pnpm provides a comprehensive CLI for package management with commands similar to npm/yarn but with unique features.910## Installation Commands1112### Install all dependencies13```bash14pnpm install15# or16pnpm i17```1819### Add a dependency20```bash21# Production dependency22pnpm add <pkg>2324# Dev dependency25pnpm add -D <pkg>26pnpm add --save-dev <pkg>2728# Optional dependency29pnpm add -O <pkg>3031# Global package32pnpm add -g <pkg>3334# Specific version35pnpm add <pkg>@<version>36pnpm add <pkg>@next37pnpm add <pkg>@^1.0.038```3940### Remove a dependency41```bash42pnpm remove <pkg>43pnpm rm <pkg>44pnpm uninstall <pkg>45pnpm un <pkg>46```4748### Update dependencies49```bash50# Update all51pnpm update52pnpm up5354# Update specific package55pnpm update <pkg>5657# Update to latest (ignore semver)58pnpm update --latest59pnpm up -L6061# Interactive update62pnpm update --interactive63pnpm up -i64```6566## Script Commands6768### Run scripts69```bash70pnpm run <script>71# or shorthand72pnpm <script>7374# Pass arguments to script75pnpm run build -- --watch7677# Run script if exists (no error if missing)78pnpm run --if-present build79```8081### Execute binaries82```bash83# Run local binary84pnpm exec <command>8586# Example87pnpm exec eslint .88```8990### dlx - Run without installing91```bash92# Like npx but for pnpm93pnpm dlx <pkg>9495# Examples96pnpm dlx create-vite my-app97pnpm dlx degit user/repo my-project98```99100## Workspace Commands101102### Run in all packages103```bash104# Run script in all workspace packages105pnpm -r run <script>106pnpm --recursive run <script>107108# Run in specific packages109pnpm --filter <pattern> run <script>110111# Examples112pnpm --filter "./packages/**" run build113pnpm --filter "!./packages/internal/**" run test114pnpm --filter "@myorg/*" run lint115```116117### Filter patterns118```bash119# By package name120pnpm --filter <pkg-name> <command>121pnpm --filter "@scope/pkg" build122123# By directory124pnpm --filter "./packages/core" test125126# Dependencies of a package127pnpm --filter "...@scope/app" build128129# Dependents of a package130pnpm --filter "@scope/core..." test131132# Changed packages since commit/branch133pnpm --filter "...[origin/main]" build134```135136## Other Useful Commands137138### Link packages139```bash140# Link global package141pnpm link --global142pnpm link -g143144# Use linked package145pnpm link --global <pkg>146```147148### Patch packages149```bash150# Create patch for a package151pnpm patch <pkg>@<version>152153# After editing, commit the patch154pnpm patch-commit <path>155156# Remove a patch157pnpm patch-remove <pkg>158```159160### Store management161```bash162# Show store path163pnpm store path164165# Remove unreferenced packages166pnpm store prune167168# Check store integrity169pnpm store status170```171172### Other commands173```bash174# Clean install (like npm ci)175pnpm install --frozen-lockfile176177# List installed packages178pnpm list179pnpm ls180181# Why is package installed?182pnpm why <pkg>183184# Outdated packages185pnpm outdated186187# Audit for vulnerabilities188pnpm audit189190# Rebuild native modules191pnpm rebuild192193# Import from npm/yarn lockfile194pnpm import195196# Create tarball197pnpm pack198199# Publish package200pnpm publish201```202203## Useful Flags204205```bash206# Ignore scripts207pnpm install --ignore-scripts208209# Prefer offline (use cache)210pnpm install --prefer-offline211212# Strict peer dependencies213pnpm install --strict-peer-dependencies214215# Production only216pnpm install --prod217pnpm install -P218219# No optional dependencies220pnpm install --no-optional221```222223<!--224Source references:225- https://pnpm.io/cli/install226- https://pnpm.io/cli/add227- https://pnpm.io/cli/run228- https://pnpm.io/filtering229-->230