mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 20:43:41 +00:00
* use hardware requirements to display conflicts and prevent install * better messaging and also consider OS compatibility * wip: backend hw requirements * update backend components * migration --------- Co-authored-by: Aiden McClelland <me@drbonez.dev>
40 lines
943 B
TypeScript
40 lines
943 B
TypeScript
import { Injectable } from '@angular/core'
|
|
import { ExtendedVersion, VersionRange } from '@start9labs/start-sdk'
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class Exver {
|
|
constructor() {}
|
|
|
|
compareExver(lhs: string, rhs: string): number | null {
|
|
if (!lhs || !rhs) return null
|
|
try {
|
|
return ExtendedVersion.parse(lhs).compareForSort(
|
|
ExtendedVersion.parse(rhs),
|
|
)
|
|
} catch (e) {
|
|
return null
|
|
}
|
|
}
|
|
|
|
greaterThanOrEqual(lhs: string, rhs: string): boolean | null {
|
|
if (!lhs || !rhs) return null
|
|
try {
|
|
return ExtendedVersion.parse(lhs).greaterThanOrEqual(
|
|
ExtendedVersion.parse(rhs),
|
|
)
|
|
} catch (e) {
|
|
return null
|
|
}
|
|
}
|
|
|
|
satisfies(version: string, range: string): boolean {
|
|
return ExtendedVersion.parse(version).satisfies(VersionRange.parse(range))
|
|
}
|
|
|
|
getFlavor(version: string): string | null {
|
|
return ExtendedVersion.parse(version).flavor
|
|
}
|
|
}
|