Skip to content

Commit 17fa8c1

Browse files
committed
fix packages being reinstalled on every start
1 parent 9aa0c40 commit 17fa8c1

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

packages/opencode/src/bun/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ export namespace BunProc {
6767
})
6868
if (parsed.dependencies[pkg] === version) return mod
6969
await BunProc.run(
70-
["add", "--exact", "--cwd", Global.Path.cache, "--registry=https://registry.npmjs.org", pkg + "@" + version],
70+
[
71+
"add",
72+
"--force",
73+
"--exact",
74+
"--cwd",
75+
Global.Path.cache,
76+
"--registry=https://registry.npmjs.org",
77+
pkg + "@" + version,
78+
],
7179
{
7280
cwd: Global.Path.cache,
7381
},
@@ -79,6 +87,8 @@ export namespace BunProc {
7987
},
8088
)
8189
})
90+
parsed.dependencies[pkg] = version
91+
await Bun.write(pkgjson.name!, JSON.stringify(parsed, null, 2))
8292
return mod
8393
}
8494
}

packages/opencode/src/global/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ await Promise.all([
2727
fs.mkdir(Global.Path.state, { recursive: true }),
2828
])
2929

30-
const CACHE_VERSION = "1"
30+
const CACHE_VERSION = "2"
3131

3232
const version = await Bun.file(path.join(Global.Path.cache, "version"))
3333
.text()

0 commit comments

Comments
 (0)