Something that can be interesting: how versioning for npm packages works?

Npm versioning

value desc
~version Approximately equivalent to version, i.e., only accept new patch versions
See npm semver - Tilde Ranges
^version Compatible with version, i.e., accept new minor and patch versions
See npm semver - Caret Ranges
version Must match version exactly
>version Must be greater than version
>=version etc
1.2.x 1.2.0, 1.2.1, etc., but not 1.3.0
* Matches any version
latest Obtains latest release

What does the caret and tilde mean

See the NPM docs and semver docs:

  • ~version “Approximately equivalent to version”, will update you to all future patch versions, without incrementing the minor version. ~1.2.3 will use releases from 1.2.3 to <1.3.0.

  • ^version “Compatible with version”, will update you to all future minor/patch versions, without incrementing the major version. ^2.3.4 will use releases from 2.3.4 to <3.0.0.




Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!