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

Fix prerelease string getting removed and add $COMPLETE version variable #918

Merged

Conversation

tjenkinson
Copy link
Contributor

@tjenkinson tjenkinson commented Aug 10, 2021

Currently if the version is a prerelease the prerelease string is discarded because semver.coerce discards it.

With this PR we now use semver.parse instead and fall back to coerce.

It also updates splitSemVer to always return a string instead of sometimes a SemVer instance (which currently becomes a string in template due to it having a toString) and sometimes string.

Finally it adds a $COMPELTE variable that can be used to access the full version string, otherwise it's still not possible to get the prerelease info in the template.


expect(versionInfo.$NEXT_MAJOR_VERSION.version).toEqual('11.0.0')
expect(versionInfo.$NEXT_MINOR_VERSION.version).toEqual('10.1.0')
expect(versionInfo.$NEXT_PATCH_VERSION.version).toEqual('10.0.4')
expect(versionInfo.$NEXT_PATCH_VERSION.version).toEqual('10.0.3')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was previously wrong. The next patch version after v10.0.3-alpha is actually 10.0.3 not 10.0.4, but it was becoming 10.0.4 before because 10.0.3-alpha was incorrectly becoming 10.0.3 internally

@tjenkinson tjenkinson changed the title Fix prerelease string getting removed Fix prerelease string getting removed and add $COMPLETE version variable Aug 10, 2021
@tjenkinson tjenkinson marked this pull request as draft August 10, 2021 16:20
@tjenkinson tjenkinson marked this pull request as ready for review August 10, 2021 17:29
@jetersen
Copy link
Member

jetersen commented Sep 6, 2021

@tjenkinson A PR merged resulted in some conflict 😅 Could you please take a look?

@tjenkinson
Copy link
Contributor Author

@jetersen done!

lib/versions.js Outdated Show resolved Hide resolved
@jetersen jetersen merged commit 2429215 into release-drafter:master Sep 6, 2021
@jetersen jetersen added the type: bug Something isn't working label Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants