Skip to content

[rush] Add support for premajor and prepatch bump types#4994

Open
witcher112 wants to merge 3 commits intomicrosoft:mainfrom
witcher112:support-premajor-prepatch-version-bump-type
Open

[rush] Add support for premajor and prepatch bump types#4994
witcher112 wants to merge 3 commits intomicrosoft:mainfrom
witcher112:support-premajor-prepatch-version-bump-type

Conversation

@witcher112
Copy link
Copy Markdown
Contributor

@witcher112 witcher112 commented Nov 7, 2024

Summary

Simple change to allow premajor and prepatch bump types.

These are directly supported by the semver library.

Details

How it was tested

I've added unit tests for "premajor" and "prepatch" as well as additional ones that make sure using bump type "patch" gets rid of any prerelease identifier.

PS. There was a bug in VersionPolicy.test.ts which caused tests to use the same instances of versionPolicyN objects. I've moved creation of VersionPolicyConfiguration into beforeEach hook to make sure that each test gets a clean environment.

Impacted documentation

https://rushjs.io/pages/commands/rush_version/

https://rushjs.io/pages/configs/version-policies_json/

*
* TODO: Consider supporting `premajor` and `prepatch` in the future.
*/
export enum BumpType {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the numeric values of these need to be updated to reflect the order of increasing severity? These may be used to ensure that the most severe bump type wins if multiple are specified in a package's changefiles.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, we need to confirm that doing that as a breaking API change won't cause issues.

Maybe we make premajor be 4.5 and prepatch be 1.5? When preminor was added, was that also a breaking reordering of values? It that's the case, then reshuffling these and using integers is probably fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iclanton IMHO it makes sense for them to be ordered in more natural way, but as you mentioned it could be a breaking API change.

I'll wait for other maintainers to comment on this before making changes here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@octogonz - thoughts?

…on-bump-type_2024-11-07-06-42.json

Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants