Thanks for the great explanation Steve. One quick question: At 9:17 you installed 'npm i P jquery@~3.3.0' which means it will install 3.3 and any PATCH number higher than 0. But in the package.json file this shows as 'jquery: ^3.3.1' which means NOW when we run yarn or npm i in this project it will install any jquery which has a MINOR or PATCH value more than 3.1 . In the package.json file shouldnt it instead show as 'jquery: ~3.3.1' (i.e with a tilda in front so it only updates patch number - because that is how we ran the install initially?) Cheers
Great question. The ~ will be used to determine which version to install. So, if I was installing a package that had 2.2.1, 2.2.2, 2.2.3, and 2.2.4 and I said npm i pkg@~2.2.2 then npm will look at all the 2.2.x versions and give me the highest patch version. When it gets saved in the package.json file, npm semver considers all changes except major version changes to be additive but non-breaking. That means, it will, by default use ^ as the start of the entry. If you run "npm i" the next update will update both the minor and patch versions. If you want to cap it at 2.2.x without allowing the minor version updates then you will need to edit the package.json file on your own to change "~" to "^".
Sitting in office, working on some versioning stuff, and then I stumbled across your video, seems like this is a golden asmr video
Thank you for this golden information!
Great explanation!
Great explanation. Thanks!
Thanks for the great explanation Steve. One quick question: At 9:17 you installed 'npm i P jquery@~3.3.0' which means it will install 3.3 and any PATCH number higher than 0. But in the package.json file this shows as 'jquery: ^3.3.1' which means NOW when we run yarn or npm i in this project it will install any jquery which has a MINOR or PATCH value more than 3.1 . In the package.json file shouldnt it instead show as 'jquery: ~3.3.1' (i.e with a tilda in front so it only updates patch number - because that is how we ran the install initially?) Cheers
Great question. The ~ will be used to determine which version to install. So, if I was installing a package that had 2.2.1, 2.2.2, 2.2.3, and 2.2.4 and I said npm i pkg@~2.2.2 then npm will look at all the 2.2.x versions and give me the highest patch version.
When it gets saved in the package.json file, npm semver considers all changes except major version changes to be additive but non-breaking. That means, it will, by default use ^ as the start of the entry.
If you run "npm i" the next update will update both the minor and patch versions.
If you want to cap it at 2.2.x without allowing the minor version updates then you will need to edit the package.json file on your own to change "~" to "^".
@@SteveGriffith-Prof3ssorSt3v3 Thanks Steve that really clears things up :) much appreciated!
thanks sir , this was very helpful
Oh, wow, I like that Semver Calc. Could've used that the other day in a MEAN Project. Thanks Steve!
Thanks for sharing....
great video
this is gold!
Great explanation - Thank You