From dc42f2c00fdc0c2f310ba43aa7f6ab15c525f18c Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Tue, 23 Aug 2022 10:09:39 -0400 Subject: [PATCH] Fix `astro add @example-org/integration` (#4430) * fix: parse third-party org names * chore: changeset --- .changeset/loud-eagles-do.md | 5 +++++ packages/astro/src/core/add/index.ts | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 .changeset/loud-eagles-do.md diff --git a/.changeset/loud-eagles-do.md b/.changeset/loud-eagles-do.md new file mode 100644 index 000000000..df2066a0e --- /dev/null +++ b/.changeset/loud-eagles-do.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +astro add - Fix third-party npm orgs, i.e. `@example/integration` diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index 280c16db3..541f36a22 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -619,7 +619,7 @@ async function fetchPackageJson( name: string, tag: string ): Promise { - const packageName = `${scope ? `@${scope}/` : ''}${name}`; + const packageName = `${scope ? `${scope}/` : ''}${name}`; const res = await fetch(`https://registry.npmjs.org/${packageName}/${tag}`); if (res.status === 404) { return new Error(); @@ -637,13 +637,14 @@ export async function validateIntegrations(integrations: string[]): Promise