Be a Master Of Package Versioning
Tue Feb 27 2018
For quite some time I was always confused on how the versions of different packages really worked.
In most cases simply copy and pasting from different guides around the web simply did the job. But what do you do when your application gets bigger and has a lot of dependencies?
You will need to start to maneuver those dependencies and really understand who depends on what version etc.
So I’ll simple easily describe the basic version types:
"1.5.2"
exact version of 1.5.2!
">=1.5.2"
any version above or equal to 1.5.2
"<1.5.2"
any version below 1.5.2
Wildcards
"1.5.*"
any versions in the range of 1.5.0 <= VERSION < 1.6.0
"1.*"
any versions in the range of 1 <= VERSION < 2.0
Tilde range
~ (tilde sign) allows the last digit to go up
"~1.5.2"
any versions in the range of 1.5.2 <= VERSION < 1.6.0
"~1.5"
any versions in the range of 1.5 <= VERSION < 2.0
^ hat sign, doesn’t allow breaking changes
"^1.5.2"
any versions in the range of 1.5.2 <= VERSION < 2.0
"~0.2.1"
** exception when major version is 0
any versions in the range of 0.2.1 <= VERSION < 0.3