-
Notifications
You must be signed in to change notification settings - Fork 6
/
_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/[email protected]";
import { build as esbuild } from "https://deno.land/x/[email protected]/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/[email protected]/colors",
"jsr:@cliffy/[email protected]",
"jsr:@std/[email protected]",
],
});
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();