shipshapecode / ember-cli-release

Ember CLI addon for versioned release management
MIT License
90 stars 18 forks source link

Support for prelease versions like 1.0.0-beta.1 #20

Closed mmun closed 8 years ago

mmun commented 9 years ago

See https://github.com/npm/node-semver#prerelease-identifiers

slindberg commented 9 years ago

I'd like to support this for sure. A good use case is:

0.1.01.0.0-beta.01.0.0-beta.11.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:

mmun commented 9 years ago

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

mmun commented 9 years ago

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.

slindberg commented 9 years ago

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:

mmun commented 9 years ago

@slindberg Oh yeah no sweat. I was just starting the conversation :)

cibernox commented 8 years ago

I found myself needing this today. Has any work begun on this?

mmun commented 8 years ago

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
slindberg commented 8 years ago

@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.