fix(tools): keep sync-remote from churning pnpm-workspace.yaml#1787
Open
fengmk2 wants to merge 5 commits into
Open
fix(tools): keep sync-remote from churning pnpm-workspace.yaml#1787fengmk2 wants to merge 5 commits into
fengmk2 wants to merge 5 commits into
Conversation
…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.
✅ Deploy Preview for viteplus-preview canceled.
|
Member
Author
`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.
Extract an isPlainObject type guard (drops an inline check and a cast) and hoist the duplicated Object.keys call. No behavior change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pnpm tool sync-remotemade two unwanted changes topnpm-workspace.yamlon every run. This PR fixes both.Redundant
minimumReleaseAgeExcludeentries. The merge was a naiveSetunion, 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/*, bareoxc-parser), adding ~65 redundant lines.mergeMinimumReleaseAgeExcludenow 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).
mergeWorkspaceYamlnow parses the main file as a yamlDocument, merges via the unchangedmergePnpmWorkspaces, 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.