chore: cleanup

pull/14339/head
Adam 2026-02-19 20:42:56 -06:00
parent c5089c9851
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

@ -11,8 +11,7 @@
"dev:web": "bun --cwd packages/app dev",
"typecheck": "bun turbo typecheck",
"prepare": "husky",
"random": "echo 'Random script'",
"hello": "echo 'Hello World!'",
"postinstall": "bun packages/opencode/script/node-pty-helper.ts",
"test": "echo 'do not run tests from root' && exit 1"
},
"workspaces": {

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}`)
}
}