Closed mmun closed 8 years ago
I'd like to support this for sure. A good use case is:
0.1.0
→ 1.0.0-beta.0
→ 1.0.0-beta.1
→ 1.0.0
The question is what series of ember release
commands results in these versions?
One possibility:
# New version, v0.1.0
$ ember release
# Adds 'beta' suffix starting at 0, assumes major version update, v1.0.0-beta.0
$ ember release --pre beta
# Increments pre-release version, v1.0.0-beta.1
$ ember release
# Removes prerelease suffix, v1.0.0
$ ember release --major
Questions:
--pre
flag imply --major
?--pre
be required to increment the prerelease?--minor
is used when version is a prerelease?0
as the spec implies, or 1
as Ember has done in the past?It seems best to stick to the behavior of semver
to minimize the documentation you need to maintain. With semver
there is premajor
, preminor
and prepatch
(here's some tests).
I'm not too sure about supporting Ember's numbering. You could allow chaining multiple increment commands, e.g. ember release --preminor beta --pre beta
. Kind of a mouthful but I wouldn't want to encourage doing it anyways :P
A dubious behaviour of semver
is that using --pre
when you're not already in a prerelease version will do a --prepatch
. See test. Arguably that should throw instead, or at least default to something more common like premajor
, as you suggested. I think it's fine to make ember-cli-release
stricter than semver
.
Hm, this is much stickier than I originally was thinking. I agree that ember release
should be stricter than semver for happy paths.
I'm going to be AFK for the next couple weeks, so this will unfortunately have to wait a while. If you want to open a PR, I'll see if I can find some time to review next week. Thanks for the input :beers:
@slindberg Oh yeah no sweat. I was just starting the conversation :)
I found myself needing this today. Has any work begun on this?
It could be a relatively simple PR if we just add command line arguments that map directly to the semver commands.
--premajor [name]
--preminor [name]
--prepatch [name]
--prerelease [name]
An example sequence starting at 1.2.3
:
> ember release --premajor alpha
2.0.0-alpha.0
> ember release --prerelease
2.0.0-alpha.1
> ember release --prerelease beta
2.0.0-beta.0
> ember release --prerelease
2.0.0-beta.1
> ember release --major
2.0.0
@cibernox I don't have the bandwidth to work on this, so PRs are definitely welcome.
I like @mmun's KISS suggestion, except that I'd like to keep it so that ember release
always increments in the least-impactful way by default. For example this is what would happen with the implicit --patch
argument:
> ember release --premajor alpha
2.0.0-alpha.0
> ember release
2.0.0
Incrementing the version to 2.0.0-alpha.1
, instead of 2.0.0
would be less dangerous for the user.
See https://github.com/npm/node-semver#prerelease-identifiers