5

For @semantic-release, [major].[minor].[patch], what is the maximum number that it can goes to for major, minor, patch? i.e. 999.999.999?

bittersour
  • 937
  • 2
  • 11
  • 32
  • 7
    The [semver spec](https://semver.org/) doesn't explicitly state the maximum semver, however JavaScript's [MAX_SAFE_INTEGER](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) constant has a value of `9007199254740991`. So, using the `npm` tools the maximum _major_, _minor_, _patch_ in a semver is; `9007199254740991.9007199254740991.9007199254740991`. If you exceed that value, tools such as [node-semver](https://github.com/npm/node-semver) will begin to error. Also it would be absurd if you ever did exceed that value :) – RobC Dec 15 '20 at 08:26
  • @RobC Thanks! Yes agree. It will be totally absurd is I exceed that value. In the semver spec link https://semver.org/#does-semver-have-a-size-limit-on-the-version-string, also did not state there is any maximum semver. – bittersour Dec 16 '20 at 06:37
  • 1
    For code that confirms the answer given by @RobC see the [constructor](https://github.com/npm/node-semver/blob/main/classes/semver.js#L8) that parses a version string. Each number in the string [can't exceed MAX_SAFE_INTEGER](https://github.com/npm/node-semver/blob/main/classes/semver.js#L48) and the whole version string [can't exceed the 256-character limit](https://github.com/npm/node-semver/blob/main/classes/semver.js#L22) defined [here](https://github.com/npm/node-semver/blob/main/internal/constants.js#L5). – Eric Mutta Jan 05 '23 at 01:08

0 Answers0