feat: resolve workspace: and catalog: protocols when syncing package.json - #7
Merged
Merged
Conversation
…json Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
When applying a patch directly from a source directory (without
--pack),workspace:andcatalog:dependency specifiers in the sourcepackage.jsonpreviously leaked through into the patched package, leaving versions the consumer could not resolve. This PR resolves them inline:workspace:*/^/~/<range>→ reuses the version already present in the patched package's existing entry (withworkspace:1.2.3falling back to the literal version when no local entry exists).catalog:/catalog:<name>→ looked up in the source repo'spnpm-workspace.yaml(catalogfor default,catalogs.<name>for named).npm:,link:,file:,git+ssh:, etc.) keep their literal value but emit a yellow warning naming the protocol.--packmode skips catalog lookup sincepnpm packalready resolves both protocols. Each resolution emits a dim log line so the user can see what changed. Addsyamlas a dependency for parsingpnpm-workspace.yaml.Test plan
pnpm typecheck,pnpm lint,pnpm buildworkspace:andcatalog:deps without--pack; confirm the resultingpackage.jsonhas resolved versions--packand confirm no resolution log lines appearpnpm-workspace.yaml, unknown catalog name, unrecognized protocol🤖 Generated with Claude Code