Skip to content

Instantly share code, notes, and snippets.

@gustavoalbuquerquebr
Last active June 11, 2020 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gustavoalbuquerquebr/6aff5c29574afc1a1f703214c5199107 to your computer and use it in GitHub Desktop.
Save gustavoalbuquerquebr/6aff5c29574afc1a1f703214c5199107 to your computer and use it in GitHub Desktop.
#semantic #version #semver #npm

Format

1.0.0 = MAJOR.MINOR.PATCH

  • 3º digit = backward compatible bug fixes
  • 2º digit = backward compatible new features
  • 1ª digit = changes that break backward compatibility

optional pre-release metadata

  • optionally, in pre-release versions, you can append to the MAJOR.MINOR.PATCH a hyphen and a series of dot separated identifiers, e.g. 1.0.0-alpha.1
  • a pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements
  • identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]
  • common pre-release parts:
    • alpha.1, alpha.2 = feature incomplete
    • beta.1, beta.2 = feature complete
    • rc.1, rc.2 = release candidate, will be release unless there is a last minute bug found

Conventions

  • mustn't contain leading zeroes
  • The first version (still in the initial development/pre-release phase) is 0.1.0 not 0.0.1, as no bug fix have taken place
  • after finish the initial development/pre-release phase, use 1.0.0 to the first published version

In NPM

tilde, carret

  • tilde = will update you to all future patch versions
  • carret = will update you to all future minor/patch versions

examples

  • patch releases
    • 1.0 or 1.0.x = any patch version of 1.0
    • ~1.0.4 = any patch version of 1.0 equal or greter than 4
  • minor releases
    • 1 or 1.x = any minor version of 1
    • ^1.2.3 = any minor version of 1 equal or greater than 2
  • major releases
    • * or x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment