chore: cleanup
This commit is contained in:
parent
c5089c9851
commit
c585b9b50d
3 changed files with 48 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
45
packages/opencode/script/node-pty-helper.ts
Normal file
45
packages/opencode/script/node-pty-helper.ts
Normal 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}`)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue