mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
autoupgrade latest major only
This commit is contained in:
parent
4407d5d96f
commit
4d6e2d8efc
1 changed files with 3 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue