SemVer Range is a versatile versioning notation that provides flexible ways to specify version requirements in your software projects. This article explains the different operators and wildcards you can use to control version selection with precision.
The OR operator (||) allows you to specify multiple exact versions in a single SemVer Range expression.
semverRange('3.0.0 || 3.0.1')This indicates that either version 3.0.0 or 3.0.1 is acceptable. When using the OR operator with methods like lowestVersion(), it will return the lowest version in the range (in this example, 3.0.0).
Wildcards provide a convenient way to specify ranges covering an entire minor version.
semverRange('3.0.*')This includes all patch versions within the 3.0 minor version, such as 3.0.0, 3.0.1, 3.0.2, etc. When using .lowestVersion() on a wildcard range, it will return the lowest version in that range (in this example, 3.0.0).
When no operator is specified in a SemVer Range, it represents an exact version match.
semverRange('3.0.1')This means exactly version 3.0.1, not a range of versions.