(mode: BuildMode)
| 307 | // --------------------------------------------------------------------------- |
| 308 | |
| 309 | const createEmbeddedWebUISource = async (mode: BuildMode) => { |
| 310 | const webDist = await buildWeb(mode); |
| 311 | const files = (await Array.fromAsync(new Bun.Glob("**/*").scan({ cwd: webDist }))) |
| 312 | .map((f) => f.replaceAll("\\", "/")) |
| 313 | .sort(); |
| 314 | |
| 315 | const imports = files.map((file, i) => { |
| 316 | const spec = join(webDist, file).replaceAll("\\", "/"); |
| 317 | return `import file_${i} from ${JSON.stringify(spec)} with { type: "file" };`; |
| 318 | }); |
| 319 | |
| 320 | const entries = files.map((file, i) => ` ${JSON.stringify(file)}: file_${i},`); |
| 321 | |
| 322 | return [ |
| 323 | "// Auto-generated — maps web UI paths to embedded file references", |
| 324 | ...imports, |
| 325 | "export default {", |
| 326 | ...entries, |
| 327 | "} as Record<string, string>;", |
| 328 | ].join("\n"); |
| 329 | }; |
| 330 | |
| 331 | // --------------------------------------------------------------------------- |
| 332 | // Embedded legacy v1 drizzle migrations — inlined as text imports so drizzle's |
no test coverage detected