diff options
author | 2022-09-20 17:36:40 +0100 | |
---|---|---|
committer | 2022-09-20 12:36:40 -0400 | |
commit | a49bc2f02e8fa6c3e26e73d28a1c9c0e40da082a (patch) | |
tree | 66839021829756b8de7b14a1eacd04f2836e431c | |
parent | 91568bb055c7e8d561232ddc6d10520fbf647e61 (diff) | |
download | astro-a49bc2f02e8fa6c3e26e73d28a1c9c0e40da082a.tar.gz astro-a49bc2f02e8fa6c3e26e73d28a1c9c0e40da082a.tar.zst astro-a49bc2f02e8fa6c3e26e73d28a1c9c0e40da082a.zip |
Fix extra slash when adding integrations that ends with `/astro` (#4817)
* fix toIdent util
* add changesets
-rw-r--r-- | .changeset/lovely-seals-compare.md | 5 | ||||
-rw-r--r-- | packages/astro/src/core/add/index.ts | 3 |
2 files changed, 7 insertions, 1 deletions
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<t.File> { // - 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 |