[ci] format

This commit is contained in:
FredKSchott 2022-08-11 23:33:05 +00:00 committed by fredkbot
parent 7127b1bb35
commit 52068e2644

View file

@ -302,17 +302,17 @@ async function parseAstroConfig(configURL: URL): Promise<t.File> {
// - @npm/thingy => npmThingy // - @npm/thingy => npmThingy
// - @jane/foo.js => janeFoo // - @jane/foo.js => janeFoo
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
.replace(/(?:[\.\-\_\/]+)([a-zA-Z])/g, (_, w) => w.toUpperCase()) .replace(/(?:[\.\-\_\/]+)([a-zA-Z])/g, (_, w) => w.toUpperCase())
// drop invalid first characters // drop invalid first characters
.replace(/^[^a-zA-Z$_]+/, ''); .replace(/^[^a-zA-Z$_]+/, '');
return `${ident[0].toLowerCase()}${ident.slice(1)}`; return `${ident[0].toLowerCase()}${ident.slice(1)}`;
}; };
function createPrettyError(err: Error) { function createPrettyError(err: Error) {