You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
885 B
TypeScript
43 lines
885 B
TypeScript
import { bundle } from "./build_deps/emit.ts";
|
|
import { ensureDir } from "./build_deps/fs.ts";
|
|
import { build } from "./_build.ts";
|
|
|
|
export const dist = async () => {
|
|
await build(true);
|
|
await ensureDir("./dist");
|
|
|
|
const b = bundle("backend/main.ts", {
|
|
compilerOptions: {
|
|
inlineSourceMap: true,
|
|
},
|
|
});
|
|
|
|
const exes = [
|
|
"x86_64-unknown-linux-gnu",
|
|
"x86_64-pc-windows-msvc",
|
|
"x86_64-apple-darwin",
|
|
"aarch64-apple-darwin",
|
|
].map(async (target) => {
|
|
const status = await Deno.run({ cmd: [
|
|
"deno",
|
|
"compile",
|
|
"-A",
|
|
`--target=${target}`,
|
|
"--output",
|
|
`dist/statue-${target}`,
|
|
"backend/main.ts",
|
|
], }).status();
|
|
|
|
if (!status.success) {
|
|
throw new Error(`Failed to compile for ${target}`);
|
|
}
|
|
});
|
|
|
|
const [b_] = await Promise.all([b, ...exes]);
|
|
await Deno.writeTextFile("dist/statue.js", b_.code);
|
|
};
|
|
|
|
if (import.meta.main) {
|
|
await dist();
|
|
}
|