From a49bc2f02e8fa6c3e26e73d28a1c9c0e40da082a Mon Sep 17 00:00:00 2001 From: Mohammed Elhaouari Date: Tue, 20 Sep 2022 17:36:40 +0100 Subject: [PATCH] Fix extra slash when adding integrations that ends with `/astro` (#4817) * fix toIdent util * add changesets --- .changeset/lovely-seals-compare.md | 5 +++++ packages/astro/src/core/add/index.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/lovely-seals-compare.md diff --git a/.changeset/lovely-seals-compare.md b/.changeset/lovely-seals-compare.md new file mode 100644 index 000000000..667b932cf --- /dev/null +++ b/.changeset/lovely-seals-compare.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +fix parsing integration names with astro add command diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index 70a766e07..0f4e387ed 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -304,11 +304,12 @@ async function parseAstroConfig(configURL: URL): Promise { // - 123numeric => numeric // - @npm/thingy => npmThingy // - @jane/foo.js => janeFoo +// - @tokencss/astro => tokencss const toIdent = (name: string) => { const ident = name .trim() // Remove astro or (astrojs) prefix and suffix - .replace(/[-_\.]?astro(?:js)?[-_\.]?/g, '') + .replace(/[-_\.\/]?astro(?:js)?[-_\.]?/g, '') // drop .js suffix .replace(/\.js/, '') // convert to camel case