-
Notifications
You must be signed in to change notification settings - Fork 5
/
_compile.ts
42 lines (38 loc) · 1.07 KB
/
_compile.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import $ from "jsr:@david/dax@0.42.0";
import { build as esbuild } from "https://deno.land/x/esbuild@v0.24.0/mod.js";
import { ghDescribe } from "./core/mod.ts";
console.log("$ gh describe");
const { describe } = await ghDescribe();
console.log("$ esbuild");
await esbuild({
bundle: true,
entryPoints: ["./cli/main.compile.ts"],
outfile: "./dist/cli_deno.js",
format: "esm",
target: "es2021",
define: {
"globalThis.version": `"${describe}"`,
},
external: [
"jsr:@cliffy/ansi@1.0.0-rc.7/colors",
"jsr:@cliffy/command@1.0.0-rc.7",
"jsr:@std/path@1.0.6",
],
});
for (
const target of [
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
]
) {
console.log(`$ deno compile --target ${target}`);
const output = `dist/gh-describe-${target}`;
const cmd = $`deno compile -q --allow-run -o ${output} --target ${target} ./dist/cli_deno.js`;
const { code } = await cmd;
if (code !== 0) {
throw new Error(`\`deno compile\` exit code is not zero, ExitCode: ${code}`);
}
}
Deno.exit();