🛠️ Update registry command & logs

This commit is contained in:
pheralb
2025-08-31 15:46:43 +01:00
parent 2c3fdf79fe
commit 733e136b3a
2 changed files with 4 additions and 36 deletions
+2 -34
View File
@@ -13,7 +13,6 @@ import { parseReactSvgContent } from "./src/utils/parseReactSvgContent";
const execAsync = promisify(exec); const execAsync = promisify(exec);
// ⚙️ Settings: // ⚙️ Settings:
const MINIFY_TSX = false;
const REGENERATE_ALL = true; const REGENERATE_ALL = true;
const SVGS_DATA = svgs; const SVGS_DATA = svgs;
const PUBLIC_FOLDER = "static"; const PUBLIC_FOLDER = "static";
@@ -188,29 +187,6 @@ function convertToFilesystemPath(svgPath: string): string {
return `./${PUBLIC_FOLDER}/${cleanPath}`; return `./${PUBLIC_FOLDER}/${cleanPath}`;
} }
function createSpinner() {
const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
let current = 0;
let interval;
return {
start(getMessage) {
interval = setInterval(() => {
const message =
typeof getMessage === "function" ? getMessage() : getMessage;
process.stdout.write(`\r${frames[current]} ${message}`);
current = (current + 1) % frames.length;
}, 100);
},
stop() {
if (interval) {
clearInterval(interval);
process.stdout.write("\r");
}
},
};
}
async function convertSvgToReact(svgPath: string): Promise<string> { async function convertSvgToReact(svgPath: string): Promise<string> {
const rawSvg = await fs.promises.readFile(svgPath, "utf-8"); const rawSvg = await fs.promises.readFile(svgPath, "utf-8");
const optimizedSvg = optimizeSvg({ svgCode: rawSvg }); const optimizedSvg = optimizeSvg({ svgCode: rawSvg });
@@ -222,7 +198,6 @@ async function convertSvgToReact(svgPath: string): Promise<string> {
componentName, componentName,
svgCode: optimizedSvg, svgCode: optimizedSvg,
typescript: true, typescript: true,
minify: MINIFY_TSX,
}); });
return code; return code;
} }
@@ -264,7 +239,6 @@ async function runShadcnBuild() {
} }
async function run() { async function run() {
const spinner = createSpinner();
let convertedCount = 0; let convertedCount = 0;
let totalCount = 0; let totalCount = 0;
@@ -287,9 +261,7 @@ async function run() {
return; return;
} }
spinner.start( console.log(`[📦] Converting ${totalCount} SVGs converted to TSX...`);
() => `[📦] ${convertedCount}/${totalCount} SVGs converted to TSX`,
);
// Process files // Process files
for (const svgFile of svgFiles) { for (const svgFile of svgFiles) {
@@ -319,11 +291,8 @@ async function run() {
throw new Error(error); throw new Error(error);
} }
} }
spinner.stop();
console.log( console.log(
`\n[✅] Conversion completed: ${convertedCount}/${totalCount} SVGs processed`, `\n[📦] ✨ Conversion completed: ${convertedCount}/${totalCount} SVGs processed`,
); );
if (convertedCount < totalCount) { if (convertedCount < totalCount) {
@@ -335,7 +304,6 @@ async function run() {
await runShadcnBuild(); await runShadcnBuild();
} }
} catch (error) { } catch (error) {
spinner.stop();
console.error("[❌] Error:", error); console.error("[❌] Error:", error);
throw new Error(error); throw new Error(error);
} finally { } finally {
+1 -1
View File
@@ -37,7 +37,7 @@
"lint": "eslint ./src", "lint": "eslint ./src",
"lint:fix": "eslint ./src --fix", "lint:fix": "eslint ./src --fix",
"build:shadcn": "shadcn build --output ./static/r", "build:shadcn": "shadcn build --output ./static/r",
"build:prod": "vite build && pnpm build:registry", "build:prod": "pnpm build:registry && vite build",
"build:registry": "tsx ./generate-registry.ts" "build:registry": "tsx ./generate-registry.ts"
}, },
"dependencies": { "dependencies": {