2025-05-01 16:27:34 +02:00
|
|
|
import { $, build } from "bun";
|
2025-07-04 06:29:43 +02:00
|
|
|
import manifest from "./package.json" with { type: "json" };
|
2025-06-15 22:17:33 +02:00
|
|
|
import { routes } from "./routes.ts";
|
2024-03-12 08:27:50 -10:00
|
|
|
|
2025-05-01 16:27:34 +02:00
|
|
|
console.log("Building...");
|
2023-12-08 16:56:00 -10:00
|
|
|
|
2024-04-09 01:14:53 -10:00
|
|
|
await $`rm -rf dist && mkdir dist`;
|
2023-12-08 16:59:02 -10:00
|
|
|
|
2025-03-30 23:06:34 +02:00
|
|
|
await build({
|
2024-04-06 19:30:49 -10:00
|
|
|
entrypoints: [
|
2025-07-04 06:29:43 +02:00
|
|
|
...Object.values(manifest.exports).map((entry) => entry.import),
|
2024-04-06 19:30:49 -10:00
|
|
|
// Force Bun to include endpoints
|
2024-04-15 21:13:34 -10:00
|
|
|
...Object.values(routes),
|
2024-04-06 19:30:49 -10:00
|
|
|
],
|
2024-05-08 00:10:42 +00:00
|
|
|
outdir: "dist",
|
2024-04-06 19:30:49 -10:00
|
|
|
target: "bun",
|
|
|
|
|
splitting: true,
|
2025-07-04 06:29:43 +02:00
|
|
|
minify: true,
|
|
|
|
|
external: [
|
|
|
|
|
...Object.keys(manifest.dependencies).filter((dep) =>
|
|
|
|
|
dep.startsWith("@versia"),
|
|
|
|
|
),
|
|
|
|
|
"@bull-board/ui",
|
2025-07-07 04:52:46 +02:00
|
|
|
// Excluded because Standard Schema imports those, but the code is never executed
|
|
|
|
|
"@valibot/to-json-schema",
|
2025-07-07 05:08:34 +02:00
|
|
|
"effect",
|
2025-07-04 06:29:43 +02:00
|
|
|
],
|
2023-12-07 22:25:31 -10:00
|
|
|
});
|
2023-12-08 15:51:48 -10:00
|
|
|
|
2025-05-01 16:27:34 +02:00
|
|
|
console.log("Copying files...");
|
2024-05-08 00:10:42 +00:00
|
|
|
|
2025-01-07 14:10:54 +01:00
|
|
|
await $`mkdir -p dist/node_modules`;
|
|
|
|
|
|
2024-11-25 13:24:14 +01:00
|
|
|
// Copy bull-board to dist
|
|
|
|
|
await $`mkdir -p dist/node_modules/@bull-board`;
|
2025-07-04 06:29:43 +02:00
|
|
|
await $`cp -rL ../../node_modules/@bull-board/ui dist/node_modules/@bull-board/ui`;
|
2025-04-30 21:26:35 +02:00
|
|
|
|
2025-05-01 16:27:34 +02:00
|
|
|
console.log("Build complete!");
|