update.ts
Install with bun add @addonium/helpers. Zero runtime dependencies - works under Bun, Node 18+, and browsers.
update.ts
parseSemver(v: string): [number, number, number] | null
function parseSemver.
compareVersions(a: string, b: string): -1 | 0 | 1 | null
-1 | 0 | 1 comparing SemVer triples; null when unparseable.
UpdateCheck
interface UpdateCheck.
shouldCheckForUpdate( manifest: Pick<Manifest, "update">, lastCheckedAtMs: number | null, nowMs = Date.now(), ): UpdateCheck
True when now - lastChecked >= checkInterval (default: check on launch).
describeVersionChange( from: string, to: string, ): "upgrade" | "downgrade" | "same" | "unknown"
Hosts MAY warn (never silently block) on downgrade / skipped major (§12.1).