Преглед изворни кода

do not autoupgrade snapshot builds

Dax Raad пре 8 месеци
родитељ
комит
9c5616521d
2 измењених фајлова са 6 додато и 0 уклоњено
  1. 2 0
      packages/opencode/src/index.ts
  2. 4 0
      packages/opencode/src/installation/index.ts

+ 2 - 0
packages/opencode/src/index.ts

@@ -20,11 +20,13 @@ import { GlobalConfig } from "./global/config"
 import { Installation } from "./installation"
 ;(async () => {
   if (Installation.VERSION === "dev") return
+  if (Installation.isSnapshot()) return
   const config = await GlobalConfig.get()
   if (config.autoupdate === false) return
   const latest = await Installation.latest()
   if (Installation.VERSION === latest) return
   const method = await Installation.method()
+  if (method === "unknown") return
   await Installation.upgrade(method, latest).catch(() => {})
 })()
 

+ 4 - 0
packages/opencode/src/installation/index.ts

@@ -23,6 +23,10 @@ export namespace Installation {
     }
   }
 
+  export function isSnapshot() {
+    return VERSION.startsWith("0.0.0")
+  }
+
   export async function method() {
     if (process.execPath.includes(path.join(".opencode", "bin"))) return "curl"
     const exec = process.execPath.toLowerCase()