Skip to content

fix(bump): harden prerelease and releaseAs behaviour #101

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

Merged

Conversation

cgatt
Copy link

@cgatt cgatt commented Sep 20, 2023

This PR fixes a number of bugs identified with the bump behaviour:

  • When passing a version with build metadata via either --release-as or through the prebump task, said build metadata is stripped
    > npx commit-and-tag-version --skip.tag --skip.commit --release-as 1.2.3-prerelease.0+build.info.123
    ✔ bumping version in version.txt from 1.1.0 to 1.2.3-prerelease.0
    ✔ outputting changes to CHANGELOG.md
    The use case for this is using versions from another tool, e.g. absolute-version
  • When passing an invalid version to --release-as or any non-version string from the prebump task, the new version was being output as null
  • When setting both --release-as and prerelease, the version could be set incorrectly. e.g:
    Current version: 99.0.0-prerelease.0
    Run command: npx commit-and-tag-version --skip.tag --skip.commit --release-as 100.0.0-prerelease.0 --prerelease prerelease
    Resulting version: 99.0.0-prerelease.1
    
  • Added clearer errors for invalide/undefined cases, such as an invalid --release-as or conflicting prerelease identifiers between --release-as and --prerelease

BEGIN_COMMIT_OVERRIDE
fix: allow bump task to handle versions with build metadata
fix: handle invalid versions passed to releaseAs
END_COMMIT_OVERRIDE

fix: handle invalid versions passed to releaseAs

fix: only bump prerelease version if rest of version matches
Copy link
Member

@TimothyJones TimothyJones left a comment

Choose a reason for hiding this comment

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

Thanks so much for this! One small correction and some optional suggestions. Assuming the build passes, I'll get this in and released once you've made any adjustments you'd like to.

@cgatt
Copy link
Author

cgatt commented Sep 28, 2023

Let me know if there's any further changes you'd like, but I'm happy with this PR if you are :)

@TimothyJones TimothyJones merged commit 33913ee into absolute-version:master Oct 2, 2023
@TimothyJones
Copy link
Member

Thanks @cgatt ! Releasing in 11.2.4.

@cgatt cgatt deleted the fix/cgatt/bump-build-metadata branch October 3, 2023 00:13
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.

2 participants