(mode: BuildMode)
| 381 | // --------------------------------------------------------------------------- |
| 382 | |
| 383 | const createEmbeddedWebUISource = async (mode: BuildMode) => { |
| 384 | const webDist = await buildWeb(mode); |
| 385 | const files = (await Array.fromAsync(new Bun.Glob("**/*").scan({ cwd: webDist }))) |
| 386 | .map((f) => f.replaceAll("\\", "/")) |
| 387 | .sort(); |
| 388 | |
| 389 | const imports = files.map((file, i) => { |
| 390 | const spec = join(webDist, file).replaceAll("\\", "/"); |
| 391 | return `import file_${i} from ${JSON.stringify(spec)} with { type: "file" };`; |
| 392 | }); |
| 393 | |
| 394 | const entries = files.map((file, i) => ` ${JSON.stringify(file)}: file_${i},`); |
| 395 | |
| 396 | return [ |
| 397 | "// Auto-generated — maps web UI paths to embedded file references", |
| 398 | ...imports, |
| 399 | "export default {", |
| 400 | ...entries, |
| 401 | "} as Record<string, string>;", |
| 402 | ].join("\n"); |
| 403 | }; |
| 404 | |
| 405 | // --------------------------------------------------------------------------- |
| 406 | // Embedded legacy v1 drizzle migrations — inlined as text imports so drizzle's |
no test coverage detected