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

autoupgrade latest major only

Dax Raad пре 11 месеци
родитељ
комит
4d6e2d8efc
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      packages/opencode/src/installation/index.ts

+ 3 - 1
packages/opencode/src/installation/index.ts

@@ -142,7 +142,9 @@ export namespace Installation {
   export const USER_AGENT = `opencode/${CHANNEL}/${VERSION}`
 
   export async function latest() {
-    return fetch(`https://registry.npmjs.org/opencode-ai/${CHANNEL}`)
+    const [major] = VERSION.split(".").map((x) => Number(x))
+    const channel = CHANNEL === "latest" ? `latest-${major}` : CHANNEL
+    return fetch(`https://registry.npmjs.org/opencode-ai/${channel}`)
       .then((res) => {
         if (!res.ok) throw new Error(res.statusText)
         return res.json()