[rush] Using --bump-type with rush change doesn't accept the passed argument in a repo with version policies
Summary
I'm using Rush inside of a monorepo with packages that use version policies and lockstepped versions.
The rush change docs indicate that it's possible to pass a --bump-type with a --bulk flag but this doesn't work.
Any argument to --bump-type will result in a type: "none" as part of the changefile, if the repo uses version policies.
Repro steps
- Have a monorepo that uses version policies and lockstepped versions
- Make any change to a file
- Run the
rush changecommand usingrush change --bulk --bump-type patch --message hello-test
Expected result:
The resulting changefile will have a type: "patch"
Actual result:
The resulting changefile has a type: "none".
The issue is reproducible in the case of multiple changefiles and occurs will all other bump types.
Details
There is some undocumented behaviour inside of libraries > rush-lib > src > cli > actions > ChangeAction.ts. See line 555:
// No need to ask for bump types if project is lockstep versioned with an explicit nextBump
if (lockStepPolicy.nextBump !== undefined) {
bumpOptions = {};
}
This suggests that if the lockstep policy has a nextBump then we can ignore the passed in argument to the rush change command. The nextBump field is required for all repos with version policies, which basically means that the --bump-type feature in rush change will never work in those cases.
For what it's worth, my workflow has been to manually change the type to the value that it's supposed to be. Then I manually adjust the nextBump based on the highest value type from the changefiles prior to each release.
My preference would be to remove the code above and allow users to pass a rush change bump-type with the CLI.
If that's not possible because the behaviour is necessary then I would suggest an update to the rush change docs around the condition(s) that --bump-type would not be expected to work.
Thanks for maintaining this repo and all that you do! Hope this helps and let me know if you have any questions.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/rush globally installed version? |
5.122.1 |
rushVersion from rush.json? |
5.129.7 |
useWorkspaces from rush.json? |
n/a |
| Operating system? | Mac |
| Would you consider contributing a PR? | Yes |
Node.js version (node -v)? |
18.16.0 |
If the package you're creating the changelog for is part of a lockstepped version policy, the bump type does indeed always get set to "none" by default.
For what it's worth, my workflow has been to manually change the type to the value that it's supposed to be. Then I manually adjust the nextBump based on the highest value type from the changefiles prior to each release.
Ideally bump types should be able to be specified that way for lockstepped packages. We've hit issues in trying to implement support for that in the past, but it'd be worth revisiting. @elliot-nelson has also been working on a design for a complete overhaul of versioning and publishing, which should incorporate this feature.
If that's not possible because the behaviour is necessary then I would suggest an update to the
rush changedocs around the condition(s) that--bump-typewould not be expected to work.
Agreed that there is a gap in docs here (https://rushjs.io/pages/maintainer/publishing/#two-types-of-version-policies) and possibly elsewhere.
Thanks for the update @iclanton ! Is there a PR or somewhere I can follow along with the overhaul that @elliot-nelson is working on? I appreciate your support 😄