Skip to content

feat(workspace): support pnpm's changed-since filter selector - #1009

Open
ReemX wants to merge 1 commit into
voidzero-dev:mainfrom
ReemX:feat/filter-changed-since
Open

ReemX wants to merge 1 commit into
voidzero-dev:mainfrom
ReemX:feat/filter-changed-since

Conversation

@ReemX

@ReemX ReemX commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Motivation

vp run --filter "...[<ref>]" is how teams coming from pnpm or Turborepo run CI for the changed packages only. Today [<ref>] is parsed as a glob character class, matches nothing, and the run exits 0, so a migrated pipeline builds nothing and passes. Closes voidzero-dev/vite-plus#2903, with the shape proposed there: pnpm parity on --filter, --affected left for later.

Change

  • --filter accepts pnpm's [<since>] group: [<since>], ...[<since>], [<since>]..., the ^ forms, name[<since>], {dir}[<since>] and !...[<since>]. As in pnpm's selector regex, a trailing [...] is the revision, so foo[ab] is no longer a glob (foo[ab]* still is).
  • Detection follows pnpm's get_changed_projects: git diff --name-only against the merge base of <since> and HEAD, so uncommitted changes to tracked files count and untracked files don't. A file belongs to the deepest package containing it, or to the root package. When pnpm-workspace.yaml changed, its catalogs at the merge base are compared with the ones on disk, and packages taking a changed entry through catalog: count as changed (the catalogMode: prefer case from the issue).
  • An unknown revision, no git repository, or no merge base (as in a shallow clone, with an --unshallow hint) is an error, not an empty match. pnpm compares against <since> directly when the merge base is missing; I went with the error, as discussed in the issue.
  • {dir}[<since>] narrows the usual {dir} match to changed packages. pnpm instead uses the dir as the diff pathspec; the result is the same for its documented forms such as {packages/**}[ref].
  • Not included: testPattern, changedFilesIgnorePattern, catalog overrides/includes, --affected.
  • The plan snapshot harness gets a [[git.commits]] option so fixtures can have a git history. New unit tests run against real repositories made in temp dirs, and there are new plan and e2e fixtures (a leaf change where ...[HEAD~1] builds utils → lib → app, an uncommitted change, a catalog-only change, and the error cases).

If this lands, I'll send the matching note for the run guide's Filter section in vite-plus.

`vp run --filter "[<since>]"` now selects the packages with a file changed
since a git revision, as pnpm does, and combines with the rest of the
selector: `...[<since>]`, `[<since>]...`, the `^` forms, `name[<since>]`,
`{dir}[<since>]` and `!...[<since>]`. Before, `[<since>]` was parsed as a
glob character class, matched nothing and exited 0.

Detection follows pnpm's get_changed_projects: git diff --name-only against
the merge base of <since> and HEAD, so uncommitted changes to tracked files
count and untracked files don't; each file belongs to the deepest package
that contains it, the root package for files outside every other one. When
pnpm-workspace.yaml changed, the packages that take a changed catalog entry
count as changed too.

An unknown revision, a workspace outside a git repository, or no merge base
(as in a shallow clone) is an error instead of an empty match.

A trailing `[...]` group is now always the revision, as in pnpm's selector
regex, so `foo[ab]` is no longer a glob; `foo[ab]*` still is.

Refs voidzero-dev/vite-plus#2903.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vp run --filter: support pnpm's changed-since selector ([<ref>], ...[<ref>]), as Turborepo does

1 participant