Fix: Resolve @opentui/core from various node_modules locations

This commit is contained in:
southseact-3d
2026-02-10 12:21:38 +00:00
parent 1f94c63384
commit a89e6940c0

View File

@@ -130,7 +130,22 @@ for (const item of targets) {
console.log(`building ${name}`)
await $`mkdir -p dist/${name}/bin`
const parserWorker = fs.realpathSync(path.resolve(dir, "./node_modules/@opentui/core/parser.worker.js"))
const parserWorker = await (async () => {
// Try to resolve from various possible locations (handles both hoisted and non-hoisted installs)
const possiblePaths = [
path.resolve(dir, "./node_modules/@opentui/core/parser.worker.js"),
path.resolve(dir, "../../node_modules/@opentui/core/parser.worker.js"),
path.resolve(dir, "../../../node_modules/@opentui/core/parser.worker.js"),
]
for (const p of possiblePaths) {
try {
return fs.realpathSync(p)
} catch {
continue
}
}
throw new Error("Could not find @opentui/core/parser.worker.js in any node_modules location")
})()
const workerPath = "./src/cli/cmd/tui/worker.ts"
// Use platform-specific bunfs root path based on target OS