-
Notifications
You must be signed in to change notification settings - Fork 236
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(cli): correct --prerelease use and add --as-prerelease #647
Conversation
I'm no expert, but something feel a little off about this logic to me. This example from the PR seems to violate SemVer:
Albeit the section that follows it warns about that. I haven't tested this, but I feel like PSR v7, when given The other thing I'm having a hard time wrapping my head around is the My understanding is that Now, the behaviour I would expect is something closer to this:
This should largely preserve existing behaviour, and avoid the above potential issues. How well this works with the new multi-branch versioning I can't really say, as I unfortunately have no experience with such a setup. |
Thanks for taking a look @css-optivoy. It's kind of gnarly logic, I admit. Let me try to respond thoroughly to each of your comments:
I don't think it violates SemVer, it's just that it's possible to shoot yourself in the foot if you're developing on a branch that's out-of-date compared to your main/latest release. SemVer doesn't mandate that your project versions are released monotonically, only that according to the precedence rules certain versions are "higher" than others. I can release v1.0.1, v2.0.0 and then v1.1.0 in that order, if need be - it's just everyone looking for "latest" by semver will get v2.0.0 instead of v1.1.0. Let me try to clarify the example (and then update the docs): If you release normal versions from
Now, from this prerelease, the commit history from the point of view of HEAD on
Having to deal with multiple branches makes this a pain to get right, however it's not possible to naively search the repository tags and pick the latest version from those to base the next version off of - if you pick up a branch from 3 years ago, you'll be prereleasing for the incremented version with a wildly stale codebase. It would prevent trying to support multiple versions. I was/am still considering whether the tag-search for prereleases leading up to the same normal version is the "correct" thing to do. It would be much easier to take the stance of "use build metadata for this instead of prerelease tags", which is honestly a more robust way to go about it, but that would in turn ask for a change in versioning scheme from (I imagine) a lot of users.
This is technically true, but it was influenced by the default for For example, if I want to run an ad-hoc prerelease from What could potentially be missing here is a I think the usage you suggested with Definitely open to renaming it if you have a clearer/more explicit name suggestion! |
834999f
to
3013102
Compare
5aa391d
to
6c86d51
Compare
6c86d51
to
c72d11c
Compare
Prior to this change, `--prerelease` performed the role of converting whichever forced version into a prerelease version declaration, which was an unintentional breaking change to the CLI compared to v7. `--prerelease` now forces the next version to increment the prerelease revision, which makes it consistent with `--patch`, `--minor` and `--major`. Temporarily disabled the ability to force a prerelease.
…sion to be a prerelease Prior to this change, `--prerelease` performed the role that `--as-prerelease` now does, which was an unintentional breaking change to the CLI compared to v7. `--prerelease` is used to force the next version to increment the prerelease revision, which makes it consistent with `--patch`, `--minor` and `--major`, while `--as-prerelease` forces for the next version to be converted to a prerelease version type before it is applied to the project regardless of the bump level.
c72d11c
to
f3f806c
Compare
Prior to this change, --prerelease performed the role that --as-prerelease now does, which was an unintentional breaking change to the CLI compared to v7.
--prerelease now forces the next version to increment the prerelease revision, which makes it consistent with --patch, --minor and --major, while --as-prerelease allows for the usual next version to be converted to a prerelease befoer it is applied to the project
Resolves: #639