MCPcopy Create free account
hub / github.com/anomalyco/opencode / fixKnownLockfileIssues

Function fixKnownLockfileIssues

script/upgrade-opentui.ts:157–178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155console.log("bun.lock opentui versions are consistent")
156
157async function fixKnownLockfileIssues() {
158 const txt = await Bun.file(lockfile).text()
159 const stale = findStaleLockfileEntriesInText(txt)
160 if (stale.length === 0) return []
161 if (stale.some((item) => !item.entry.startsWith("opentui-spinner/@opentui/"))) return []
162
163 const removed = txt
164 .split("\n")
165 .map((line) => line.match(/^ "(opentui-spinner\/@opentui\/[^\"]+)": /)?.[1])
166 .filter((item): item is string => item !== undefined)
167
168 if (removed.length === 0) return []
169
170 await Bun.write(
171 lockfile,
172 txt
173 .split("\n")
174 .filter((line) => !line.match(/^ "opentui-spinner\/@opentui\//))
175 .join("\n"),
176 )
177 return removed
178}
179
180async function findStaleLockfileEntries() {
181 return findStaleLockfileEntriesInText(await Bun.file(lockfile).text())

Callers 1

upgrade-opentui.tsFile · 0.85

Calls 4

fileMethod · 0.80
writeMethod · 0.80
textMethod · 0.65

Tested by

no test coverage detected