(dir: string)
| 95 | } |
| 96 | |
| 97 | export function readUpdateCheckCache(dir: string): UpdateCheckCacheFile | null { |
| 98 | try { |
| 99 | const raw = fs.readFileSync(updateCheckCachePath(dir), 'utf8'); |
| 100 | const parsed = JSON.parse(raw) as UpdateCheckCacheFile; |
| 101 | if (typeof parsed?.lastAttemptAt !== 'number') return null; |
| 102 | return parsed; |
| 103 | } catch { |
| 104 | return null; // missing / torn / unparseable — same as no cache |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | function writeUpdateCheckCache(dir: string, cache: UpdateCheckCacheFile): void { |
| 109 | try { |
no test coverage detected