chore(tooling): add changesets cli patch to allow yarn npm publish #5821
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.
Description
Adds a patch for
@changesets/cliv2.29.7 that enables proper yarn support when publishing packages. The patch modifies two key functions:getPublishTool- Now detects and returns yarn as the publish tool when yarn is the package managerinternalPublish- Usesyarn npm publishcommand instead ofnpm publishwhen yarn is detectedThis ensures that
workspace:*protocol references in package.json dependencies are properly replaced with actual version numbers during publishing.Motivation and context
Without this patch,
changeset publishfails to properly replaceworkspace:*references when publishing packages in a yarn workspace. This is because changesets defaults to usingnpm publisheven in yarn workspaces, and npm doesn't understand yarn's workspace protocol.The
yarn npm publishcommand properly resolvesworkspace:*to the actual published version numbers before publishing to the registry.Related issue(s)
This patch is a temporary solution until the upstream fix is merged and released.