What is the difference between ~ 0.0.1 and ^ 0.0.1 in the version control of package.json packages?

3

This code is an example:

{
    "dependencies": {
        "gulp": "~0.0.1",
        "browser-sync": "^0.0.1"
    }
}
    
asked by anonymous 10.02.2017 / 18:10

2 answers

4
  

In a simplified way TIL (~) only accepts the most recent minor version   (the middle number). ~ 1.2.3 will accept all 1.2.x versions but will   reject 1.3.0.

     

CIRCUNFLEXO (^) accepts the most recent Major Version (first issue)   . ^ 1.2.3 will accept any 1.x.x release including 1.3.0, but will reject the 2.0.0.

SOURCE and Stack in English

    
10.02.2017 / 18:18
5

In short, the use of tilde (~) offers bug fixes and the circumflex (^) offers new functionality backwards compatible.

See this image at Semantic Versioning Cheatsheet:

Seeademointhetable:

Reference

  • Byte Ancher - Semver explained
10.02.2017 / 18:27