feat: implement namespace management and improve build process
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user