MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / run

Function run

scripts/lighthouse-bundle-and-upload.mjs:52–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50const STATIC_DIR = 'dist';
51
52async 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:

Calls 6

prepareCellFunction · 0.85
uploadBundlesFunction · 0.85
pushMethod · 0.80
logMethod · 0.65
textMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected