Skip to content

Commit b462713

Browse files
committedOct 11, 2024··
fix(add): don't add extra / if joining registry + package
resolves #509
1 parent 7d89c7f commit b462713

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/commands/module/add.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { defineCommand } from 'citty'
66
import { resolve } from 'pathe'
77
import consola from 'consola'
88
import { addDependency } from 'nypm'
9+
import { joinURL } from 'ufo'
910
import { $fetch } from 'ofetch'
1011
import { satisfies } from 'semver'
1112
import { updateConfig } from 'c12/update'
@@ -221,7 +222,7 @@ async function resolveModule(
221222
// Fetch package on npm
222223
pkgVersion = pkgVersion || 'latest'
223224
const registry = await detectNpmRegistry()
224-
const pkg = await $fetch(`${registry}/${pkgName}/${pkgVersion}`)
225+
const pkg = await $fetch(joinURL(registry, `${pkgName}/${pkgVersion}`))
225226
const pkgDependencies = Object.assign(
226227
pkg.dependencies || {},
227228
pkg.devDependencies || {},

0 commit comments

Comments
 (0)
Please sign in to comment.