* Build a single (mode) cell: * 1. Copy the app to a unique temp dir. * 2. Apply pnpm overrides (existing helper). * 3. Run `pnpm install` then `pnpm build: `. * 4. Tar the `dist/` output dir. * 5. Return cell metadata for the upload.
(mode, fieldName)
| 84 | * 5. Return cell metadata for the upload. |
| 85 | */ |
| 86 | async function prepareCell(mode, fieldName) { |
| 87 | const tempApp = path.join(RUNNER_TEMP, `app-${APP}-${mode}`); |
| 88 | await rm(tempApp, { recursive: true, force: true }); |
| 89 | |
| 90 | // Copy app to temp (fixes file:/link: deps to workspace-absolute paths) |
| 91 | execFileSync('yarn', ['ci:copy-to-temp', `./test-applications/${APP_DIR}`, tempApp], { |
| 92 | cwd: E2E_DIR, |
| 93 | stdio: 'inherit', |
| 94 | }); |
| 95 | |
| 96 | // Add pnpm overrides (workspace-absolute paths pointing at packed dir) |
| 97 | execFileSync('yarn', ['ci:pnpm-overrides', tempApp, PACKED_DIR], { |
| 98 | cwd: E2E_DIR, |
| 99 | stdio: 'inherit', |
| 100 | }); |
| 101 | |
| 102 | // Install deps |
| 103 | execFileSync('pnpm', ['install'], { cwd: tempApp, stdio: 'inherit' }); |
| 104 | |
| 105 | // Build with the Vite mode — mode selection lives inside the per-mode npm |
| 106 | // script, no extra env vars needed for routing. VITE_E2E_TEST_DSN is passed |
| 107 | // so the tracing-replay build's Sentry.init has a DSN at build time. |
| 108 | execFileSync('pnpm', [`build:${mode}`], { |
| 109 | cwd: tempApp, |
| 110 | stdio: 'inherit', |
| 111 | env: { |
| 112 | ...process.env, |
| 113 | VITE_E2E_TEST_DSN: process.env.VITE_E2E_TEST_DSN ?? 'https://username@domain/123', |
| 114 | }, |
| 115 | }); |
| 116 | |
| 117 | const tarPath = path.join(RUNNER_TEMP, 'bundles', `${APP}-${mode}.tar.gz`); |
| 118 | execFileSync('tar', ['-czf', tarPath, '-C', tempApp, STATIC_DIR], { stdio: 'inherit' }); |
| 119 | console.log(`Static bundle: ${tarPath} (${await formatSize(tarPath)})`); |
| 120 | |
| 121 | return { |
| 122 | fieldName, |
| 123 | tarPath, |
| 124 | cell: { app: APP, mode, bundleField: fieldName, serve: 'static', staticDir: STATIC_DIR }, |
| 125 | }; |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * POST the multipart form. Returns the parsed 202 response body. |
no test coverage detected