Skip to content

Commit f7c2246

Browse files
committed
Revert "Update build binary to search multiple packages' node_modules for tui core package"
This reverts commit 30e9142.
1 parent 30e9142 commit f7c2246

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

cli/scripts/build-binary.ts

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -203,38 +203,24 @@ main().catch((error: unknown) => {
203203
process.exit(1)
204204
})
205205

206-
function findOpenTuiCoreDir(): string | null {
207-
const candidates = [
208-
join(cliRoot, 'node_modules', '@opentui', 'core'),
209-
join(repoRoot, 'node_modules', '@opentui', 'core'),
210-
]
211-
return candidates.find((dir) => existsSync(dir)) ?? null
212-
}
213-
214-
function findOpenTuiCoreBundlePath(): string | null {
215-
const coreDir = findOpenTuiCoreDir()
216-
if (!coreDir) return null
217-
218-
// Prefer the hashed bundle file (e.g. index-0wbvecnk.js) over index.js
219-
const bundleFile = readdirSync(coreDir).find(
220-
(file) => file.startsWith('index-') && file.endsWith('.js'),
221-
)
222-
if (bundleFile) return join(coreDir, bundleFile)
206+
function patchOpenTuiAssetPaths() {
207+
const coreDir = join(cliRoot, 'node_modules', '@opentui', 'core')
208+
if (!existsSync(coreDir)) {
209+
log('OpenTUI core package not found; skipping asset patch')
210+
return
211+
}
223212

224213
const indexFile = readdirSync(coreDir).find(
225214
(file) => file.startsWith('index') && file.endsWith('.js'),
226215
)
227-
return indexFile ? join(coreDir, indexFile) : null
228-
}
229216

230-
function patchOpenTuiAssetPaths() {
231-
const bundlePath = findOpenTuiCoreBundlePath()
232-
if (!bundlePath) {
233-
log('OpenTUI core bundle not found; skipping asset patch')
217+
if (!indexFile) {
218+
log('OpenTUI core index bundle not found; skipping asset patch')
234219
return
235220
}
236221

237-
const content = readFileSync(bundlePath, 'utf8')
222+
const indexPath = join(coreDir, indexFile)
223+
const content = readFileSync(indexPath, 'utf8')
238224

239225
const absolutePathPattern =
240226
/var __dirname = ".*?packages\/core\/src\/lib\/tree-sitter\/assets";/
@@ -247,7 +233,7 @@ function patchOpenTuiAssetPaths() {
247233
'var __dirname = path3.join(path3.dirname(fileURLToPath(new URL(".", import.meta.url))), "lib/tree-sitter/assets");'
248234

249235
const patched = content.replace(absolutePathPattern, replacement)
250-
writeFileSync(bundlePath, patched)
236+
writeFileSync(indexPath, patched)
251237
logAlways('Patched OpenTUI core tree-sitter asset paths')
252238
}
253239

0 commit comments

Comments
 (0)