mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
Fixed npm registry URL slash handling
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
parent
61562dd9f0
commit
f422a9feec
1 changed files with 6 additions and 1 deletions
|
|
@ -159,7 +159,12 @@ export namespace Installation {
|
|||
export async function latest() {
|
||||
const [major] = VERSION.split(".").map((x) => Number(x))
|
||||
const channel = CHANNEL === "latest" ? `latest-${major}` : CHANNEL
|
||||
return fetch(`https://registry.npmjs.org/opencode-ai/${channel}`)
|
||||
|
||||
// Get npm registry and ensure it ends with slash
|
||||
const registry = await Bun.$`npm config get registry`.text().then((t) => t.trim())
|
||||
const registryUrl = registry.endsWith("/") ? registry : `${registry}/`
|
||||
|
||||
return fetch(`${registryUrl}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