-
Notifications
You must be signed in to change notification settings - Fork 499
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
fix: allow .
to prefix prerelease in loose mode
#167
Conversation
1 similar comment
To me, |
@othiym23 Yeah, The use case is in the OP in #164. Loose parsing allows pr tags to not have the I guess maybe a workaround would be to allow it to start with a So, a second step would be to require the Then the pattern looks something like |
Modified the prerelease regexp so that it requires a - if it doesn't start with a non-numeric value. If it does start with a non-numeric value, then the - is optional, and a This means that Pretty sure that makes this a breaking change. |
c082957
to
03908e3
Compare
92e41c6
to
174477e
Compare
BREAKING CHANGE: prerelease tag requires a `-` if it doesn't start with a non-numeric value. If it does start with a non-numeric value the `-` is optional and a `.` can be used instead. This means that `1.2.34.5` is no longer a valid version in loose mode (previously it would split into `1.2.3-4.5` and `1.2.3.4` is invalid (previously it would split into `1.2.3-4`. Allowing 1.2.3.4 is confusing and weird. However, 1.2.3.beta should be allowed.
.
to prefix prerelease in loose mode
This has been rebased and the commit rewritten to conform to conventional commit syntax. Is this something we still want? |
I'm not sure it is - if this change lands and is published as a semver-major, wouldn't it be really easy to publish a package with a If so this is a lot of risk solely to allow |
npm does not use loose checking when validating semver for publishing. It calls > require('.').clean('1.2.3.beta')
null |
ah, fair enough. in that case, "i guess"? but it seems weird to make breaking changes to loose mode when npm doesn't even use it. |
I think enough time has passed without this being implemented that it's likely not something anyone needs or is asking for. It also goes against the actual SemVer spec, and drifting further from that spec should only be done if absolutely necessary. |
Agreed. (also, if it's a breaking change, "fix:" seems inaccurate) |
I agree and it's my one gripe w/ conventional commits, the breaking change prefix isn't its own thing it's a footer or addendum to an existing type. We settled on doing it this way. |
An ironic thing about semver is that there's rarely any question between minor and patch, or minor and major, but often the question as to whether something should be patch or major is very subtle. The impetus for this was parsing version strings that come from other non-semver systems. When it was requested, loose mode was used much more often, and much of the registry was still published under the old SemVer 1.0 specification. But enough time has passed without any serious call for this, that I think it's fine to just punt on it, personally. Especially given the cost of a semver major bump to this module. |
BREAKING CHANGE: prerelease tag requires a
-
if it doesn't start witha non-numeric value. If it does start with a non-numeric value the
-
is optional and a
.
can be used instead. This means that1.2.34.5
is no longer a valid version in loose mode (previously it would split
into
1.2.3-4.5
and1.2.3.4
is invalid (previously it would splitinto
1.2.3-4
.Allowing 1.2.3.4 is confusing and weird.
However, 1.2.3.beta should be allowed.
Fixes #164, adds test coverage, many new tests and slight refactoring for additional coverage.