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 #409

Merged
merged 1 commit into from Nov 22, 2022

Conversation

ghiscoding
Copy link
Member

@ghiscoding ghiscoding commented Nov 8, 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-bump-prerelease.

Description

As per Lerna PR 3362

Adds new flag --conventional-bump-prerelease 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

As per Lerna PR 3362

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-bump-prerelease:

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 in Lerna issue 2536.

How Has This Been Tested?

Types of changes

  • Chore (change that has absolutely no effect on users)
  • 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)

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 added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Nov 8, 2022

Codecov Report

Merging #409 (b07f88d) into main (02c998e) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #409   +/-   ##
=======================================
  Coverage   97.31%   97.31%           
=======================================
  Files         146      146           
  Lines        4335     4335           
  Branches     1004     1005    +1     
=======================================
  Hits         4218     4218           
  Misses        117      117           
Impacted Files Coverage Δ
...kages/cli/src/cli-commands/cli-version-commands.ts 100.00% <ø> (ø)
...core/src/conventional-commits/recommend-version.ts 100.00% <100.00%> (ø)
packages/version/src/version-command.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ghiscoding ghiscoding merged commit dad936e into main Nov 22, 2022
@ghiscoding ghiscoding deleted the feat/prerelease-bump branch November 22, 2022 15:33
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

1 participant