Skip to content

Commit c235f90

Browse files
committed
chore: fix ci
1 parent 9fb3ea1 commit c235f90

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/utils/version.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,23 @@ function comparePrereleasePrecedence(a: string, b: string): number {
136136
return 0
137137
}
138138

139+
function parseSemver(v: string) {
140+
const hyphen = v.indexOf('-')
141+
const core = hyphen === -1 ? v : v.slice(0, hyphen)
142+
const pre = hyphen === -1 ? undefined : v.slice(hyphen + 1)
143+
144+
return {
145+
core,
146+
pre,
147+
}
148+
}
149+
139150
export function lt(a: string, b: string): boolean {
140151
a = stripBuildMetadata(a)
141152
b = stripBuildMetadata(b)
142153

143-
const [coreA, preA] = a.split('-')
144-
const [coreB, preB] = b.split('-')
154+
const { core: coreA, pre: preA } = parseSemver(a)
155+
const { core: coreB, pre: preB } = parseSemver(b)
145156

146157
const partsA = parseCoreVersion(coreA)!
147158
const partsB = parseCoreVersion(coreB)!

0 commit comments

Comments
 (0)