(
latestVersion: string,
options: { now?: number; stateFile?: string } = {}
)
| 280 | } |
| 281 | |
| 282 | export async function markUpdateNotificationShown( |
| 283 | latestVersion: string, |
| 284 | options: { now?: number; stateFile?: string } = {} |
| 285 | ): Promise<void> { |
| 286 | const now = options.now ?? Date.now(); |
| 287 | const state = await readUpdateState(options.stateFile); |
| 288 | await writeUpdateState( |
| 289 | { |
| 290 | ...state, |
| 291 | notifiedVersion: latestVersion, |
| 292 | lastNotifiedAt: now, |
| 293 | }, |
| 294 | options.stateFile |
| 295 | ); |
| 296 | } |
| 297 | |
| 298 | export function shouldSkipUpdateNotifier(argv = process.argv): boolean { |
| 299 | return argv.includes("--json") || argv.includes("-v") || argv.includes("--version"); |
no test coverage detected