Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "pack/version/semver"

Index

Functions

addBranchPreRelease

  • addBranchPreRelease(baseVersion: string, goalEvent: SdmGoalEvent): string
  • Make a release version a branch-aware pre-release version. A timestamp is appended to the version. If the goal event was triggered from a non-default branch, a sanitized version of the branch name is inserted between the release version and the timestamp.

    Parameters

    • baseVersion: string

      Release-style semantic version, i.e., M.N.P

    • goalEvent: SdmGoalEvent

      SDM goal event triggering this action

    Returns string

    Clean, branch-aware, pre-release version string

cleanSemVerPrereleaseIdentifier

  • cleanSemVerPrereleaseIdentifier(i: string): string
  • Take a possibly invalid semantic version and make it valid. The function replaces _, ., and / with -, removes characters not allowed in a prerelease identifier, and remove adjacent - characters. If the resulting cleaned identifier starts with a zero (0) and is all numbers, leading zeroes are removed. If removing leading zeroes leads to an empty identifier, "ZERO" is returned.

    Parameters

    • i: string

    Returns string

    Clean semantic version prerelease identifier string

goalMilestoneOrRcVersion

  • Iterate through all the tags associated with the after commit of the push for the provided goal invocation. If any tag is a milesone or release candidate version, return that version. Otherwise, return undefined.

    Parameters

    Returns string | undefined

    Milestone or release candidate version or undefined

isMilestoneOrReleaseCandidate

  • isMilestoneOrReleaseCandidate(version: string): boolean
  • Determine if provided version is a milestone or release candidate version, i.e., a prerelease whose first prerelease identifer is "M" or "RC".

    Parameters

    • version: string

      Version to interrogate

    Returns boolean

    true if version is a milestone or release candidate, false otherwise

releaseLikeVersion

  • If there is a milestone or release candidate version tag associated with the after commit for the push triggering the provided goal invocation, return it. Otherwise return the provided version stripped of any prerelease identifier and/or build metadata.

    This helps you treat more standard prerelease versions, i.e., milestone and release candidate versions, like real releases.

    Parameters

    • version: string

      Prerelease version string

    • gi: GoalInvocation

      Goal invocation

    Returns string

    Release, milestone, or release candidate version

releaseVersion

  • releaseVersion(prVersion: string): string
  • Calculate release version from provided prerelease version, also stripping any build metadata if present.

    Parameters

    • prVersion: string

      Semantic version to reduce to release version

    Returns string

    Release semantic version

Generated using TypeDoc