GeezerVison is showing github.com — [BUG] Increase pre* with pre-release identifiers without build · Issue #441 · npm/node-semver
[BUG] Increase pre* with pre-release identifiers without build #441Labels Bugthing that needs fixing DescriptionWhat / Why
the semver package should be able to execute a increment premajor, preminor and prepatch for versioning schemes without a build number.
It for sure affects the standard maven versioning system (which is semver compliant).
Examples
Actual
0.0.1-SNAPSHOT premajor -> 1.0.0-SNAPSHOT.0
0.0.1-SNAPSHOT preminor -> 0.1.0-SNAPSHOT.0
0.0.1-SNAPSHOT prepatch -> 0.0.2-SNAPSHOT.0
Expected
0.0.1-SNAPSHOT premajor -> 1.0.0-SNAPSHOT
0.0.1-SNAPSHOT preminor -> 0.1.0-SNAPSHOT
0.0.1-SNAPSHOT prepatch -> 0.0.2-SNAPSHOT
Currently this package always sets a dot-separated build. I t would be desirable if the behavior could be chosen, or if it would at least respect the current versioning scheme. Reacted by Michael Kriese, Anne Stellingwerf, Alex Weininger and Luka Svalina Activityljharb commented on Mar 24, 2022 Wouldn’t that mean you can only ever have one snapshot per version? That seems a bit short-sighted. pellmont commented on Mar 24, 2022 This is correct, for MAVEN repositories the SNAPSHOT versions are allowed to be updated. (internal it uses a timestamp for the different versions) ljharb commented on Mar 24, 2022 sounds like a build number. Why isn’t it part of the version number? astellingwerf commented on Mar 24, 2022 The whole idea of the snapshot version is that you don't need to update references to it with every new build. See also What is a SNAPSHOT version?. ljharb commented on Mar 24, 2022 Wouldn’t a semver range like 1.2.3-SNAPSHOT.0 do that? ljharb commented on Mar 24, 2022 Versions in semver are designed to be immutable - in other words, it’s not semver if it’s changing over time. astellingwerf commented on Mar 25, 2022 1.2.3-SNAPSHOT is a perfectly valid semver. See this overview of the spec, where I marked the choices for the different options using >>> in front.
<valid semver> ::= <version core>
>>> | <version core> "-" <pre-release>
| <version core> "+" <build>
| <version core> "-" <pre-release> "+" <build>
<version core> ::= <major> "." <minor> "." <patch>
<major> ::= <numeric identifier>
<minor> ::= <numeric identifier>
<patch> ::= <numeric identifier>
>>> <pre-release> ::= <dot-separated pre-release identifiers>
>>> <dot-separated pre-release identifiers> ::= <pre-release identifier>
| <pre-release identifier> "." <dot-separated pre-release identifiers>
<build> ::= <dot-separated build identifiers>
<dot-separated build identifiers> ::= <build identifier>
| <build identifier> "." <dot-separated build identifiers>
>>> <pre-release identifier> ::= <alphanumeric identifier>
| <numeric identifier>
<build identifier> ::= <alphanumeric identifier>
| <digits>
<alphanumeric identifier> ::= <non-digit>
>>> | <non-digit> <identifier characters>
| <identifier characters> <non-digit>
| <identifier characters> <non-digit> <identifier characters>
<numeric identifier> ::= "0"
| <positive digit>
| <positive digit> <digits>
<identifier characters> ::= <identifier character>
>>> | <identifier character> <identifier characters>
<identifier character> ::= <digit>
>>> | <non-digit>
>>> <non-digit> ::= <letter>
| "-"
<digits> ::= <digit>
| <digit> <digits>
<digit> ::= "0"
| <positive digit>
<positive digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
>>> <letter> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J"
>>> | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T"
| "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d"
| "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n"
| "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x"
| "y" | "z"
ljharb commented on Mar 25, 2022 Absolutely that string is valid semver. But its contents must never change - versions are immutable. astellingwerf commented on Mar 25, 2022 Fair enough, but whether I adhere to that rule should not be a problem when reasoning about the semver version. If we have semver version number 1.2.3-anything, and we order node-semver to increment the minor component, there's no reason to fiddle with the pre-release identifier. It should return 1.3.3-anything. ljharb commented on Mar 25, 2022 Fair enough.
the standard maven versioning system (which is semver compliant).
still worth establishing that it is not compliant, because snapshot contents change - and that by appending a .0, and relying on that instead, it would be, and this bug wouldn't apply. astellingwerf commented on Oct 20, 2022 The semver 2.0.0 spec mentions "increment" 16 times, but only for the major, minor, and patch versions. In it, I didn't see instructions on adding significant figures to any of the elements.
MetadataMetadataBugthing that needs fixing DevelopmentNo branches or pull requestsIssue actions
|