Wednesday 16 February 2022

Meaning of symbols in package.json file

Symbols relating to package version:

Name Symbol                 Description
Equality = Exact version i.e. =3.2.1 and 3.2.1 will both expect exactly version 3.2.1
Less than/greater than etc.. <, > If >=3.2.1 would match 3.2.3, 3.4.7, and also 4.2.7 and same goes for greater than
Hyphen - Hyphen is (-) to use between two versions, that you specify. This is required when you need to maintain some legacy feature that you know will break at a specific version. Ex: 1.3.2 - 2.4.1. This will include both endpoints.
tilde ~ Mean approximate version. Ex. ~3 will accept any version that starts with 3. ~2.3.3 will allow values between 2.3.3 and 2.4, not including 2.4
carat ^ It means compatible version. It only refuses changes to the major version. For example, ^3.4.1 will allow any version between that value and 4.0.0, not including version 4.

Versioning Calculator Tool: npm semver calculator

No comments:

Post a Comment