Node.js Modules & npm Dependency

๐Ÿ’ก Node.js Modules & npm Dependency โ€” Executive Summary

Technical architectural analysis, practical configuration manifests, and deployment instructions for Node.js Modules & npm Dependency.

Package.json version notation

Version configuration

Versions are broadly classified into three types.

Major.Minor.Patch

  • Major: This is an update that is not guaranteed to be compatible with previous versions. The major version is usually changed when a large-scale update occurs.
  • Minor: The minor version changes when an update occurs that adds or modifies some new features while being compatible with the previous version.
  • Patch: The patch version changes when updates related to bug fixes and performance improvements occur.
There are multiple ways to indicate the version?

If you look at package.json, you can see that there is a \~ or \^ character in front of the version as follows.

Letโ€™s learn about the difference between the two.

Tilde (tilde, \~)

The \~ mark in front of the version is called tilde and is used to indicate the latest patch version. For example, if \~2.4.1 is specified in package.json and the latest version 2.4.3 is released in the package repository, the version installed when npm install is performed will be 2.4.3. At this time, even if a version higher than the major and minor versions has been released in the package repository, tilde maintains the major and minor versions in front and retrieves the latest version only for the patch version.

Caret (caret, \^)

The \^ mark in front of a version is called a caret and is used to indicate the latest minor version as well as the latest patch version. For example, if \^2.4.1 is specified in package.json and the latest version 2.7.7 is released in the package repository, the version installed when npm install is performed will be 2.7.7. At this time, even if a version higher than the major version has been released in the package repository, caret maintains the major version in front and retrieves the latest version only for the minor version and patch version.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *