Mercurial
comparison hg-web/src/build.ts @ 190:a2725419f988 hg-web
Updated so that bun builds will with already existing js files.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Sat, 24 Jan 2026 21:06:42 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 188:32ce881452fa | 190:a2725419f988 |
|---|---|
| 1 import { readdir } from "node:fs/promises"; | |
| 2 const files = await readdir(import.meta.dir); | |
| 3 console.log(files); | |
| 4 | |
| 5 | |
| 6 const outputPath = Bun.argv[2]; | |
| 7 | |
| 8 if (!outputPath) { | |
| 9 console.error("Please provide an output path. Usage: bun build.ts <output_path>"); | |
| 10 process.exit(1); | |
| 11 } | |
| 12 | |
| 13 const build = await Bun.build({ | |
| 14 entrypoints: ["./hg-web/src/main.tsx"], | |
| 15 outdir: outputPath, | |
| 16 metafile: true, | |
| 17 }); | |
| 18 | |
| 19 if (build.success) { | |
| 20 console.log(`Build successful! Files saved to: ${outputPath}`); | |
| 21 console.log(JSON.stringify(build.metafile, null, 2)); | |
| 22 } else { | |
| 23 console.error("Build failed:", build.logs); | |
| 24 } |