mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-25 00:39:49 +00:00
Show changelog on new version
This commit is contained in:
@@ -14,3 +14,27 @@ export function electronAPI() {
|
||||
export function showNativeMenu(options?: ElectronContextMenuOptions) {
|
||||
electronAPI()?.showContextMenu(options)
|
||||
}
|
||||
|
||||
const normalizeVersion = (version: string) => {
|
||||
return version
|
||||
.split('.')
|
||||
.map(Number)
|
||||
.filter((v) => !Number.isNaN(v))
|
||||
}
|
||||
|
||||
export function isVersionLessThan(versionA: string, versionB: string) {
|
||||
versionA ??= '0.0.0'
|
||||
versionB ??= '0.0.0'
|
||||
|
||||
const normalizedA = normalizeVersion(versionA)
|
||||
const normalizedB = normalizeVersion(versionB)
|
||||
|
||||
for (let i = 0; i < Math.max(normalizedA.length, normalizedB.length); i++) {
|
||||
const a = normalizedA[i] ?? 0
|
||||
const b = normalizedB[i] ?? 0
|
||||
if (a < b) return true
|
||||
if (a > b) return false
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user