🛠️ Refactor parseSvgFilename function for improved component name formatting; add directory and file existence checks in generate-registry

This commit is contained in:
pheralb
2025-08-31 16:19:44 +01:00
parent 733e136b3a
commit 4cd2c84273
2 changed files with 32 additions and 5 deletions
+3 -3
View File
@@ -7,9 +7,9 @@ export const parseSvgFilename = (params: ParseSvgFilename): string => {
const { file, log } = params;
const name = file.replace(/\.svg$/i, "");
let component = name.replace(/(^\w|[-_]\w)/g, (m) =>
m.replace(/[-_]/, "").toUpperCase(),
);
let component = name
.replace(/[-_\s]+(.)?/g, (_, char) => (char ? char.toUpperCase() : ""))
.replace(/^(.)/, (char) => char.toLowerCase());
if (/^\d/.test(component)) {
if (log) {