svgfusion 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/dist/cli.js +71 -54
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -53,6 +53,8 @@ pnpm add svgfusion
53
53
 
54
54
  ## CLI Options
55
55
 
56
+ <img src="https://i.ibb.co/8n2b5mtp/cli.png" alt="SVGFusion CLI" width="512" >
57
+
56
58
  svgfusion convert ./icons --output ./components --prefix Icon --suffix Svg
57
59
 
58
60
  You can add a prefix and/or suffix to the generated component names using the `--prefix` and `--suffix` options:
package/dist/cli.js CHANGED
@@ -520,43 +520,11 @@ async function convertToVue(svgContent, options = {}) {
520
520
  var import_url = require("url");
521
521
  var import_path3 = require("path");
522
522
  var import_fs2 = require("fs");
523
+
524
+ // src/utils/banner.ts
525
+ init_cjs_shims();
523
526
  var import_figlet = __toESM(require("figlet"));
524
- var colors = {
525
- cyan: "\x1B[36m",
526
- blue: "\x1B[34m",
527
- green: "\x1B[32m",
528
- red: "\x1B[31m",
529
- gray: "\x1B[90m",
530
- dim: "\x1B[2m",
531
- // Bold gradient colors with dramatic artistic accents
532
- darkBlue: "\x1B[38;2;0;100;255m",
533
- // Electric blue (bold)
534
- mediumBlue: "\x1B[38;2;50;150;255m",
535
- // Bright blue
536
- lightBlue: "\x1B[38;2;100;200;255m",
537
- // Vivid sky blue
538
- blueCyan: "\x1B[38;2;0;150;255m",
539
- // Electric blue-cyan
540
- mediumCyan: "\x1B[38;2;0;255;255m",
541
- // Pure cyan (bold)
542
- darkCyan: "\x1B[38;2;0;200;200m",
543
- // Electric turquoise
544
- softTeal: "\x1B[38;2;0;255;150m",
545
- // Electric teal
546
- tealGreen: "\x1B[38;2;0;200;100m",
547
- // Vivid teal green
548
- softGreen: "\x1B[38;2;50;255;100m",
549
- // Electric green
550
- mediumGreen: "\x1B[38;2;0;255;50m",
551
- // Pure green (bold)
552
- reset: "\x1B[0m"
553
- };
554
- var __filename2 = (0, import_url.fileURLToPath)(importMetaUrl);
555
- var __dirname = (0, import_path3.dirname)(__filename2);
556
- var packageJson = JSON.parse(
557
- (0, import_fs2.readFileSync)((0, import_path3.join)(__dirname, "..", "package.json"), "utf-8")
558
- );
559
- function createBanner() {
527
+ function createBanner(colors2) {
560
528
  const title = import_figlet.default.textSync("SVGfusion", {
561
529
  font: "ANSI Shadow",
562
530
  horizontalLayout: "default",
@@ -576,25 +544,25 @@ function createBanner() {
576
544
  return char;
577
545
  }
578
546
  if (diagonalProgress <= 0.1) {
579
- return `${colors.darkBlue}${char}${colors.reset}`;
547
+ return `${colors2.darkBlue}${char}${colors2.reset}`;
580
548
  } else if (diagonalProgress <= 0.2) {
581
- return `${colors.lightBlue}${char}${colors.reset}`;
549
+ return `${colors2.lightBlue}${char}${colors2.reset}`;
582
550
  } else if (diagonalProgress <= 0.32) {
583
- return `${colors.mediumBlue}${char}${colors.reset}`;
551
+ return `${colors2.mediumBlue}${char}${colors2.reset}`;
584
552
  } else if (diagonalProgress <= 0.42) {
585
- return `${colors.blueCyan}${char}${colors.reset}`;
553
+ return `${colors2.blueCyan}${char}${colors2.reset}`;
586
554
  } else if (diagonalProgress <= 0.52) {
587
- return `${colors.mediumCyan}${char}${colors.reset}`;
555
+ return `${colors2.mediumCyan}${char}${colors2.reset}`;
588
556
  } else if (diagonalProgress <= 0.62) {
589
- return `${colors.darkCyan}${char}${colors.reset}`;
557
+ return `${colors2.darkCyan}${char}${colors2.reset}`;
590
558
  } else if (diagonalProgress <= 0.72) {
591
- return `${colors.softTeal}${char}${colors.reset}`;
559
+ return `${colors2.softTeal}${char}${colors2.reset}`;
592
560
  } else if (diagonalProgress <= 0.82) {
593
- return `${colors.tealGreen}${char}${colors.reset}`;
561
+ return `${colors2.tealGreen}${char}${colors2.reset}`;
594
562
  } else if (diagonalProgress <= 0.92) {
595
- return `${colors.softGreen}${char}${colors.reset}`;
563
+ return `${colors2.softGreen}${char}${colors2.reset}`;
596
564
  } else {
597
- return `${colors.mediumGreen}${char}${colors.reset}`;
565
+ return `${colors2.mediumGreen}${char}${colors2.reset}`;
598
566
  }
599
567
  }).join("");
600
568
  return processedLine;
@@ -602,27 +570,67 @@ function createBanner() {
602
570
  return `
603
571
  ${gradientTitle}
604
572
 
605
- ${colors.gray}Transform SVG files into production-ready components${colors.reset}
606
- ${colors.blue}React${colors.reset} ${colors.gray}\u2022${colors.reset} ${colors.green}Vue 3${colors.reset} ${colors.gray}\u2022${colors.reset} ${colors.blue}TypeScript${colors.reset}
573
+ ${colors2.gray}Transform SVG files into production-ready components${colors2.reset}
574
+ ${colors2.blue}React${colors2.reset} ${colors2.gray}\u2022${colors2.reset} ${colors2.green}Vue 3${colors2.reset} ${colors2.gray}\u2022${colors2.reset} ${colors2.blue}TypeScript${colors2.reset}
607
575
 
608
- ${colors.gray}\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500${colors.reset}
576
+ ${colors2.gray}\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500${colors2.reset}
609
577
  `;
610
578
  }
579
+
580
+ // src/utils/colors.ts
581
+ init_cjs_shims();
582
+ var colors = {
583
+ cyan: "\x1B[36m",
584
+ blue: "\x1B[34m",
585
+ green: "\x1B[32m",
586
+ red: "\x1B[31m",
587
+ gray: "\x1B[90m",
588
+ dim: "\x1B[2m",
589
+ // Bold gradient colors with dramatic artistic accents
590
+ darkBlue: "\x1B[38;2;0;100;255m",
591
+ // Electric blue (bold)
592
+ mediumBlue: "\x1B[38;2;50;150;255m",
593
+ // Bright blue
594
+ lightBlue: "\x1B[38;2;100;200;255m",
595
+ // Vivid sky blue
596
+ blueCyan: "\x1B[38;2;0;150;255m",
597
+ // Electric blue-cyan
598
+ mediumCyan: "\x1B[38;2;0;255;255m",
599
+ // Pure cyan (bold)
600
+ darkCyan: "\x1B[38;2;0;200;200m",
601
+ // Electric turquoise
602
+ softTeal: "\x1B[38;2;0;255;150m",
603
+ // Electric teal
604
+ tealGreen: "\x1B[38;2;0;200;100m",
605
+ // Vivid teal green
606
+ softGreen: "\x1B[38;2;50;255;100m",
607
+ // Electric green
608
+ mediumGreen: "\x1B[38;2;0;255;50m",
609
+ // Pure green (bold)
610
+ reset: "\x1B[0m"
611
+ };
612
+
613
+ // src/cli.ts
614
+ var __filename2 = (0, import_url.fileURLToPath)(importMetaUrl);
615
+ var __dirname = (0, import_path3.dirname)(__filename2);
616
+ var packageJson = JSON.parse(
617
+ (0, import_fs2.readFileSync)((0, import_path3.join)(__dirname, "..", "package.json"), "utf-8")
618
+ );
611
619
  var program = new import_commander.Command();
612
620
  var isNpxCall = process.argv[1]?.includes("npx") || process.argv[1]?.includes("_npx");
613
- if (process.argv.length === 2 || isNpxCall && process.argv.length === 3) {
614
- console.log(createBanner());
621
+ if (process.argv.length === 1 || isNpxCall && process.argv.length === 2) {
622
+ console.log(createBanner(colors));
615
623
  }
616
624
  program.name("svgfusion").description(
617
625
  "Transform SVG files into production-ready React and Vue 3 components"
618
626
  ).version(packageJson.version);
619
- program.command("convert").description("Convert SVG files to React or Vue components").argument("<input>", "Input SVG file or directory").option("-o, --output <output>", "Output directory", "./components").option(
627
+ program.description("Convert SVG files to React or Vue components").argument("<input>", "Input SVG file or directory").option("-o, --output <output>", "Output directory", "./components").option(
620
628
  "-f, --framework <framework>",
621
629
  "Target framework (react|vue)",
622
630
  "react"
623
631
  ).option("-t, --typescript", "Generate TypeScript files", false).option("--no-optimize", "Skip SVG optimization").option("--prefix <prefix>", "Add prefix to component name").option("--suffix <suffix>", "Add suffix to component name").action(
624
632
  async (input, options) => {
625
- console.log(createBanner());
633
+ console.log(createBanner(colors));
626
634
  console.log(`${colors.blue}\u{1F504} Processing SVG files...${colors.reset}`);
627
635
  try {
628
636
  const { framework, output, typescript, optimize: optimize2, prefix, suffix } = options;
@@ -680,5 +688,14 @@ program.command("convert").description("Convert SVG files to React or Vue compon
680
688
  process.exit(1);
681
689
  }
682
690
  }
683
- );
691
+ ).addHelpText("before", createBanner(colors)).addHelpText(
692
+ "after",
693
+ `
694
+ ${colors.gray}Examples:${colors.reset}
695
+ ${colors.blue}svgfusion convert src/icons -o src/components${colors.reset}
696
+ ${colors.blue}svgfusion convert src/icons --framework vue --typescript${colors.reset}
697
+ ${colors.blue}svgfusion convert src/icons --optimize --prefix My --suffix Widget${colors.reset}
698
+ ${colors.blue}svgfusion convert src/icons --framework react --typescript --optimize${colors.reset}
699
+ `
700
+ ).outputHelp();
684
701
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svgfusion",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "A powerful CLI tool and library that converts SVG files into production-ready React and Vue 3 components with TypeScript support and automatic optimization.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",