Skip to content

Commit 6086072

Browse files
authored
upgrade opentui to 0.1.91 (anomalyco#19440)
1 parent 6c14ea1 commit 6086072

4 files changed

Lines changed: 85 additions & 20 deletions

File tree

bun.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/opencode/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"typecheck": "tsgo --noEmit",
1111
"test": "bun test --timeout 30000",
1212
"build": "bun run script/build.ts",
13+
"upgrade-opentui": "bun run script/upgrade-opentui.ts",
1314
"dev": "bun run --conditions=browser ./src/index.ts",
1415
"random": "echo 'Random script updated at $(date)' && echo 'Change queued successfully' && echo 'Another change made' && echo 'Yet another change' && echo 'One more change' && echo 'Final change' && echo 'Another final change' && echo 'Yet another final change'",
1516
"clean": "echo 'Cleaning up...' && rm -rf node_modules dist",
@@ -101,8 +102,8 @@
101102
"@opencode-ai/sdk": "workspace:*",
102103
"@opencode-ai/util": "workspace:*",
103104
"@openrouter/ai-sdk-provider": "2.3.3",
104-
"@opentui/core": "0.1.90",
105-
"@opentui/solid": "0.1.90",
105+
"@opentui/core": "0.1.91",
106+
"@opentui/solid": "0.1.91",
106107
"@parcel/watcher": "2.5.1",
107108
"@pierre/diffs": "catalog:",
108109
"@solid-primitives/event-bus": "1.1.2",
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env bun
2+
3+
import path from "node:path"
4+
5+
const raw = process.argv[2]
6+
if (!raw) {
7+
console.error("Usage: bun run script/upgrade-opentui.ts <version>")
8+
process.exit(1)
9+
}
10+
11+
const ver = raw.replace(/^v/, "")
12+
const root = path.resolve(import.meta.dir, "../../..")
13+
const skip = new Set([".git", ".opencode", ".turbo", "dist", "node_modules"])
14+
const keys = ["@opentui/core", "@opentui/solid"] as const
15+
16+
const files = (await Array.fromAsync(new Bun.Glob("**/package.json").scan({ cwd: root }))).filter(
17+
(file) => !file.split("/").some((part) => skip.has(part)),
18+
)
19+
20+
const set = (cur: string) => {
21+
if (cur.startsWith(">=")) return `>=${ver}`
22+
if (cur.startsWith("^")) return `^${ver}`
23+
if (cur.startsWith("~")) return `~${ver}`
24+
return ver
25+
}
26+
27+
const edit = (obj: unknown) => {
28+
if (!obj || typeof obj !== "object") return false
29+
const map = obj as Record<string, unknown>
30+
return keys
31+
.map((key) => {
32+
const cur = map[key]
33+
if (typeof cur !== "string") return false
34+
const next = set(cur)
35+
if (next === cur) return false
36+
map[key] = next
37+
return true
38+
})
39+
.some(Boolean)
40+
}
41+
42+
const out = (
43+
await Promise.all(
44+
files.map(async (rel) => {
45+
const file = path.join(root, rel)
46+
const txt = await Bun.file(file).text()
47+
const json = JSON.parse(txt)
48+
const hit = [json.dependencies, json.devDependencies, json.peerDependencies].map(edit).some(Boolean)
49+
if (!hit) return null
50+
await Bun.write(file, `${JSON.stringify(json, null, 2)}\n`)
51+
return rel
52+
}),
53+
)
54+
).filter((item): item is string => item !== null)
55+
56+
if (out.length === 0) {
57+
console.log("No opentui deps found")
58+
process.exit(0)
59+
}
60+
61+
console.log(`Updated opentui to ${ver} in:`)
62+
for (const file of out) {
63+
console.log(`- ${file}`)
64+
}

packages/plugin/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"zod": "catalog:"
2222
},
2323
"peerDependencies": {
24-
"@opentui/core": ">=0.1.90",
25-
"@opentui/solid": ">=0.1.90"
24+
"@opentui/core": ">=0.1.91",
25+
"@opentui/solid": ">=0.1.91"
2626
},
2727
"peerDependenciesMeta": {
2828
"@opentui/core": {
@@ -33,8 +33,8 @@
3333
}
3434
},
3535
"devDependencies": {
36-
"@opentui/core": "0.1.90",
37-
"@opentui/solid": "0.1.90",
36+
"@opentui/core": "0.1.91",
37+
"@opentui/solid": "0.1.91",
3838
"@tsconfig/node22": "catalog:",
3939
"@types/node": "catalog:",
4040
"typescript": "catalog:",

0 commit comments

Comments
 (0)