Monday, 16 March 2015

nodejs or bower package versions

https://docs.npmjs.com/misc/semver  or you can also get some clue by "http://stackoverflow.com/questions/22343224/difference-between-tilde-and-caret-in-package-json", which is not very right, but you can get the idea about "˜" and "ˆ".




#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
 
Allows changes that do not modify the left-most non-zero digit in the
`[major, minor, patch]` tuple.  In other words, this allows patch and
minor updates for versions `1.0.0` and above, patch updates for
versions `0.>=0.1.0`, and *no* updates for versions `0.0.X`.
 
`^1.2.3` := `>=1.2.3 <2.0.0`
`^0.2.3` := `>=0.2.3 <0.3.0`
`^0.0.3` := `>=0.0.3 <0.0.4`
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
 
Allows patch-level changes if a minor version is specified on the
comparator.  Allows minor-level changes if not.
 
`~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
`~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
`~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
`~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
`~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
`~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
`~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
  the `1.2.3` version will be allowed, if they are greater than or
  equal to `beta.2`.  So, `1.2.3-beta.4` would be allowed, but
  `1.2.4-beta.2` would not, because it is a prerelease of a
  different `[major, minor, patch]` tuple.


In short: 

"^" can give you bigger/higher range of versions than "~"


No comments:

Post a comment