Skip to content

Commit

Permalink
fix(add): don't add extra / if joining registry + package
Browse files Browse the repository at this point in the history
resolves #509
  • Loading branch information
danielroe committed Oct 11, 2024
1 parent 7d89c7f commit b462713
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/commands/module/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { defineCommand } from 'citty'
import { resolve } from 'pathe'
import consola from 'consola'
import { addDependency } from 'nypm'
import { joinURL } from 'ufo'
import { $fetch } from 'ofetch'
import { satisfies } from 'semver'
import { updateConfig } from 'c12/update'
Expand Down Expand Up @@ -221,7 +222,7 @@ async function resolveModule(
// Fetch package on npm
pkgVersion = pkgVersion || 'latest'
const registry = await detectNpmRegistry()
const pkg = await $fetch(`${registry}/${pkgName}/${pkgVersion}`)
const pkg = await $fetch(joinURL(registry, `${pkgName}/${pkgVersion}`))
const pkgDependencies = Object.assign(
pkg.dependencies || {},
pkg.devDependencies || {},
Expand Down

0 comments on commit b462713

Please sign in to comment.