Skip to content

[rush] publish --suffix does not work as expected #3882

@GeoffreyEmerson

Description

@GeoffreyEmerson

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

  1. Starting with a change file ready to be processed.
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions