// Real check + download + sha512 verification against the PUBLIC release server, as an installation of // version --as would do it on this platform (Windows: NSIS updater, Linux: AppImage updater). Runs the update // service in a dev-mode Electron harness with a temp profile and temp updater cache. Never installs. // // node scripts/update-live-check.mjs --as 0.1.2-rc.1 [--channel preview|stable] [--out result.json] import { writeFileSync } from 'node:fs'; import { runUpdateHarness } from '../test/fixtures/run-update-harness.mjs'; const argv = process.argv.slice(2); const opt = (n) => (argv.indexOf(`--${n}`) >= 0 ? argv[argv.indexOf(`--${n}`) + 1] : undefined); const version = opt('as'); if (!version) { console.error('usage: update-live-check.mjs --as [--channel preview|stable] [--out file]'); process.exit(2); } const result = await runUpdateHarness({ version, timeoutMs: 15 * 60 * 1000, extraEnv: { UPDATE_HARNESS_LIVE: '1', UPDATE_HARNESS_CHANNEL: opt('channel') ?? 'preview' }, }); const text = JSON.stringify({ checkedAt: new Date().toISOString(), ...result }, null, 2); if (opt('out')) writeFileSync(opt('out'), text); console.log(text); process.exit(result.live && result.live.phase !== 'error' ? 0 : 1);