@chanwity/vega
v0.0.14
Published
A CLI tool to convert SVG icons to TypeScript React components
Maintainers
Readme
@chanwity/vega
A CLI tool to convert SVG icons to TypeScript React components with proper TypeScript types.
Features
- Converts SVG files to TypeScript React components
- Watches directories for changes
- Generates properly typed components
- Interactive CLI interface
Installation
Install globally via npm:
npm install -g @chanwity/vegaOr use with npx:
npx @chanwity/vegaUsage
- Run the CLI:
vega- Select "Create icons tsx" from the menu
- The tool will read your
config.yamlfile and watch for SVG files in the specified directory
Configuration
Create a config.yaml file in your project root:
icon:
watchPath: "./icons/" # Path to your SVG files
outPath: "./components/" # Output directory for TSX filesExample
Given an SVG file arrow-down.svg, the tool will generate a corresponding ArrowDown.tsx React component with proper TypeScript types.
Development
To develop locally:
git clone <repository-url>
cd vega
bun install
bun run index.tsThis project was created using bun init in bun v1.2.19. Bun is a fast all-in-one JavaScript runtime.
npm pack --dry-run
