Skip to content

Commit

Permalink
Fix extra slash when adding integrations that ends with /astro (wit…
Browse files Browse the repository at this point in the history
…hastro#4817)

* fix toIdent util

* add changesets
  • Loading branch information
the-dijkstra committed Sep 20, 2022
1 parent 91568bb commit a49bc2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/lovely-seals-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

fix parsing integration names with astro add command
3 changes: 2 additions & 1 deletion packages/astro/src/core/add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a49bc2f

Please sign in to comment.