-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ts
More file actions
33 lines (29 loc) · 745 Bytes
/
build.ts
File metadata and controls
33 lines (29 loc) · 745 Bytes
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
// https://bun.sh/docs/bundler/executables#cross-compile-to-other-platforms
const BUN_BINARY_TARGETS = [
"linux-x64",
"linux-arm64",
"linux-x64-musl",
"linux-arm64-musl",
"windows-x64",
"darwin-x64",
"darwin-arm64",
];
await Bun.$`rm -rf ./dist`;
if (process.argv[2] === "compile") {
await Bun.$`mkdir -p ./dist`;
for (const target of BUN_BINARY_TARGETS) {
let suffix = target;
if (target.includes("windows")) {
suffix += ".exe";
}
await Bun.$`bun build --target=bun-${target} --compile --minify --sourcemap --bytecode src/index.ts --outfile=dist/rover-mcp-${suffix}`;
}
} else {
await Bun.build({
minify: true,
target: "node",
outdir: "./dist",
sourcemap: "external",
entrypoints: ["./src/index.ts"],
});
}