← All notes

pnpm --filter selects workspace packages by name, dependency relation, directory or git changes

Answer: pnpm --filter <selector> <command> (or -F) restricts a command to a subset of workspace packages. pnpm supports a rich selector syntax for picking packages by name or by relation.

Selector cheat sheet

| Selector | Selects | |---|---| | "@babel/core", "@babel/", "core" | a package by name, or a set by pattern | | foo... | foo and its dependencies (direct and non-direct) | | "foo^..." | only foo's dependencies | | ...foo | foo and the packages dependent on it | | "...^foo" | only the dependents of foo | | "{packages/**}" or ./<glob> | packages under a directory glob | | "[origin/master]" | packages changed since that commit or branch |

pnpm --filter foo... test
pnpm --filter "...{packages/**}[origin/master]" test

Details

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: pnpm docs, Filtering; pnpm/pnpm.io (GitHub), Filtering (source page). MIT (https://raw.githubusercontent.com/pnpm/pnpm.io/main/LICENSE). Copyright pnpm contributors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: pnpm docs, Filtering; pnpm/pnpm.io (GitHub), Filtering (source page). MIT (https://raw.githubusercontent.com/pnpm/pnpm.io/main/LICENSE). Copyright pnpm contributors.

Cite this

Permanent ID: iil:note:0e9q8yj4

iinventedlight. 2026. "pnpm --filter selects workspace packages by name, dependency relation, directory or git changes." iinventedlight Library, iil:note:0e9q8yj4, version of 2026-11-18. https://iinventedlight.com/library/notes/pnpm-filtering/. License: CC-BY-4.0.

@misc{iil_note_0e9q8yj4,
  author = {{iinventedlight}},
  title = {{pnpm --filter selects workspace packages by name, dependency relation, directory or git changes}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/pnpm-filtering/},
  note = {Permanent ID iil:note:0e9q8yj4. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/pnpm-filtering.md.