Răsfoiți Sursa

fix packages being reinstalled on every start

Dax Raad 7 luni în urmă
părinte
comite
17fa8c117b

+ 11 - 1
packages/opencode/src/bun/index.ts

@@ -67,7 +67,15 @@ export namespace BunProc {
     })
     if (parsed.dependencies[pkg] === version) return mod
     await BunProc.run(
-      ["add", "--exact", "--cwd", Global.Path.cache, "--registry=https://registry.npmjs.org", pkg + "@" + version],
+      [
+        "add",
+        "--force",
+        "--exact",
+        "--cwd",
+        Global.Path.cache,
+        "--registry=https://registry.npmjs.org",
+        pkg + "@" + version,
+      ],
       {
         cwd: Global.Path.cache,
       },
@@ -79,6 +87,8 @@ export namespace BunProc {
         },
       )
     })
+    parsed.dependencies[pkg] = version
+    await Bun.write(pkgjson.name!, JSON.stringify(parsed, null, 2))
     return mod
   }
 }

+ 1 - 1
packages/opencode/src/global/index.ts

@@ -27,7 +27,7 @@ await Promise.all([
   fs.mkdir(Global.Path.state, { recursive: true }),
 ])
 
-const CACHE_VERSION = "1"
+const CACHE_VERSION = "2"
 
 const version = await Bun.file(path.join(Global.Path.cache, "version"))
   .text()