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

feat(version): bump prerelease versions from conventional commits (#2… #3362

Merged
merged 3 commits into from Nov 8, 2022

Conversation

amorscher
Copy link
Contributor

@amorscher amorscher commented Oct 10, 2022

Adds possibility to force a version bump, even if already existing version is a prerelease version. This is achieved by introducing a new flag for lerna version command named --conventional-bumpprerelease.

Description

Adds new flag --conventional-bumpprerelease to force a version bump, if required according to conventional commits. When run with this flag, lerna version will release with bumped prerelease versions, even if already released packages are prereleases. Releases all unreleased changes as pre(patch/minor/major/release) by prefixing the version recommendation from conventional-commits with pre, eg. if present changes include a feature commit, the recommended bump will be minor, so this flag will result in a preminor release. If not used just a prerelease bump will be applied to prereleased packages.

Motivation and Context

Currently, if the existing version is a prerelease no version bump is performed, although there exists conventional commits which would require that. Following version bumps are performed using --conventional-bumpprerelease:

Changes:
 - major: 1.0.0-alpha.0 => 2.0.0-alpha.0 
 - minor: 1.0.0-alpha.0 => 1.1.0-alpha.0 
 - patch: 1.0.0-alpha.0 => 1.0.1-alpha.0

Behaviour without using the flag is:

Changes:
 - major: 1.0.0-alpha.0 => 1.0.0-alpha.1 
 - minor: 1.0.0-alpha.0 => 1.0.0-alpha.1 
 - patch: 1.0.0-alpha.0 => 1.0.0-alpha.1

The issue/question is described here (#2536).

How Has This Been Tested?

Added several unit tests and tested manually with locally published lerna version.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (change that has absolutely no effect on users)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@amorscher
Copy link
Contributor Author

What can I do that someone takes a look at this pull request.

Is there any additional information needed? Some feedback would be nice.

What is more it would be cool if I get some authorization to run the required workflows. How can I achieve this?

Thx a lot!

@JamesHenry
Copy link
Member

@amorscher Thanks a lot for your patience on this! I am currently recovering from COVID while traveling internationally, so am taking a break at the moment. I will discuss this potential feature with the team towards the end of next week. The workflows do not run by default for folks who have never contributed before. I have enabled them now but it looks like in this case it failed the first check. I recommend getting the checks we specify in ci.yml to pass for you locally prior to pushing to help reduce the iteration time in CI. Many thanks again for your contribution!

@amorscher
Copy link
Contributor Author

@JamesHenry THX for the response and for bringing it to the team. I updated the pull request. Now the workflows should pass. I ran them locally, despite some minor snapshot differences due to committer id and CPU infos all of them passed.

Wish you a good recorvery! I really know that takes some time.

@amorscher
Copy link
Contributor Author

@JamesHenry Looks like I need another approval for running the workflows. Is this all the time needed for the first contribution?

Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

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

Thanks a lot @amorscher, I'm doing much better now and we agreed at the end of this week to press ahead with this feature!

Please see my various items of feedback inline.

Please could you also add an e2e test to cover the use of this flag?

commands/version/README.md Outdated Show resolved Hide resolved
commands/version/command.js Outdated Show resolved Hide resolved
commands/version/index.js Outdated Show resolved Hide resolved
core/conventional-commits/lib/recommend-version.js Outdated Show resolved Hide resolved
core/conventional-commits/lib/recommend-version.js Outdated Show resolved Hide resolved
core/conventional-commits/lib/recommend-version.js Outdated Show resolved Hide resolved
@ghiscoding
Copy link

another thing missing in this PR is the lerna-schema.json that needs to be updated with the new option

@amorscher
Copy link
Contributor Author

amorscher commented Nov 7, 2022

Thanks a lot @amorscher, I'm doing much better now and we agreed at the end of this week to press ahead with this feature!

Please see my various items of feedback inline.

Please could you also add an e2e test to cover the use of this flag?

Thanks a lot for the review. I am really happy that the feature is pressed ahead.

I integrated requested changes and I will add an e2e test during the week. Also updated lerna-schema.json. @ghiscoding THX for the hint.

@JamesHenry JamesHenry merged commit 2288b3a into lerna:main Nov 8, 2022
@JamesHenry
Copy link
Member

Thank you @amorscher!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants