Compare commits

...

2 Commits

Author SHA1 Message Date
idylls 4805016532
Build binaries for all supported Deno targets in `_dist.ts` 2 years ago
idylls dd9a2f4283
Add `_dist.ts`
For help with releases
2 years ago

1
.gitignore vendored

@ -1,2 +1,3 @@
build/*
dist/*
config.json

@ -1,12 +1,14 @@
import { fs, emit } from "./build_deps.ts";
import { bundle } from "./build_deps/emit.ts";
import { ensureDir } from "./build_deps/fs.ts";
export const build = async (sourceMap = false) => {
const bundle = await emit.bundle("frontend/main.ts", {
const b = await bundle("frontend/main.ts", {
compilerOptions: {
inlineSourceMap: sourceMap,
},
});
await fs.ensureDir("./build");
await Deno.writeTextFile("./build/frontend.ts", `export const frontend = ${JSON.stringify(bundle.code)};`);
await ensureDir("./build");
await Deno.writeTextFile("./build/frontend.ts", `export const frontend = ${JSON.stringify(b.code)};`);
await Deno.writeTextFile("./build/style.ts", `export const style = ${JSON.stringify(await Deno.readTextFile("frontend/style.css"))}`)
};

@ -1,4 +1,4 @@
import { build } from "./build.ts";
import { build } from "./_build.ts";
await build(true);
await Deno.run({

@ -0,0 +1,42 @@
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();
}

@ -1,2 +0,0 @@
export * as fs from "https://deno.land/std@0.149.0/fs/mod.ts";
export * as emit from "https://deno.land/x/emit@0.4.0/mod.ts";

@ -0,0 +1 @@
export * from "https://deno.land/x/emit@0.4.0/mod.ts";

@ -0,0 +1 @@
export * from "https://deno.land/std@0.149.0/fs/mod.ts";
Loading…
Cancel
Save