Show changelog on new version

This commit is contained in:
christian-byrne
2025-01-18 12:25:04 -07:00
parent 1a4e77a3ab
commit 86789ceb9d
4 changed files with 80 additions and 0 deletions

View File

@@ -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
}