diff options
| author | Albert O'Shea <[email protected]> | 2025-11-24 15:54:29 +1100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-23 22:54:29 -0600 |
| commit | a3a239967f170423e91382bfdaf1058755befbb8 (patch) | |
| tree | 322961f56a32fe8d164fdebc43c3a326c3fa421e /packages | |
| parent | b4fd4bb25757250b1bcd4da9e6398011ed07e2f3 (diff) | |
| download | opencode-a3a239967f170423e91382bfdaf1058755befbb8.tar.gz opencode-a3a239967f170423e91382bfdaf1058755befbb8.zip | |
nix: bundle js dist with bun and patch tree-sitter wasm paths (#4644)
Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: Github Action <[email protected]>
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/cli/cmd/tui/thread.ts | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/thread.ts b/packages/opencode/src/cli/cmd/tui/thread.ts index 89d61d0f3..79638c5e8 100644 --- a/packages/opencode/src/cli/cmd/tui/thread.ts +++ b/packages/opencode/src/cli/cmd/tui/thread.ts @@ -58,16 +58,14 @@ export const TuiThreadCommand = cmd({ // Resolve relative paths against PWD to preserve behavior when using --cwd flag const baseCwd = process.env.PWD ?? process.cwd() const cwd = args.project ? path.resolve(baseCwd, args.project) : process.cwd() - const defaultWorker = new URL("./worker.ts", import.meta.url) - // Nix build creates a bundled worker next to the binary; prefer it when present. + const localWorker = new URL("./worker.ts", import.meta.url) + const distWorker = new URL("./cli/cmd/tui/worker.js", import.meta.url) const execDir = path.dirname(process.execPath) - const bundledWorker = path.join(execDir, "opencode-worker.js") - const hasBundledWorker = await Bun.file(bundledWorker).exists() - const workerPath = (() => { + const workerPath = await iife(async () => { if (typeof OPENCODE_WORKER_PATH !== "undefined") return OPENCODE_WORKER_PATH - if (hasBundledWorker) return bundledWorker - return defaultWorker - })() + if (await Bun.file(distWorker).exists()) return distWorker + return localWorker + }) try { process.chdir(cwd) } catch (e) { |
