feat(schemes): adds support for SemVer 2.0 (dot in pre-releases) (fix #1025) #1072
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a
semver2
version scheme which is applying strictprerelease
formatting as described in SemVer 2 Item 9 and Semver 2.0.0 Item 11, meaning:As a consequence, the
1.2.3-alpha0
form is not respecting those rules (1.2.3-alpha10
has not proper precedence over1.2.3-alpha2
), nor1.2.3-alpha.0-dev.0
as its prerelease identifiers will bealpha
,0-dev
,0
while it should bealpha
,0
,dev
and0
.Note that Semver 2 is underspecified on this point (there is no formal description of what are the expected prerelease identifiers, only example) and so this PR chose to stay close to the examples (use of
alpha
andbeta
instead ofa
andb
), but this is choice, not a specification requirement.Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
SemVer 2.0 versions are properly parsed and bumped, the resulting version is SemVer 2,0 compliant too.
Steps to Test This Pull Request
version_scheme = "semver2"
in you commitizen configx.y.z-dev.D
x.y.z-alpha.A
x.y.z-alpha.A.dev.D
Additional context
Fixes #1025
Note
I think it's time for removing the
version-type
deprecated byvesion-scheme
(in another PR)