feat: implement namespace management and improve build process

This commit is contained in:
2026-08-09 13:06:57 +07:00 Unverified
parent 8f331d4cc7
commit 58c26b735a
8 changed files with 202 additions and 48 deletions
+33 -9
View File
@@ -1,11 +1,35 @@
// oxlint-disable no-unused-expressions
import { build } from "bun";
import { createLogger } from "./lib/logger";
import { readdir, rename, rmdir } from "node:fs/promises";
build({
compile: true,
sourcemap: true,
minify: true,
target: "bun",
entrypoints: ["index.ts"],
outdir: "dist",
features: ["prod"],
});
async function platform(p: string) {
const log = createLogger(
p
.split("-")
.map((e) => e[0])
.join(""),
);
log`Build started`;
await build({
compile: true,
minify: true,
target: `bun-${p}` as "bun",
entrypoints: ["index.ts"],
outdir: `dist/${p}`,
features: ["prod"],
bytecode: true,
});
log`Build finished`;
const output = await readdir(`dist/${p}`).then((e) => e[0]!);
const [_, ext] = output.split(".");
await rename(
`dist/${p}/${output}`,
`dist/kuber${p.includes("arm64") ? "-arm64" : ""}${ext ? `.${ext}` : ""}`,
);
await rmdir(`dist/${p}`);
}
const PLATFORMS = ["linux-x64", "linux-arm64", "windows-x64"];
await Promise.all(PLATFORMS.map(platform));