2025-05-01 16:27:34 +02:00
|
|
|
import { $, build } from "bun";
|
2024-11-25 21:54:31 +01:00
|
|
|
|
2025-05-01 16:27:34 +02:00
|
|
|
console.log("Building...");
|
2024-11-25 21:54:31 +01:00
|
|
|
|
|
|
|
|
await $`rm -rf dist && mkdir dist`;
|
|
|
|
|
|
2025-03-30 23:06:34 +02:00
|
|
|
await build({
|
2025-04-06 22:11:18 +02:00
|
|
|
entrypoints: [
|
2025-06-15 04:38:20 +02:00
|
|
|
"packages/worker/index.ts",
|
2025-04-06 22:11:18 +02:00
|
|
|
// HACK: Include to avoid cyclical import errors
|
2025-06-15 04:38:20 +02:00
|
|
|
"packages/config/index.ts",
|
|
|
|
|
"cli/index.ts",
|
2025-04-06 22:11:18 +02:00
|
|
|
],
|
2024-11-25 21:54:31 +01:00
|
|
|
outdir: "dist",
|
|
|
|
|
target: "bun",
|
|
|
|
|
splitting: true,
|
|
|
|
|
minify: false,
|
|
|
|
|
});
|
|
|
|
|
|
2025-05-01 16:27:34 +02:00
|
|
|
console.log("Copying files...");
|
2024-11-25 21:54:31 +01:00
|
|
|
|
2025-06-15 04:38:20 +02:00
|
|
|
// Fix Bun build mistake
|
|
|
|
|
await $`sed -i 's/ProxiableUrl, exportedConfig/exportedConfig/g' dist/packages/config/*.js`;
|
|
|
|
|
|
|
|
|
|
// Copy Drizzle stuff
|
|
|
|
|
await $`mkdir -p dist/packages/plugin-kit/tables`;
|
|
|
|
|
await $`cp -rL packages/plugin-kit/tables/migrations dist/packages/plugin-kit/tables`;
|
2024-11-25 21:54:31 +01:00
|
|
|
|
2025-01-06 19:30:51 +01:00
|
|
|
// Copy Sharp to dist
|
|
|
|
|
await $`mkdir -p dist/node_modules/@img`;
|
2025-04-14 17:13:36 +02:00
|
|
|
await $`cp -rL node_modules/@img/sharp-libvips-linux* dist/node_modules/@img`;
|
|
|
|
|
await $`cp -rL node_modules/@img/sharp-linux* dist/node_modules/@img`;
|
2025-01-06 19:30:51 +01:00
|
|
|
|
2025-04-14 17:13:36 +02:00
|
|
|
await $`cp -rL node_modules/detect-libc dist/node_modules/`;
|
2025-04-01 21:07:56 +02:00
|
|
|
|
2025-05-01 16:27:34 +02:00
|
|
|
console.log("Build complete!");
|