diff options
| author | Jérôme Benoit <[email protected]> | 2026-02-09 02:43:10 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-08 19:43:10 -0600 |
| commit | 79879b43cee88d0701448725acc3d0cc1d7664d8 (patch) | |
| tree | f29952e9409364445ab74cd4c8710f5056d5b77b /nix/scripts/normalize-bun-binaries.ts | |
| parent | a598ecac1f7593ac4533222c4223acb0122d5107 (diff) | |
| download | opencode-79879b43cee88d0701448725acc3d0cc1d7664d8.tar.gz opencode-79879b43cee88d0701448725acc3d0cc1d7664d8.zip | |
refactor(nix): use native Bun APIs and propagate errors (#12694)
Diffstat (limited to 'nix/scripts/normalize-bun-binaries.ts')
| -rw-r--r-- | nix/scripts/normalize-bun-binaries.ts | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/nix/scripts/normalize-bun-binaries.ts b/nix/scripts/normalize-bun-binaries.ts index 531d8fd05..978ab325b 100644 --- a/nix/scripts/normalize-bun-binaries.ts +++ b/nix/scripts/normalize-bun-binaries.ts @@ -8,7 +8,7 @@ type PackageManifest = { const root = process.cwd() const bunRoot = join(root, "node_modules/.bun") -const bunEntries = (await safeReadDir(bunRoot)).sort() +const bunEntries = (await readdir(bunRoot)).sort() let rewritten = 0 for (const entry of bunEntries) { @@ -45,11 +45,11 @@ for (const entry of bunEntries) { } } -console.log(`[normalize-bun-binaries] rewrote ${rewritten} links`) +console.log(`[normalize-bun-binaries] rebuilt ${rewritten} links`) async function collectPackages(modulesRoot: string) { const found: string[] = [] - const topLevel = (await safeReadDir(modulesRoot)).sort() + const topLevel = (await readdir(modulesRoot)).sort() for (const name of topLevel) { if (name === ".bin" || name === ".bun") { continue @@ -59,7 +59,7 @@ async function collectPackages(modulesRoot: string) { continue } if (name.startsWith("@")) { - const scoped = (await safeReadDir(full)).sort() + const scoped = (await readdir(full)).sort() for (const child of scoped) { const scopedDir = join(full, child) if (await isDirectory(scopedDir)) { @@ -121,14 +121,6 @@ async function isDirectory(path: string) { } } -async function safeReadDir(path: string) { - try { - return await readdir(path) - } catch { - return [] - } -} - function normalizeBinName(name: string) { const slash = name.lastIndexOf("/") if (slash >= 0) { |
