|
|
|
@ -1,5 +1,3 @@
|
|
|
|
|
/// <reference lib="deno.unstable" />
|
|
|
|
|
|
|
|
|
|
import { bundle } from "./build_deps/emit.ts";
|
|
|
|
|
import { ensureDir } from "./build_deps/fs.ts";
|
|
|
|
|
import { build } from "./_build.ts";
|
|
|
|
@ -13,20 +11,29 @@ export const dist = async () => {
|
|
|
|
|
inlineSourceMap: true,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
const exe = Deno.run({ cmd: [
|
|
|
|
|
"deno",
|
|
|
|
|
"compile",
|
|
|
|
|
"--output",
|
|
|
|
|
"dist/statue",
|
|
|
|
|
"backend/main.ts",
|
|
|
|
|
], });
|
|
|
|
|
|
|
|
|
|
const [b_, exe_] = await Promise.all([b, exe.status()]);
|
|
|
|
|
if (!exe_.success) {
|
|
|
|
|
console.error("Failed to build executable");
|
|
|
|
|
throw new Error(`${exe_.code}`);
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|