composer / semver

Semantic versioning utilities with the addition of version constraints parsing and checking.
MIT License
3.15k stars 76 forks source link

VersionParser only allows one numeric pre-release identifier #24

Closed tobyzerner closed 9 years ago

tobyzerner commented 9 years ago

I released 0.1.0-beta.3 of my project yesterday. Unfortunately it contained a critical bug, so I fixed and proceeded to release 0.1.0-beta.3.1. From semver.org:

  1. A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version. [...] Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.

Packagist wasn't picking up the tag for some reason. I investigated and traced the problem back to here (while I don't have hard proof that this is indeed the problem, this is what I suspect that it is).

I found that composer/composer's VcsRepository will skip a tag if it doesn't validate.

Tag validation uses the VersionParser from composer/semver.

So I checked out VersionParser, and it seems that the regex that matches the pre-release modifier only allows one numeric pre-release identifier. i.e. it will match 0.1.0-beta.3, but not 0.1.0-beta.3.1.

Is there a good reason for this? Would it be possible to fix?

alcohol commented 9 years ago

Yeah, we could look into that. But you should fix your versioning. It makes little sense to release beta's of unstable versions (anything below 1.0.0 is basically not stable yet). Why didn't you just increase the patch version? That is what semver is all about.

tobyzerner commented 9 years ago

Fair point. From a marketing perspective, we wanted to make a distinction between whether or not the product ready for public use, and whether or not the APIs are stable. So the 0.1.0-beta series is meant to say "don't use this in production yet, it's buggy and broken" whereas 0.1.0 will say "you can use it, but be careful and we'll still break APIs". Not sure if it's technically correct use of semver...

Regardless, no rush for this fix – we'll move up to beta 4. Just thought I'd mention it :)

alcohol commented 9 years ago

I would be ok with fixing this behaviour, but it would mean a lot of issues for Packagist. So it's unlikely we will actually implement a change here.

tobyzerner commented 9 years ago

Fair enough, thanks for looking into it :)