mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix: resolve 'latest' to actual version when caching plugins (#5292)
This commit is contained in:
parent
802b862aae
commit
c33a90320c
1 changed files with 12 additions and 1 deletions
|
|
@ -127,7 +127,18 @@ export namespace BunProc {
|
|||
|
||||
await runInstall()
|
||||
|
||||
parsed.dependencies[pkg] = version
|
||||
// Resolve actual version from installed package when using "latest"
|
||||
// This ensures subsequent starts use the cached version until explicitly updated
|
||||
let resolvedVersion = version
|
||||
if (version === "latest") {
|
||||
const installedPkgJson = Bun.file(path.join(mod, "package.json"))
|
||||
const installedPkg = await installedPkgJson.json().catch(() => null)
|
||||
if (installedPkg?.version) {
|
||||
resolvedVersion = installedPkg.version
|
||||
}
|
||||
}
|
||||
|
||||
parsed.dependencies[pkg] = resolvedVersion
|
||||
await Bun.write(pkgjson.name!, JSON.stringify(parsed, null, 2))
|
||||
return mod
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue