Documentation
¶
Index ¶
- func MaxSatisfying(versions []versions.Semver, c constraints.Constraint, includePreReleases bool) versions.Semver
- func MaxSatisfyingStrings(versions []string, c constraints.Constraint, includePreReleases bool) (versions.Semver, error)
- func ParseConstraint(constraintString string) (constraints.Constraint, error)
- func ParseConstraintWithEcosystem(constraintString string, ecosystem EcosystemType) (constraints.Constraint, error)
- func ParseSemver(versionLiteral string) (versions.Semver, error)
- func ParseSemverWithEcosystem(versionLiteral string, ecosystem EcosystemType) (versions.Semver, error)
- func Satisfies(v versions.Semver, c constraints.Constraint, includePreReleases bool) bool
- func Sort(sortOrder int, versions []versions.Semver) []versions.Semver
- func SortStrings(sortOrder int, versionStrings []string) ([]string, error)
- type EcosystemType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaxSatisfying ¶
func MaxSatisfying(versions []versions.Semver, c constraints.Constraint, includePreReleases bool) versions.Semver
Evaluates the given constraints for each provided version and returns the hightest version that satisfies this constraint (if any)
func MaxSatisfyingStrings ¶
func MaxSatisfyingStrings(versions []string, c constraints.Constraint, includePreReleases bool) (versions.Semver, error)
Evaluates the given constraints for each provided version and returns the hightest version that satisfies this constraint (if any) Equivalent to MaxSatisfying, but this function allows users to pass in versions as strings
func ParseConstraint ¶
func ParseConstraint(constraintString string) (constraints.Constraint, error)
Parses a given node semver constraint string into a constraint object DEPRECATED: Use ParseConstraintWithEcosystem for new code. Defaults to NodeJS boilerplates.
func ParseConstraintWithEcosystem ¶
func ParseConstraintWithEcosystem(constraintString string, ecosystem EcosystemType) (constraints.Constraint, error)
Parses a given semver constraint string into a constraint object for specified ecosystem
func ParseSemver ¶
Parses a semver string into a semver object DEPRECATED: Use ParseSemverWithEcosystem for new code. Defaults to NodeJS boilerplates.
func ParseSemverWithEcosystem ¶
func ParseSemverWithEcosystem(versionLiteral string, ecosystem EcosystemType) (versions.Semver, error)
Parses a semver string into a semver object for specified ecosystem
func Satisfies ¶
func Satisfies(v versions.Semver, c constraints.Constraint, includePreReleases bool) bool
Takes a version and semver constraint Returns true if the version satisfies the constraint and false otherwise
ex: constraint '>= 5.0.0' and version '5.0.0' would return true
As per node semver spec includePreReleases can be used to allow prerelease versions with different [major,minor,patch] tuple to satify the given constraint
ex: includePreReleases 'false' constraint '<= 5.0.0' and version '5.0.0-beta.2' would return true ex: includePreReleases 'false' constraint '<= 5.0.0' and version '4.0.0-beta.2' would return false ex: includePreReleases 'true' constraint '<= 5.0.0' and version '4.0.0-beta.2' would return true
Types ¶
type EcosystemType ¶
type EcosystemType string
EcosystemType represents different package ecosystem types
const ( // NodeJS represents Node.js/npm ecosystem with Node.js semver rules NodeJS EcosystemType = "nodejs" // Composer represents PHP/Composer ecosystem with Composer semver rules Composer EcosystemType = "composer" )