-
Notifications
You must be signed in to change notification settings - Fork 762
Description
Affected Packages
@changesets/cli
Problem
First off, thanks for the great tool!
Yarn 2 introduces a feature called workspace ranges.
With workspace ranges, you can specify the intent of "depend on the current version of local workspace package, whatever the actual published version it may be". If you think about the workflow you're simutaneously modifying multiple packages, this can be extremely useful.
The transformation of workspace:... version to actual versions that npm can understand is handled by yarn at publish time.
When a workspace is packed into an archive (whether it's through
yarn packor one of the publish commands likeyarn npm publish), we dynamically replace any workspace: dependency by:
- The corresponding version in the target workspace (if you use * or a project-relative path)
- The associated semver range (for any other range type)
However, as current changeset publish command only supports either npm or pnpm as publish client, this transformation cannot take place, and changeset publish aborts with:
🦋 error TypeError: Invalid comparator: packages/my-package
🦋 error at Comparator.parse (/home/runner/work/npm-packages/npm-packages/.yarn/cache/semver-npm-5.7.1-40bcea106b-06ff0ed753.zip/node_modules/semver/semver.js:754:11)
🦋 error at new Comparator (/home/runner/work/npm-packages/npm-packages/.yarn/cache/semver-npm-5.7.1-40bcea106b-06ff0ed753.zip/node_modules/semver/semver.js:737:8)
🦋 error at Range.<anonymous> (/home/runner/work/npm-packages/npm-packages/.yarn/cache/semver-npm-5.7.1-40bcea106b-06ff0ed753.zip/node_modules/semver/semver.js:925:12)
🦋 error at Array.map (<anonymous>)
🦋 error at Range.parseRange (/home/runner/work/npm-packages/npm-packages/.yarn/cache/semver-npm-5.7.1-40bcea106b-06ff0ed753.zip/node_modules/semver/semver.js:924:13)
🦋 error at Range.<anonymous> (/home/runner/work/npm-packages/npm-packages/.yarn/cache/semver-npm-5.7.1-40bcea106b-06ff0ed753.zip/node_modules/semver/semver.js:867:17)
🦋 error at Array.map (<anonymous>)
🦋 error at new Range (/home/runner/work/npm-packages/npm-packages/.yarn/cache/semver-npm-5.7.1-40bcea106b-06ff0ed753.zip/node_modules/semver/semver.js:866:40)
🦋 error at versionPackage (/home/runner/work/npm-packages/npm-packages/.yarn/cache/@changesets-apply-release-plan-npm-5.0.0-19ff54c5d1-d43561e831.zip/node_modules/@changesets/apply-release-plan/dist/apply-release-plan.cjs.dev.js:160:9)
🦋 error at /home/runner/work/npm-packages/npm-packages/.yarn/cache/@changesets-apply-release-plan-npm-5.0.0-19ff54c5d1-d43561e831.zip/node_modules/@changesets/apply-release-plan/dist/apply-release-plan.cjs.dev.js:312:12
Proposed solution
If either
@changesets/cliallows its users to configure which publish command to use (Related issue: [feat] ability to replacenpm publish#580) or,- it supports Yarn 2 out of the box
It would be awesome!