()
| 50 | const STATIC_DIR = 'dist'; |
| 51 | |
| 52 | async function run() { |
| 53 | // Fail fast if the lab is down so we don't waste minutes building bundles. |
| 54 | console.log(`Liveness check: ${LAB_URL}/healthz`); |
| 55 | const health = await fetch(`${LAB_URL}/healthz`); |
| 56 | if (!health.ok) { |
| 57 | throw new Error(`Lab healthcheck failed: ${health.status} ${await health.text()}`); |
| 58 | } |
| 59 | console.log('Lab is reachable.'); |
| 60 | |
| 61 | await mkdir(path.join(RUNNER_TEMP, 'bundles'), { recursive: true }); |
| 62 | const bundles = []; |
| 63 | |
| 64 | for (const mode of MODES) { |
| 65 | const fieldName = `bundle-${bundles.length}`; |
| 66 | console.log(`\n=== Preparing ${APP} (${mode}) → ${fieldName} ===`); |
| 67 | bundles.push(await prepareCell(mode, fieldName)); |
| 68 | } |
| 69 | |
| 70 | console.log(`\n=== Uploading ${bundles.length} bundles to ${LAB_URL}/api/builds ===`); |
| 71 | const buildResp = await uploadBundles(bundles); |
| 72 | console.log(`Build queued: ${buildResp.buildId}`); |
| 73 | console.log(`Dashboard: ${LAB_URL}${buildResp.dashboardUrl}`); |
| 74 | console.log(`API: ${LAB_URL}${buildResp.buildUrl}`); |
| 75 | console.log('\nUpload succeeded. The lab runs Lighthouse asynchronously — track results in the Sentry dashboard.'); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Build a single (mode) cell: |
no test coverage detected