Skip to content

shoebox639/pnpm-recursive-filter-root-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pnpm --recursive + --filter includes workspace root (regression)

Minimal reproduction for a pnpm bug: any --filter argument passed to pnpm --recursive run/exec causes the workspace root to be incorrectly included in the matched set of workspace projects, contrary to the documented default.

Repo layout

.
├── package.json        # root, private
├── pnpm-workspace.yaml # packages: [a, b]
├── a/package.json
└── b/package.json

Reproduce

# Correct: root excluded
pnpm --recursive exec pwd
# a
# b

# Bug: root appears in output
pnpm --recursive --filter '!a' exec pwd
# b
# .   <-- workspace root, should not be here

Affected versions

pnpm version Behavior
10.13.0 ✅ root excluded (correct)
10.33.0 ❌ root included
10.33.1 ❌ root included
11.0.0-rc.5 ❌ root included

Regression range: works in 10.13.0, broken by 10.33.0.

Why this matters

A common recursive invocation like

pnpm --recursive --filter '!frontend' --filter '!backend' run test

will attempt to run the test script on the root package in addition to the filtered sub-packages. If the root has the script defined (perhaps for a different purpose, e.g. aggregating via projects[] in a Jest config), it will be executed unexpectedly.

includeWorkspaceRoot defaults to false, and explicitly setting it does not change this behavior when filters are in use.

About

Minimal reproduction for pnpm --recursive+--filter including workspace root (regression in 10.33.0+)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors