makecode-core
Version:
MakeCode (PXT) - web-cached build tool
26 lines (25 loc) • 1.07 kB
TypeScript
export interface Version {
major: number;
minor: number;
patch: number;
pre: string[];
build: string[];
}
export declare function cmp(a: Version, b: Version): number;
export declare function parse(v: string, defaultVersion?: string): Version;
export declare function tryParse(v: string): Version;
export declare function normalize(v: string): string;
export declare function stringify(v: Version): string;
export declare function majorCmp(a: string, b: string): number;
/**
* Compares two semver version strings and returns -1 if a < b, 1 if a > b and 0
* if versions are equivalent. If a and b are invalid versions, classic strcmp is called.
* If a (or b) is an invalid version, it is considered greater than any version (strmp(undefined, "0.0.0") = 1)
*/
export declare function compareStrings(a: string, b: string): number;
export declare function inRange(rng: string, v: Version): boolean;
/**
* Filters and sort tags from latest to oldest (semver wize)
* @param tags
*/
export declare function sortLatestTags(tags: string[]): string[];