2025-03-30 23:06:34 +02:00
|
|
|
import { build } from "bun";
|
2024-11-25 21:54:31 +01:00
|
|
|
import { $ } from "bun";
|
|
|
|
|
import ora from "ora";
|
|
|
|
|
|
|
|
|
|
const buildSpinner = ora("Building").start();
|
|
|
|
|
|
|
|
|
|
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: [
|
|
|
|
|
"entrypoints/worker/index.ts",
|
|
|
|
|
// HACK: Include to avoid cyclical import errors
|
|
|
|
|
"config.ts",
|
|
|
|
|
],
|
2024-11-25 21:54:31 +01:00
|
|
|
outdir: "dist",
|
|
|
|
|
target: "bun",
|
|
|
|
|
splitting: true,
|
|
|
|
|
minify: false,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
buildSpinner.text = "Transforming";
|
|
|
|
|
|
|
|
|
|
// Copy Drizzle migrations to dist
|
|
|
|
|
await $`cp -r drizzle dist/drizzle`;
|
|
|
|
|
|
2025-01-06 19:30:51 +01:00
|
|
|
// Copy Sharp to dist
|
|
|
|
|
await $`mkdir -p dist/node_modules/@img`;
|
|
|
|
|
await $`cp -r node_modules/@img/sharp-libvips-linuxmusl-* dist/node_modules/@img`;
|
|
|
|
|
await $`cp -r node_modules/@img/sharp-linuxmusl-* dist/node_modules/@img`;
|
|
|
|
|
|
2025-04-01 21:07:56 +02:00
|
|
|
await $`cp -r node_modules/detect-libc dist/node_modules/`;
|
|
|
|
|
|
2024-11-25 21:54:31 +01:00
|
|
|
buildSpinner.stop();
|