From b4627138a47e39d23e79a691a811e170d0824d7a Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 11 Oct 2024 11:35:49 +0100 Subject: [PATCH] fix(add): don't add extra `/` if joining registry + package resolves https://github.com/nuxt/cli/issues/509 --- src/commands/module/add.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/module/add.ts b/src/commands/module/add.ts index bfd54df1..3da235ff 100644 --- a/src/commands/module/add.ts +++ b/src/commands/module/add.ts @@ -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' @@ -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 || {},