Skip to content

Commit 0e5fd93

Browse files
committed
Make CLI build script Windows-friendly
1 parent 6c40bfe commit 0e5fd93

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

packages/opencode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"typecheck": "tsgo --noEmit",
99
"test": "bun test",
10-
"build": "./script/build.ts",
10+
"build": "bun run script/build.ts",
1111
"dev": "bun run --conditions=browser ./src/index.ts",
1212
"random": "echo 'Random script updated at $(date)' && echo 'Change queued successfully' && echo 'Another change made' && echo 'Yet another change' && echo 'One more change' && echo 'Final change' && echo 'Another final change' && echo 'Yet another final change'",
1313
"clean": "echo 'Cleaning up...' && rm -rf node_modules dist",

packages/opencode/script/build.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import pkg from "../package.json"
1616
import { Script } from "@opencode-ai/script"
1717

1818
const singleFlag = process.argv.includes("--single")
19+
const baselineFlag = process.argv.includes("--baseline")
1920
const skipInstall = process.argv.includes("--skip-install")
2021

2122
const allTargets: {
@@ -78,7 +79,19 @@ const allTargets: {
7879
]
7980

8081
const targets = singleFlag
81-
? allTargets.filter((item) => item.os === process.platform && item.arch === process.arch)
82+
? allTargets.filter((item) => {
83+
if (item.os !== process.platform || item.arch !== process.arch) {
84+
return false
85+
}
86+
87+
// When building for the current platform, prefer a single native binary by default.
88+
// Baseline binaries require additional Bun artifacts and can be flaky to download.
89+
if (item.avx2 === false) {
90+
return baselineFlag
91+
}
92+
93+
return true
94+
})
8295
: allTargets
8396

8497
await $`rm -rf dist`

0 commit comments

Comments
 (0)