Make CLI build script Windows-friendly (#5835)

This commit is contained in:
Christopher Tso
2025-12-21 17:09:58 +11:00
committed by GitHub
parent d3922f0965
commit 6dc4e5ac93
2 changed files with 15 additions and 2 deletions

View File

@@ -7,7 +7,7 @@
"scripts": {
"typecheck": "tsgo --noEmit",
"test": "bun test",
"build": "./script/build.ts",
"build": "bun run script/build.ts",
"dev": "bun run --conditions=browser ./src/index.ts",
"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'",
"clean": "echo 'Cleaning up...' && rm -rf node_modules dist",

View File

@@ -16,6 +16,7 @@ import pkg from "../package.json"
import { Script } from "@opencode-ai/script"
const singleFlag = process.argv.includes("--single")
const baselineFlag = process.argv.includes("--baseline")
const skipInstall = process.argv.includes("--skip-install")
const allTargets: {
@@ -78,7 +79,19 @@ const allTargets: {
]
const targets = singleFlag
? allTargets.filter((item) => item.os === process.platform && item.arch === process.arch)
? allTargets.filter((item) => {
if (item.os !== process.platform || item.arch !== process.arch) {
return false
}
// When building for the current platform, prefer a single native binary by default.
// Baseline binaries require additional Bun artifacts and can be flaky to download.
if (item.avx2 === false) {
return baselineFlag
}
return true
})
: allTargets
await $`rm -rf dist`