fix: correct versions with prereleases #495
Merged
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.
prereleases
do not work in release-please, i'm seeing the inability to get a repo into or out ofprerelease
mode, (where the packages have tags in the versions ie.-pre-0
at the end).reggi/packages
.npm/cli
has been stuck in prerelease mode. It was able to get itself into prerelease because of the wrapper around release-please we have in this repo. (trail: npm/cli workflow, Strategy Turnery)I do not believe release please has this
options.prerelease ternary anymore
here's the mapping of what versioning-strategy is uses.And even if it did choose to use
PrereleaseVersioningStrategy
orDefaultVersioningStrategy
neither of these strategies have the ability to leave a prerelease. Because they always add the currentprereleaseType
orprereleaseType
from the config from the existing version. Neither of these classes even have access to theoptions.prerelease
boolean.I created a fork of release-please which would deprecate the need for this PR, https://github.com/reggi/release-please with the typescirpt / esm alternatives to the files included in this PR:
This is added as a new versioning-strategy
semver
. To note the property currently documented asversioning-strategy
in the docs is not working, and is currentlyversioning
. I opened a PR to fix the json schema for the config, but now we know it's a bug i'll leave that discussion open there.So
"versioning-strategy": "semver"
would be ignored and you'd need"versioning": "semver"
, again not relevant to this PR but another quirk to note.This PR replaces both strategies with a new
SemverVersioningStrategy
which is always used, and has prerelease-aware replacement forsemver.inc
semver.inc
, when incrementing topreminor
with2.1.0-pre.1
it bumps the minor2.2.0-pre.0
which is incorrect.inc
function included in this pr takes2.1.0-pre.1
and sees thatpatch
is0
and will assume a bump has already taken place because it's in prerelease, and will only increment the tag number (known in semver asidentifierBase
orn
) to2.1.0-pre.2
.We will most likely also have extended conversations about adding this new prerelease-aware functionality to
semver.inc
in some way so other projects such as release-please can properly implement prereleases.