@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
68 lines • 3.07 kB
TypeScript
import { GoalInvocation } from "../../api/goal/GoalInvocation";
import { SdmGoalEvent } from "../../api/goal/SdmGoalEvent";
/**
* 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.
*
* @param baseVersion Release-style semantic version, i.e., M.N.P
* @param goalEvent SDM goal event triggering this action
* @return Clean, branch-aware, pre-release version string
*/
export declare function addBranchPreRelease(baseVersion: string, goalEvent: SdmGoalEvent): 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.
*
* @param v Possibly invalid semantic version prerelease identifier
* @return Clean semantic version prerelease identifier string
*/
export declare function cleanSemVerPrereleaseIdentifier(i: string): string;
/**
* Calculate release version from provided prerelease version, also
* stripping any build metadata if present.
*
* @param prVersion Semantic version to reduce to release version
* @return Release semantic version
*/
export declare function releaseVersion(prVersion: string): string;
/**
* 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`.
*
* @param gi Goal invocation
* @return Milestone or release candidate version or `undefined`
*/
export declare function goalMilestoneOrRcVersion(gi: GoalInvocation): string | undefined;
/**
* 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.
*
* @param version Prerelease version string
* @param gi Goal invocation
* @return Release, milestone, or release candidate version
*/
export declare function releaseLikeVersion(version: string, gi: GoalInvocation): string;
/**
* Determine if provided version is a milestone or release candidate
* version, i.e., a prerelease whose first prerelease identifer is "M"
* or "RC".
*
* @param version Version to interrogate
* @return `true` if version is a milestone or release candidate, `false` otherwise
*/
export declare function isMilestoneOrReleaseCandidate(version: string): boolean;
//# sourceMappingURL=semver.d.ts.map