(current: string, latest: string)
| 181 | } |
| 182 | |
| 183 | export function isUpdateAvailable(current: string, latest: string): boolean { |
| 184 | try { |
| 185 | return compareVersions(latest, current) > 0; |
| 186 | } catch { |
| 187 | // If either is unparseable (e.g. a dev "0.0.0-unknown"), treat differing |
| 188 | // strings as "update available" so the user isn't stuck. |
| 189 | return normalizeVersion(current) !== normalizeVersion(latest); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /** `0.9.9` / `v0.9.9` → `v0.9.9` (release tags are v-prefixed). */ |
| 194 | export function normalizeVersion(v: string): string { |
no test coverage detected