()
| 194 | * the scheduler can avoid retrying the same version on every invocation. |
| 195 | */ |
| 196 | export function reportCompletedUpdate(): void { |
| 197 | if (process.env["HYPERFRAMES_NO_UPDATE_CHECK"] === "1") return; |
| 198 | |
| 199 | const config = readConfig(); |
| 200 | const done = config.completedUpdate; |
| 201 | if (!done) return; |
| 202 | |
| 203 | if (done.ok) { |
| 204 | delete config.completedUpdate; |
| 205 | writeConfig(config); |
| 206 | } else if (!done.reported) { |
| 207 | config.completedUpdate = { ...done, reported: true }; |
| 208 | writeConfig(config); |
| 209 | } else { |
| 210 | return; |
| 211 | } |
| 212 | |
| 213 | if (!process.stderr.isTTY) return; |
| 214 | |
| 215 | if (done.ok) { |
| 216 | process.stderr.write(` hyperframes auto-updated to v${done.version}\n\n`); |
| 217 | } else if (!done.reported) { |
| 218 | // Failed installs are surfaced once too — the user should know why the |
| 219 | // auto-update didn't take. |
| 220 | process.stderr.write( |
| 221 | ` hyperframes auto-update to v${done.version} failed. Run \`hyperframes upgrade\` to retry.\n\n`, |
| 222 | ); |
| 223 | } |
| 224 | } |
no test coverage detected