Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

witcher112
Copy link
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/

@@ -25,8 +25,6 @@ import { cloneDeep } from '../utilities/objectUtilities';
* This is a copy of the semver ReleaseType enum, but with the `none` value added and
* the `premajor` and `prepatch` omitted.
* See {@link LockStepVersionPolicy._getReleaseType}.
*
* TODO: Consider supporting `premajor` and `prepatch` in the future.
*/
export enum BumpType {
Copy link
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
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
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
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 <[email protected]>
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