mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-27 03:34:58 +01:00
autoupgrade latest major only
This commit is contained in:
@@ -142,7 +142,9 @@ export namespace Installation {
|
|||||||
export const USER_AGENT = `opencode/${CHANNEL}/${VERSION}`
|
export const USER_AGENT = `opencode/${CHANNEL}/${VERSION}`
|
||||||
|
|
||||||
export async function latest() {
|
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) => {
|
.then((res) => {
|
||||||
if (!res.ok) throw new Error(res.statusText)
|
if (!res.ok) throw new Error(res.statusText)
|
||||||
return res.json()
|
return res.json()
|
||||||
|
|||||||
Reference in New Issue
Block a user