semver4s
package semver4s
Semver4s provides semver versions and matchers and parsers for them.
SemVer is a version scheme to delineate when a libraries semantics change. You can read more about it at https://semver.org/
This library aims to provide at least all functionality the SemVer package in NPM provides, though as of now, it still falls short of that.
It does so through the types Matcher and Version. You can parse matcher or version strings with semver4s.parseMatcher and semver4s.parseVersion.
For supported ranges, see the NPM documentation over at https://www.npmjs.com/package/semver#ranges
For literals, importing Literal._ brings the interpolators m and v in scope,
which you can use to write, for example a literal version v"1.2.3"
or literal matcher
m"~1.3.2 || 2.0.x - 2.2.x"
, which are parsed and validated at compile time.
- Alphabetic
- By Inheritance
- semver4s
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- sealed trait Bound extends AnyRef
- sealed abstract case class CoreVersion extends Product with Serializable
-
sealed
trait
Matcher extends Product with Serializable
A matcher that can test whether a version matches the matcher.
A matcher that can test whether a version matches the matcher.
The NPM matchers are
- Primitive matchers >, <, >=, <= or = with a (potentially partial) version, e.g.
<1.3
or>=1.3.4-pre.1
. - Hyphen ranges, e.g. 1.3 - 2 - Tilde ranges: e.g. ~1.3.2 flexible patch. - Caret ranges: e.g. ^1.3.2 flexible minor and patch. - Wildcard ranges: e.g. 1.3 / 1.3.* / 1.3.x - Conjunction (AND) ranges: e.g. >1.3 <2.3.1 - Disjunction (OR) ranges: e.g. any version in three any version in 1.2: 1.2 3 || 1.2.* - sealed trait Partial extends AnyRef
- sealed trait PreReleaseBehaviour extends AnyRef
-
sealed abstract
case class
Version extends Product with Serializable
A semver version specification
A semver version specification
Consisting of a core version of major.minor.patch, potentially a pre-release suffix and potentially build metadata
Value Members
-
val
matcherParser: Parser[Matcher]
A parser for SemVer matchers, like "~1.3.2"
-
def
parseMatcher(matcherString: String): Either[Error, Matcher]
Parsers a string into a matcher, or an error with information where the parse failed.
Parsers a string into a matcher, or an error with information where the parse failed.
To match a literal string, use Literal.matcher or the m interpolator
-
def
parseVersion(versionString: String): Either[Error, Version]
Parsers a string into a version, or an error with information where the parse failed.
Parsers a string into a version, or an error with information where the parse failed.
To match a literal string, use Literal.version or the v interpolator
-
val
semverParser: Parser[Version]
A parser for SemVer versions, like "1.2.3" or "2.12.3-rc1"
- object Bound
- object CoreVersion extends Serializable
- object Literal
- object Matcher extends Serializable
- object Partial
- object PreReleaseBehaviour
- object SemVer
- object Version extends Serializable
- object VersionOrder