chore: cleanup

This commit is contained in:
Adam 2026-02-19 20:42:56 -06:00
commit c585b9b50d
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75
3 changed files with 48 additions and 2 deletions

View file

@ -142,6 +142,8 @@ if (!skipInstall) {
await $`bun install --os="*" --cpu="*" @opentui/core@${pkg.dependencies["@opentui/core"]}`
await $`bun install --os="*" --cpu="*" @parcel/watcher@${pkg.dependencies["@parcel/watcher"]}`
}
await $`bun script/node-pty-helper.ts`
for (const item of targets) {
const name = [
pkg.name,

View file

@ -0,0 +1,45 @@
#!/usr/bin/env bun
import fs from "node:fs"
import path from "node:path"
import { createRequire } from "node:module"
const req = createRequire(import.meta.url)
const resolve = () => {
try {
return path.dirname(req.resolve("node-pty/package.json"))
} catch {
return
}
}
export const fixNodePtyHelper = () => {
const root = resolve()
if (!root) return []
const files = [
path.join(root, "prebuilds", "darwin-arm64", "spawn-helper"),
path.join(root, "prebuilds", "darwin-x64", "spawn-helper"),
path.join(root, "build", "Release", "spawn-helper"),
path.join(root, "build", "Debug", "spawn-helper"),
]
return files.flatMap((file) => {
if (!fs.existsSync(file)) return []
const mode = fs.statSync(file).mode
const next = mode | 0o111
if (mode === next) return []
fs.chmodSync(file, next)
return [file]
})
}
if (import.meta.main) {
const changed = fixNodePtyHelper()
if (!changed.length) process.exit(0)
console.log(`updated node-pty spawn-helper permissions (${changed.length})`)
for (const file of changed) {
console.log(`- ${file}`)
}
}