Fix extra slash when adding integrations that ends with /astro
(#4817)
* fix toIdent util * add changesets
This commit is contained in:
parent
91568bb055
commit
a49bc2f02e
2 changed files with 7 additions and 1 deletions
5
.changeset/lovely-seals-compare.md
Normal file
5
.changeset/lovely-seals-compare.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
fix parsing integration names with astro add command
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue