Skip to content

fix(tools): keep sync-remote from churning pnpm-workspace.yaml#1787

Open
fengmk2 wants to merge 5 commits into
mainfrom
fix/sync-remote-redundant-exclude
Open

fix(tools): keep sync-remote from churning pnpm-workspace.yaml#1787
fengmk2 wants to merge 5 commits into
mainfrom
fix/sync-remote-redundant-exclude

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Jun 8, 2026

pnpm tool sync-remote made two unwanted changes to pnpm-workspace.yaml on every run. This PR fixes both.

Redundant minimumReleaseAgeExclude entries. The merge was a naive Set union, so versioned upstream entries (e.g. oxc-parser@0.134.0) were re-added even though the main file already excludes them via broader patterns (@oxc-parser/*, bare oxc-parser), adding ~65 redundant lines. mergeMinimumReleaseAgeExclude now drops any versioned entry already covered by a version-less pattern.

Dropped comments. The file was parsed to a plain object and re-stringified, deleting all comments (e.g. the zod-v3 pin rationale added in #1777). mergeWorkspaceYaml now parses the main file as a yaml Document, merges via the unchanged mergePnpmWorkspaces, and reconciles the result back into the document so surviving keys keep their comments.

Tests cover both: the exclude dedupe, plus comment preservation and a deep-equal check that the comment-preserving path produces the same merged data as before. tools suite and lint pass.

…emote

`pnpm tool sync-remote` merged `minimumReleaseAgeExclude` from the main,
rolldown, and vite workspaces with a naive Set union. The upstream rolldown
and vite workspaces list exact versioned bindings (`oxc-parser@0.134.0`,
`@oxc-minify/binding-darwin-arm64@0.134.0`, etc.), but the main workspace
already excludes those namespaces via globs (`@oxc-minify/*`, `@oxc-parser/*`,
`@oxc-project/*`, `@oxc-transform/*`) and bare names (`oxc-minify`,
`oxc-parser`, `oxc-transform`). A Set only dedupes exact strings, so the
versioned entries were appended on every sync even though pnpm already
excludes every version under the broader rule, adding dozens of redundant
lines to pnpm-workspace.yaml.

Replace the Set union with `mergeMinimumReleaseAgeExclude`, which preserves
order, dedupes exact duplicates, always keeps version-less patterns, and drops
any versioned entry whose package name is already covered by a version-less
pattern in the merged set.
@fengmk2 fengmk2 self-assigned this Jun 8, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 8, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 69b9a05
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a26d4a854016f0008b91e7b

@fengmk2 fengmk2 changed the title fix(tools): skip redundant minimumReleaseAgeExclude entries in sync-remote fix(tools): avoid redundant minimumReleaseAgeExclude entries in sync-remote Jun 8, 2026
@fengmk2 fengmk2 marked this pull request as ready for review June 8, 2026 08:36
@fengmk2 fengmk2 requested review from Brooooooklyn and cpojer June 8, 2026 08:36
@fengmk2
Copy link
Copy Markdown
Member Author

fengmk2 commented Jun 8, 2026

fengmk2 added 2 commits June 8, 2026 21:07
`sync-remote` rewrote pnpm-workspace.yaml by parsing it to a plain object and
re-stringifying, which dropped every comment. PR #1777 adds a comment to the
catalog (the zod-v3 pin rationale), so the next sync would silently delete it.

Add `mergeWorkspaceYaml`, a comment-preserving parse+merge+serialize seam:
parse the main workspace as a yaml Document (which retains comments), merge the
upstream rolldown/vite workspaces via the unchanged mergePnpmWorkspaces, then
reconcile the merged data back into the document so surviving keys keep their
comments. syncRemote now uses this instead of parse/stringify.
@fengmk2 fengmk2 changed the title fix(tools): avoid redundant minimumReleaseAgeExclude entries in sync-remote fix(tools): keep sync-remote from churning pnpm-workspace.yaml Jun 8, 2026
fengmk2 added 2 commits June 8, 2026 22:29
Extract an isPlainObject type guard (drops an inline check and a cast) and
hoist the duplicated Object.keys call. No behavior change.
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.

1 participant