diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hg-web/src/build.ts	Sat Jan 24 21:06:42 2026 -0800
@@ -0,0 +1,24 @@
+import { readdir } from "node:fs/promises";
+const files = await readdir(import.meta.dir);
+console.log(files);
+
+
+const outputPath = Bun.argv[2];
+
+if (!outputPath) {
+  console.error("Please provide an output path. Usage: bun build.ts <output_path>");
+  process.exit(1);
+}
+
+const build = await Bun.build({
+  entrypoints: ["./hg-web/src/main.tsx"], 
+  outdir: outputPath,
+  metafile: true, 
+});
+
+if (build.success) {
+  console.log(`Build successful! Files saved to: ${outputPath}`);
+  console.log(JSON.stringify(build.metafile, null, 2));
+} else {
+  console.error("Build failed:", build.logs);
+}