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