mirror of
https://github.com/garronej/ts-ci.git
synced 2025-11-30 21:43:05 +00:00
Fix version ordering
This commit is contained in:
parent
30ebebd7e8
commit
331734f7ee
2 changed files with 13 additions and 2 deletions
|
|
@ -47,7 +47,7 @@ export namespace NpmModuleVersion {
|
|||
export function compare(v1: NpmModuleVersion, v2: NpmModuleVersion): -1 | 0 | 1 {
|
||||
|
||||
const sign = (diff: number): -1 | 0 | 1 => diff === 0 ? 0 : (diff < 0 ? -1 : 1);
|
||||
const noUndefined= (n: number | undefined)=> n ?? -1;
|
||||
const noUndefined= (n: number | undefined)=> n ?? Infinity;
|
||||
|
||||
for (const level of ["major", "minor", "patch", "betaPreRelease"] as const) {
|
||||
if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
|
||||
|
|
@ -59,6 +59,12 @@ export namespace NpmModuleVersion {
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
console.log(compare(parse("3.0.0-beta.3"), parse("3.0.0")) === -1 )
|
||||
console.log(compare(parse("3.0.0-beta.3"), parse("3.0.0-beta.4")) === -1 )
|
||||
console.log(compare(parse("3.0.0-beta.3"), parse("4.0.0")) === -1 )
|
||||
*/
|
||||
|
||||
export function bumpType(
|
||||
params: {
|
||||
versionBehindStr: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue