Skip to content

Commit c5b4cc8

Browse files
authored
fix: bunfs path on windows (anomalyco#5011)
1 parent 0bccd1d commit c5b4cc8

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

packages/opencode/script/build.ts

Lines changed: 10 additions & 3 deletions
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 skipInstall = process.argv.includes("--skip-install")
1920

2021
const allTargets: {
2122
os: string
@@ -83,8 +84,10 @@ const targets = singleFlag
8384
await $`rm -rf dist`
8485

8586
const binaries: Record<string, string> = {}
86-
await $`bun install --os="*" --cpu="*" @opentui/core@${pkg.dependencies["@opentui/core"]}`
87-
await $`bun install --os="*" --cpu="*" @parcel/watcher@${pkg.dependencies["@parcel/watcher"]}`
87+
if (!skipInstall) {
88+
await $`bun install --os="*" --cpu="*" @opentui/core@${pkg.dependencies["@opentui/core"]}`
89+
await $`bun install --os="*" --cpu="*" @parcel/watcher@${pkg.dependencies["@parcel/watcher"]}`
90+
}
8891
for (const item of targets) {
8992
const name = [
9093
pkg.name,
@@ -102,6 +105,10 @@ for (const item of targets) {
102105
const parserWorker = fs.realpathSync(path.resolve(dir, "./node_modules/@opentui/core/parser.worker.js"))
103106
const workerPath = "./src/cli/cmd/tui/worker.ts"
104107

108+
// Use platform-specific bunfs root path based on target OS
109+
const bunfsRoot = item.os === "win32" ? "B:/~BUN/root/" : "/$bunfs/root/"
110+
const workerRelativePath = path.relative(dir, parserWorker).replaceAll("\\", "/")
111+
105112
await Bun.build({
106113
conditions: ["browser"],
107114
tsconfig: "./tsconfig.json",
@@ -118,7 +125,7 @@ for (const item of targets) {
118125
entrypoints: ["./src/index.ts", parserWorker, workerPath],
119126
define: {
120127
OPENCODE_VERSION: `'${Script.version}'`,
121-
OTUI_TREE_SITTER_WORKER_PATH: "/$bunfs/root/" + path.relative(dir, parserWorker).replaceAll("\\", "/"),
128+
OTUI_TREE_SITTER_WORKER_PATH: bunfsRoot + workerRelativePath,
122129
OPENCODE_WORKER_PATH: workerPath,
123130
OPENCODE_CHANNEL: `'${Script.channel}'`,
124131
},

0 commit comments

Comments
 (0)