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
|
// - 123numeric => numeric
|
||||||
// - @npm/thingy => npmThingy
|
// - @npm/thingy => npmThingy
|
||||||
// - @jane/foo.js => janeFoo
|
// - @jane/foo.js => janeFoo
|
||||||
|
// - @tokencss/astro => tokencss
|
||||||
const toIdent = (name: string) => {
|
const toIdent = (name: string) => {
|
||||||
const ident = name
|
const ident = name
|
||||||
.trim()
|
.trim()
|
||||||
// Remove astro or (astrojs) prefix and suffix
|
// Remove astro or (astrojs) prefix and suffix
|
||||||
.replace(/[-_\.]?astro(?:js)?[-_\.]?/g, '')
|
.replace(/[-_\.\/]?astro(?:js)?[-_\.]?/g, '')
|
||||||
// drop .js suffix
|
// drop .js suffix
|
||||||
.replace(/\.js/, '')
|
.replace(/\.js/, '')
|
||||||
// convert to camel case
|
// convert to camel case
|
||||||
|
|
Loading…
Reference in a new issue