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 19:27:50 +01:00
|
|
|
|
2025-05-01 16:27:34 +02:00
|
|
|
console.log("Building...");
|
2023-12-09 00:00:47 +01:00
|
|
|
|
2024-04-09 13:14:53 +02:00
|
|
|
await $`rm -rf dist && mkdir dist`;
|
2023-12-09 03:59:02 +01:00
|
|
|
|
2025-03-30 23:06:34 +02:00
|
|
|
await build({
|
2024-04-07 07:30:49 +02:00
|
|
|
entrypoints: [
|
2025-07-04 06:29:43 +02:00
|
|
|
...Object.values(manifest.exports).map((entry) => entry.import),
|
2024-04-07 07:30:49 +02:00
|
|
|
// Force Bun to include endpoints
|
2024-04-16 09:13:34 +02:00
|
|
|
...Object.values(routes),
|
2024-04-07 07:30:49 +02:00
|
|
|
],
|
2024-05-08 02:10:42 +02:00
|
|
|
outdir: "dist",
|
2024-04-07 07:30:49 +02: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-08 09:25:31 +01:00
|
|
|
});
|
2023-12-09 02:51:48 +01:00
|
|
|
|
2025-05-01 16:27:34 +02:00
|
|
|
console.log("Copying files...");
|
2024-05-08 02:10:42 +02: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!");
|