package.json tilde code example

Example 1: package.json tilde vs caret

~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.

Example 2: npm version notation

1.2.3 => 1.2.3 (Matching exactly same version)
~1.2.3 => >=1.2.3 && < 1.3.0 (Matching minor version)
^1.2.3 => >=1.2.3 && < 2.0.0 (Matching major version)