Summary
The rush publish flag --suffix <suffix> does not work in a way that is useful. It will only add a suffix to the version number in the package.json file when a change file exists, but it does not publish that new version to the npm registry. Subsequent calls to rush version or rush publish will then remove the suffix. It therefor cannot be used as part of a concise publishing strategy.
Repro steps
- Starting with a change file ready to be processed.
- Call
node common/scripts/install-run-rush.js publish --publish --apply --suffix mySuffix --tag myTag --target-branch main
Expected result:
- "version" in package.json should be updated with new semver based on change file.
- CHANGELOG.md and CHANGELOG.json should be updated with info from change file.
- Change file should be deleted.
- All changes should be added to a git commit and pushed to the target-branch.
- "version" in package.json should be appended with specified suffix.
- Package with suffix should be published to npm registry.
- Package with suffix should not be committed and pushed to the target-branch.
Actual result:
- ❌ "version" in package.json is not updated with new semver based on change file.
- ❌ CHANGELOG.md and CHANGELOG.json are not updated.
- ❌ Change file is not deleted.
- ❌ Expected changes are not added to a git commit and pushed to the target-branch.
- 👍 "version" in package.json is appended with specified suffix.
- ❌ Package with suffix is not published to npm registry.
- ❌ Package with suffix is improperly committed and pushed to the target-branch.
Details
If there is a use-case for adding a suffix to "version" in package.json and nothing else, I can't figure out what it is.
rush version --bump or rush publish do not play well with an existing suffix in the "version" field of the package.json. They appear to consider removing the suffix to be a patch update, so the semver doesn't change. Therefor it seems to me that the suffixed version of the published package version should simply not be committed.
If the use-case is not to update the semver and delete the change file, the flags --partial-prerelease --prerelease-name <suffix> seem to work acceptably well for that. However this is not a viable workaround for the use-case of publishing a new version with a suffix, because a rush version --bump deletes the change file, which causes the publish --partial-prerelease to fail.
Minimal repo for testing: https://github.com/GeoffreyEmerson/rush_test
Standard questions
| Question |
Answer |
@microsoft/rush globally installed version? |
None, I use the common/scripts |
rushVersion from rush.json? |
5.88.0 |
useWorkspaces from rush.json? |
No |
| Operating system? |
MacOS 12.6 |
| Would you consider contributing a PR? |
Not sure what the fix is |
Node.js version (node -v)? |
16.16.0 |
Summary
The
rush publishflag--suffix <suffix>does not work in a way that is useful. It will only add a suffix to the version number in the package.json file when a change file exists, but it does not publish that new version to the npm registry. Subsequent calls torush versionorrush publishwill then remove the suffix. It therefor cannot be used as part of a concise publishing strategy.Repro steps
node common/scripts/install-run-rush.js publish --publish --apply --suffix mySuffix --tag myTag --target-branch mainExpected result:
Actual result:
Details
If there is a use-case for adding a suffix to "version" in package.json and nothing else, I can't figure out what it is.
rush version --bumporrush publishdo not play well with an existing suffix in the "version" field of the package.json. They appear to consider removing the suffix to be a patch update, so the semver doesn't change. Therefor it seems to me that the suffixed version of the published package version should simply not be committed.If the use-case is not to update the semver and delete the change file, the flags
--partial-prerelease --prerelease-name <suffix>seem to work acceptably well for that. However this is not a viable workaround for the use-case of publishing a new version with a suffix, because arush version --bumpdeletes the change file, which causes thepublish --partial-prereleaseto fail.Minimal repo for testing: https://github.com/GeoffreyEmerson/rush_test
Standard questions
@microsoft/rushglobally installed version?rushVersionfrom rush.json?useWorkspacesfrom rush.json?node -v)?