svger-cli 2.0.5 → 2.0.7
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.
- package/CHANGELOG.md +84 -4
- package/README.md +252 -44
- package/dist/core/framework-templates.d.ts +1 -0
- package/dist/core/framework-templates.js +88 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,86 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
|
|
6
|
+
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [2.0.7] - 2025-11-20
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Version bump for npm publishing (2.0.6 was already published)
|
|
13
|
+
|
|
14
|
+
## [2.0.6] - 2025-11-20
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **🎉 React Native Support**: Full support for React Native with `react-native-svg`
|
|
19
|
+
- Automatic conversion of SVG elements to React Native SVG components
|
|
20
|
+
- Support for Path, Circle, Rect, Line, Polygon, Polyline, Ellipse, G, Defs, ClipPath, and
|
|
21
|
+
gradient components
|
|
22
|
+
- Proper prop conversion (strokeWidth, strokeLinecap, fillRule, etc.)
|
|
23
|
+
- TypeScript interfaces with SvgProps
|
|
24
|
+
- Size and color prop support
|
|
25
|
+
- ForwardRef implementation for React Native components
|
|
26
|
+
- Enhanced test suite with React Native validation
|
|
27
|
+
- Comprehensive React Native documentation
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Updated framework count from 8 to 9 supported frameworks
|
|
32
|
+
- Enhanced framework template engine to handle React Native SVG transformations
|
|
33
|
+
- Improved package description to include React Native
|
|
34
|
+
- Updated all documentation to reflect React Native support
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- Framework type definitions to include 'react-native'
|
|
39
|
+
- File extension handling for React Native (.tsx)
|
|
40
|
+
- Test validation for react-native-svg imports
|
|
41
|
+
|
|
42
|
+
## [2.0.5] - 2025-11-11
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- **🔧 CRITICAL FIX: PascalCase Component Naming**: Fixed issue where files like
|
|
47
|
+
"ArrowBendDownLeft.svg" were incorrectly converted to "Arrowbenddownleft.tsx" instead of
|
|
48
|
+
preserving the correct "ArrowBendDownLeft.tsx" format
|
|
49
|
+
- Enhanced regex pattern in toPascalCase() to properly detect existing PascalCase names
|
|
50
|
+
- All existing PascalCase filenames now preserved correctly during component generation
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- Updated README.md to v2.0.5 with critical fix details
|
|
55
|
+
- Updated all installation commands to new version
|
|
56
|
+
|
|
57
|
+
## [2.0.4] - 2025-11-11
|
|
58
|
+
|
|
59
|
+
### Added
|
|
60
|
+
|
|
61
|
+
- Complete 28-property configuration schema with React/Vue/Angular specific options
|
|
62
|
+
- Enhanced responsive design support with breakpoint configurations
|
|
63
|
+
- Comprehensive theme system with multiple design systems
|
|
64
|
+
- Advanced performance optimization settings
|
|
65
|
+
- Professional error handling and validation system
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
- TypeScript duplicate export errors in index generation
|
|
70
|
+
- Enhanced toPascalCase to preserve existing PascalCase names
|
|
71
|
+
- Simplified index.ts generation to prevent conflicts
|
|
72
|
+
- Improved configuration validation and error messages
|
|
73
|
+
|
|
74
|
+
### Documentation
|
|
75
|
+
|
|
76
|
+
- Updated README.md with comprehensive v2.0.4 feature documentation
|
|
77
|
+
- Added complete configuration schema documentation
|
|
78
|
+
- Enhanced comparison tables and installation instructions
|
|
79
|
+
- Included recent fixes section with technical details
|
|
7
80
|
|
|
8
81
|
## [2.0.3] - 2024-11-11
|
|
9
82
|
|
|
10
83
|
### Added
|
|
84
|
+
|
|
11
85
|
- Enhanced package.json with comprehensive metadata
|
|
12
86
|
- Professional development tooling configuration
|
|
13
87
|
- Extended TypeScript support and type definitions
|
|
@@ -17,6 +91,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
17
91
|
- Documentation generation scripts
|
|
18
92
|
|
|
19
93
|
### Changed
|
|
94
|
+
|
|
20
95
|
- Improved package description with full feature list
|
|
21
96
|
- Enhanced keywords for better discoverability
|
|
22
97
|
- Updated contributor information with roles
|
|
@@ -24,6 +99,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
24
99
|
- More comprehensive engine requirements
|
|
25
100
|
|
|
26
101
|
### Fixed
|
|
102
|
+
|
|
27
103
|
- Package metadata completeness
|
|
28
104
|
- Export definitions for better tree-shaking
|
|
29
105
|
- Module resolution issues
|
|
@@ -31,6 +107,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
31
107
|
## [2.0.2] - 2024-11-01
|
|
32
108
|
|
|
33
109
|
### Added
|
|
110
|
+
|
|
34
111
|
- Multi-framework support (React, Vue, Angular, Svelte, Solid, Lit, Preact, Vanilla)
|
|
35
112
|
- Auto-generated index.ts exports
|
|
36
113
|
- Responsive design system
|
|
@@ -39,18 +116,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
39
116
|
- Performance optimization engine
|
|
40
117
|
|
|
41
118
|
### Changed
|
|
119
|
+
|
|
42
120
|
- Complete rewrite for enterprise-grade performance
|
|
43
121
|
- Zero-dependency architecture
|
|
44
122
|
- 85% performance improvement over SVGR
|
|
45
123
|
- TypeScript-first approach
|
|
46
124
|
|
|
47
125
|
### Removed
|
|
126
|
+
|
|
48
127
|
- Legacy dependencies
|
|
49
128
|
- Single-framework limitation
|
|
50
129
|
|
|
51
130
|
## [1.x.x] - Legacy Versions
|
|
52
131
|
|
|
53
|
-
Please see the [releases page](https://github.com/faezemohades/svger-cli/releases) for information
|
|
132
|
+
Please see the [releases page](https://github.com/faezemohades/svger-cli/releases) for information
|
|
133
|
+
about 1.x versions.
|
|
54
134
|
|
|
55
135
|
---
|
|
56
136
|
|
|
@@ -61,4 +141,4 @@ Please see the [releases page](https://github.com/faezemohades/svger-cli/release
|
|
|
61
141
|
- **Deprecated** for soon-to-be removed features
|
|
62
142
|
- **Removed** for now removed features
|
|
63
143
|
- **Fixed** for any bug fixes
|
|
64
|
-
- **Security** for vulnerability fixes
|
|
144
|
+
- **Security** for vulnerability fixes
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# SVGER-CLI v2.0.
|
|
1
|
+
# SVGER-CLI v2.0.7 - Enterprise SVG Processing Framework
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/svger-cli)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -6,27 +6,100 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/svger-cli)
|
|
7
7
|
|
|
8
8
|
> **The most advanced, zero-dependency SVG to component converter, now with first-class support for
|
|
9
|
-
>
|
|
10
|
-
> workflow for your entire design system.**
|
|
9
|
+
> 9+ UI frameworks including React Native. Enjoy enterprise-grade performance, auto-generated
|
|
10
|
+
> exports, and a unified workflow for your entire design system.**
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📖 **Table of Contents**
|
|
15
|
+
|
|
16
|
+
### 🚀 **Getting Started**
|
|
17
|
+
|
|
18
|
+
- [📦 Installation](#-installation)
|
|
19
|
+
- [🚀 Quick Start: Your First Conversion](#-quick-start-your-first-conversion)
|
|
20
|
+
- [💡 Why SVGER-CLI?](#-why-svger-cli-the-zero-dependency-advantage)
|
|
21
|
+
|
|
22
|
+
### 📚 **Core Documentation**
|
|
23
|
+
|
|
24
|
+
- [📊 Feature Comparison Matrix](#-feature-comparison-matrix)
|
|
25
|
+
- [🌐 Multi-Framework Usage Guide](#-multi-framework-usage-guide)
|
|
26
|
+
- [React](#react)
|
|
27
|
+
- [React Native](#react-native)
|
|
28
|
+
- [Vue 3](#vue-3)
|
|
29
|
+
- [Angular](#angular)
|
|
30
|
+
- [Svelte](#svelte)
|
|
31
|
+
- [Solid](#solid)
|
|
32
|
+
- [Lit](#lit)
|
|
33
|
+
- [Preact](#preact)
|
|
34
|
+
- [Vanilla JS/TS](#vanilla-jsts)
|
|
35
|
+
- [🔧 Comprehensive CLI Reference](#-comprehensive-cli-reference)
|
|
36
|
+
|
|
37
|
+
### 🎨 **Advanced Features**
|
|
38
|
+
|
|
39
|
+
- [💻 Usage Examples: From Simple to Complex](#-usage-examples-from-simple-to-complex)
|
|
40
|
+
- [🎨 Advanced Styling & Theming](#-advanced-styling--theming)
|
|
41
|
+
- [Responsive Design System](#responsive-design-system)
|
|
42
|
+
- [Theme System](#theme-system)
|
|
43
|
+
- [Animation System](#animation-system)
|
|
44
|
+
- [💻 Programmatic API](#-programmatic-api)
|
|
45
|
+
- [🔧 Configuration Reference](#-configuration-reference)
|
|
46
|
+
|
|
47
|
+
### ⚡ **Performance & Deployment**
|
|
13
48
|
|
|
14
|
-
|
|
49
|
+
- [⚡ Performance Optimization](#-performance-optimization)
|
|
50
|
+
- [Benchmarks vs Competitors](#benchmarks-vs-competitors)
|
|
51
|
+
- [Performance Best Practices](#performance-best-practices)
|
|
52
|
+
- [🚀 Production Deployment](#-production-deployment)
|
|
53
|
+
- [CI/CD Integration](#cicd-integration)
|
|
54
|
+
- [Docker Integration](#docker-integration)
|
|
15
55
|
|
|
16
|
-
|
|
17
|
-
- **✅ Fixed TypeScript Duplicate Export Errors**: Resolved duplicate export issues in
|
|
18
|
-
auto-generated index files
|
|
19
|
-
- **✅ Enhanced PascalCase Preservation**: Improved filename casing preservation (e.g.,
|
|
20
|
-
"ArrowBendDownLeft.svg" → "ArrowBendDownLeft.tsx")
|
|
21
|
-
- **✅ Comprehensive Configuration Schema**: Complete implementation of all promised configuration
|
|
22
|
-
features
|
|
23
|
-
- **✅ Framework-Specific Configuration**: Full React, Vue, and Angular configuration support
|
|
24
|
-
- **✅ Advanced Performance Options**: Parallel processing, caching, and memory optimization
|
|
25
|
-
- **✅ Enhanced Error Handling**: Robust error strategies with retry mechanisms
|
|
26
|
-
- **✅ Responsive Design System**: Built-in responsive breakpoints and values
|
|
27
|
-
- **✅ Theme System Integration**: Light/dark mode with CSS variable support
|
|
56
|
+
### 🧪 **Testing & Quality**
|
|
28
57
|
|
|
29
|
-
|
|
58
|
+
- [🧪 Testing & Quality Assurance](#-testing--quality-assurance)
|
|
59
|
+
- [🔌 Plugin Development](#-plugin-development)
|
|
60
|
+
|
|
61
|
+
### 🆘 **Support & Resources**
|
|
62
|
+
|
|
63
|
+
- [🔍 Troubleshooting & FAQ](#-troubleshooting--faq)
|
|
64
|
+
- [📚 Migration Guide](#-migration-guide)
|
|
65
|
+
- [🤝 Contributing & Support](#-contributing--support)
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## ⚡ **Quick Jump Navigation**
|
|
70
|
+
|
|
71
|
+
**Looking for something specific?**
|
|
72
|
+
|
|
73
|
+
| **I want to...** | **Go to section** |
|
|
74
|
+
| ------------------------------------- | --------------------------------------------------------------- |
|
|
75
|
+
| 🎯 Get started immediately | [Quick Start](#-quick-start-your-first-conversion) |
|
|
76
|
+
| 📦 Install the package | [Installation](#-installation) |
|
|
77
|
+
| 🤔 Understand why SVGER-CLI is better | [Why SVGER-CLI?](#-why-svger-cli-the-zero-dependency-advantage) |
|
|
78
|
+
| ⚡ Compare features with competitors | [Feature Comparison](#-feature-comparison-matrix) |
|
|
79
|
+
| 🚀 Convert SVGs to React components | [React Guide](#react) |
|
|
80
|
+
| � Use with React Native | [React Native Guide](#react-native) |
|
|
81
|
+
| �💚 Use with Vue | [Vue Guide](#vue-3) |
|
|
82
|
+
| 🅰️ Use with Angular | [Angular Guide](#angular) |
|
|
83
|
+
| 🌪️ Use with Svelte | [Svelte Guide](#svelte) |
|
|
84
|
+
| 📖 Learn all CLI commands | [CLI Reference](#-comprehensive-cli-reference) |
|
|
85
|
+
| 💻 Use the programmatic API | [API Reference](#-programmatic-api) |
|
|
86
|
+
| 🎨 Configure styling & theming | [Styling Guide](#-advanced-styling--theming) |
|
|
87
|
+
| ⚡ Optimize performance | [Performance Guide](#-performance-optimization) |
|
|
88
|
+
| 🚀 Deploy to production | [Deployment Guide](#-production-deployment) |
|
|
89
|
+
| 🐳 Use with Docker | [Docker Setup](#docker-integration) |
|
|
90
|
+
| 🧪 Test my components | [Testing Guide](#-testing--quality-assurance) |
|
|
91
|
+
| 🔧 Configure everything | [Configuration Reference](#-configuration-reference) |
|
|
92
|
+
| 🔌 Create custom plugins | [Plugin Development](#-plugin-development) |
|
|
93
|
+
| 🐛 Fix issues | [Troubleshooting](#-troubleshooting--faq) |
|
|
94
|
+
| 📚 Migrate from another tool | [Migration Guide](#-migration-guide) |
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🌟 **Key Features Overview**
|
|
101
|
+
|
|
102
|
+
### **✨ Auto-Generated index.ts Exports (Enhanced)**
|
|
30
103
|
|
|
31
104
|
Automatically generates clean index.ts files with **unified export pattern** for maximum
|
|
32
105
|
flexibility:
|
|
@@ -58,7 +131,7 @@ import Icons from './components';
|
|
|
58
131
|
const { ArrowLeft } = Icons;
|
|
59
132
|
```
|
|
60
133
|
|
|
61
|
-
###
|
|
134
|
+
### **🎯 Enhanced Props & Styling**
|
|
62
135
|
|
|
63
136
|
Components now support comprehensive prop interfaces with React.forwardRef:
|
|
64
137
|
|
|
@@ -66,7 +139,7 @@ Components now support comprehensive prop interfaces with React.forwardRef:
|
|
|
66
139
|
<Icon className="custom-class" style={{ color: 'red' }} size={32} />
|
|
67
140
|
```
|
|
68
141
|
|
|
69
|
-
###
|
|
142
|
+
### **🔒 Comprehensive File Protection**
|
|
70
143
|
|
|
71
144
|
Lock files to prevent accidental modifications during builds:
|
|
72
145
|
|
|
@@ -74,13 +147,16 @@ Lock files to prevent accidental modifications during builds:
|
|
|
74
147
|
svger-cli lock ./icons/critical-logo.svg # Protects during all operations
|
|
75
148
|
```
|
|
76
149
|
|
|
77
|
-
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 📊 **Feature Comparison Matrix**
|
|
78
153
|
|
|
79
|
-
| **Feature** | **SVGER-CLI v2.0.
|
|
154
|
+
| **Feature** | **SVGER-CLI v2.0.7** | **SVGR (React)** | **vite-svg-loader (Vue)** | **svelte-svg (Svelte)** | **SVGO** |
|
|
80
155
|
| -------------------------- | -------------------------- | ---------------- | ------------------------- | ----------------------- | ------------------- |
|
|
81
156
|
| **Dependencies** | ✅ **Zero** | ❌ 15+ deps | ❌ 9+ deps | ❌ 7+ deps | ❌ 8+ deps |
|
|
82
157
|
| **Auto-Generated Exports** | ✅ **Full Support** | ❌ Manual | ❌ Manual | ❌ Manual | ❌ N/A |
|
|
83
|
-
| **Framework Support** | ✅ **
|
|
158
|
+
| **Framework Support** | ✅ **9+ Frameworks** | ❌ React only | ❌ Vue only | ❌ Svelte only | ❌ N/A |
|
|
159
|
+
| **React Native Support** | ✅ **Full Native** | ❌ None | ❌ None | ❌ None | ❌ N/A |
|
|
84
160
|
| **Advanced Props** | ✅ **Full Support** | ❌ Basic | ❌ Basic | ❌ Basic | ❌ N/A |
|
|
85
161
|
| **File Protection** | ✅ **Lock System** | ❌ None | ❌ None | ❌ None | ❌ None |
|
|
86
162
|
| **Performance** | ✅ **Up to 85% Faster** | Standard | Slow | Standard | Fast (Optimization) |
|
|
@@ -189,6 +265,82 @@ MyIcon.displayName = 'MyIcon';
|
|
|
189
265
|
export default MyIcon;
|
|
190
266
|
```
|
|
191
267
|
|
|
268
|
+
### **React Native**
|
|
269
|
+
|
|
270
|
+
Generate optimized React Native components with `react-native-svg` integration.
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
svger-cli build ./my-svgs ./react-native-components --framework react-native
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Generated React Native Component (`.tsx`):**
|
|
277
|
+
|
|
278
|
+
```tsx
|
|
279
|
+
import React from 'react';
|
|
280
|
+
import Svg, {
|
|
281
|
+
Path,
|
|
282
|
+
Circle,
|
|
283
|
+
Rect,
|
|
284
|
+
Line,
|
|
285
|
+
Polygon,
|
|
286
|
+
Polyline,
|
|
287
|
+
Ellipse,
|
|
288
|
+
G,
|
|
289
|
+
Defs,
|
|
290
|
+
ClipPath,
|
|
291
|
+
LinearGradient,
|
|
292
|
+
RadialGradient,
|
|
293
|
+
Stop,
|
|
294
|
+
} from 'react-native-svg';
|
|
295
|
+
import type { SvgProps } from 'react-native-svg';
|
|
296
|
+
|
|
297
|
+
export interface MyIconProps extends SvgProps {
|
|
298
|
+
size?: number | string;
|
|
299
|
+
color?: string;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const MyIcon = React.forwardRef<Svg, MyIconProps>(({ size, color, ...props }, ref) => {
|
|
303
|
+
const dimensions = size
|
|
304
|
+
? { width: size, height: size }
|
|
305
|
+
: {
|
|
306
|
+
width: props.width || 24,
|
|
307
|
+
height: props.height || 24,
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
return (
|
|
311
|
+
<Svg
|
|
312
|
+
ref={ref}
|
|
313
|
+
viewBox="0 0 24 24"
|
|
314
|
+
width={dimensions.width}
|
|
315
|
+
height={dimensions.height}
|
|
316
|
+
fill={color || props.fill || 'currentColor'}
|
|
317
|
+
{...props}
|
|
318
|
+
>
|
|
319
|
+
{/* SVG content automatically converted to React Native SVG components */}
|
|
320
|
+
<Path d="..." />
|
|
321
|
+
</Svg>
|
|
322
|
+
);
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
MyIcon.displayName = 'MyIcon';
|
|
326
|
+
export default MyIcon;
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**Key Features:**
|
|
330
|
+
|
|
331
|
+
- ✅ Automatic conversion of SVG elements to React Native SVG components
|
|
332
|
+
- ✅ Proper prop conversion (strokeWidth, strokeLinecap, fillRule, etc.)
|
|
333
|
+
- ✅ TypeScript support with SvgProps interface
|
|
334
|
+
- ✅ Size and color prop support
|
|
335
|
+
- ✅ ForwardRef implementation for advanced usage
|
|
336
|
+
- ✅ Compatible with `react-native-svg` package
|
|
337
|
+
|
|
338
|
+
**Installation Requirements:**
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
npm install react-native-svg
|
|
342
|
+
```
|
|
343
|
+
|
|
192
344
|
### **Vue 3**
|
|
193
345
|
|
|
194
346
|
Choose between **Composition API** (`--composition`) or **Options API**.
|
|
@@ -398,7 +550,22 @@ export function createMyIcon(options: IconOptions = {}): SVGSVGElement {
|
|
|
398
550
|
|
|
399
551
|
## 🔧 **Comprehensive CLI Reference**
|
|
400
552
|
|
|
401
|
-
###
|
|
553
|
+
### **📋 CLI Commands Overview**
|
|
554
|
+
|
|
555
|
+
| Command | Purpose | Quick Link |
|
|
556
|
+
| ----------------------- | -------------------------- | -------------------------------------- |
|
|
557
|
+
| `svger-cli init` | Setup configuration | [Init](#1-initialize-command) |
|
|
558
|
+
| `svger-cli build` | Convert SVGs to components | [Build](#2-build-command) |
|
|
559
|
+
| `svger-cli watch` | Monitor & auto-generate | [Watch](#3-watch-command) |
|
|
560
|
+
| `svger-cli generate` | Process specific files | [Generate](#4-generate-command) |
|
|
561
|
+
| `svger-cli lock` | Protect files | [Lock/Unlock](#5-lockun lock-commands) |
|
|
562
|
+
| `svger-cli config` | Manage settings | [Config](#6-config-command) |
|
|
563
|
+
| `svger-cli clean` | Remove generated files | [Clean](#7-clean-command) |
|
|
564
|
+
| `svger-cli performance` | Analyze performance | [Performance](#8-performance-command) |
|
|
565
|
+
|
|
566
|
+
---
|
|
567
|
+
|
|
568
|
+
### **1️⃣ Initialize Command**
|
|
402
569
|
|
|
403
570
|
Set up SVGER-CLI configuration for your project.
|
|
404
571
|
|
|
@@ -534,7 +701,7 @@ svger-cli init --interactive
|
|
|
534
701
|
}
|
|
535
702
|
```
|
|
536
703
|
|
|
537
|
-
### **2
|
|
704
|
+
### **2️⃣ Build Command**
|
|
538
705
|
|
|
539
706
|
Convert SVG files to framework components with advanced processing.
|
|
540
707
|
|
|
@@ -620,7 +787,7 @@ svger-cli build \
|
|
|
620
787
|
--optimization maximum
|
|
621
788
|
```
|
|
622
789
|
|
|
623
|
-
### **3
|
|
790
|
+
### **3️⃣ Watch Command**
|
|
624
791
|
|
|
625
792
|
Monitor directories for SVG changes and auto-generate components.
|
|
626
793
|
|
|
@@ -661,7 +828,7 @@ svger-cli watch \
|
|
|
661
828
|
--performance
|
|
662
829
|
```
|
|
663
830
|
|
|
664
|
-
### **4
|
|
831
|
+
### **4️⃣ Generate Command**
|
|
665
832
|
|
|
666
833
|
Process specific SVG files with precise control.
|
|
667
834
|
|
|
@@ -707,7 +874,7 @@ svger-cli generate ./icons/logo.svg \
|
|
|
707
874
|
--theme dark
|
|
708
875
|
```
|
|
709
876
|
|
|
710
|
-
### **5
|
|
877
|
+
### **5️⃣ Lock/Unlock Commands**
|
|
711
878
|
|
|
712
879
|
Manage file protection during batch operations.
|
|
713
880
|
|
|
@@ -732,7 +899,7 @@ svger-cli unlock ./icons/logo.svg
|
|
|
732
899
|
svger-cli unlock --all
|
|
733
900
|
```
|
|
734
901
|
|
|
735
|
-
### **6
|
|
902
|
+
### **6️⃣ Config Command**
|
|
736
903
|
|
|
737
904
|
Manage project configuration dynamically.
|
|
738
905
|
|
|
@@ -770,7 +937,7 @@ svger-cli config --reset
|
|
|
770
937
|
svger-cli config --validate
|
|
771
938
|
```
|
|
772
939
|
|
|
773
|
-
### **7
|
|
940
|
+
### **7️⃣ Clean Command**
|
|
774
941
|
|
|
775
942
|
Remove generated components and clean workspace.
|
|
776
943
|
|
|
@@ -802,7 +969,7 @@ svger-cli clean --all
|
|
|
802
969
|
svger-cli clean --all --dry-run
|
|
803
970
|
```
|
|
804
971
|
|
|
805
|
-
### **8
|
|
972
|
+
### **8️⃣ Performance Command**
|
|
806
973
|
|
|
807
974
|
Analyze and optimize processing performance.
|
|
808
975
|
|
|
@@ -841,7 +1008,19 @@ svger-cli performance --optimize
|
|
|
841
1008
|
|
|
842
1009
|
## 💻 **Usage Examples: From Simple to Complex**
|
|
843
1010
|
|
|
844
|
-
###
|
|
1011
|
+
### **Example Types & Complexity Levels**
|
|
1012
|
+
|
|
1013
|
+
| Complexity | Example | Purpose | Best For |
|
|
1014
|
+
| --------------- | ----------------------------------------------------------------- | ---------------------- | --------------------- |
|
|
1015
|
+
| 🟢 Beginner | [Example 1](#-example-1-quick-start-simplest) | Basic SVG conversion | Getting started |
|
|
1016
|
+
| 🟡 Intermediate | [Example 2](#-example-2-production-setup-intermediate) | Production-ready setup | Small to medium teams |
|
|
1017
|
+
| 🔴 Advanced | [Example 3](#-example-3-enterprise-multi-framework-advanced) | Multi-framework setup | Enterprise projects |
|
|
1018
|
+
| � Expert | [Example 4](#-example-4-file-protection--team-workflows-advanced) | Team collaboration | Large teams |
|
|
1019
|
+
| ⚡ Performance | [Example 5](#-example-5-performance-optimization-expert) | Optimization | Large-scale projects |
|
|
1020
|
+
|
|
1021
|
+
---
|
|
1022
|
+
|
|
1023
|
+
### **🟢 Example 1: Quick Start (Simplest)**
|
|
845
1024
|
|
|
846
1025
|
Get started in 30 seconds:
|
|
847
1026
|
|
|
@@ -875,7 +1054,7 @@ function App() {
|
|
|
875
1054
|
|
|
876
1055
|
---
|
|
877
1056
|
|
|
878
|
-
###
|
|
1057
|
+
### **� Example 2: Production Setup (Intermediate)**
|
|
879
1058
|
|
|
880
1059
|
Professional setup with configuration and optimization:
|
|
881
1060
|
|
|
@@ -991,7 +1170,7 @@ function Navigation() {
|
|
|
991
1170
|
|
|
992
1171
|
---
|
|
993
1172
|
|
|
994
|
-
###
|
|
1173
|
+
### **🔴 Example 3: Enterprise Multi-Framework (Advanced)**
|
|
995
1174
|
|
|
996
1175
|
Complete enterprise setup supporting multiple frameworks:
|
|
997
1176
|
|
|
@@ -1216,7 +1395,7 @@ export class ArrowLeftComponent {
|
|
|
1216
1395
|
|
|
1217
1396
|
---
|
|
1218
1397
|
|
|
1219
|
-
###
|
|
1398
|
+
### **� Example 4: File Protection & Team Workflows (Advanced)**
|
|
1220
1399
|
|
|
1221
1400
|
Protect critical files and manage team workflows:
|
|
1222
1401
|
|
|
@@ -1464,7 +1643,19 @@ svger-cli build --animations hover,focus --src ./icons --out ./components
|
|
|
1464
1643
|
|
|
1465
1644
|
## 💻 **Programmatic API**
|
|
1466
1645
|
|
|
1467
|
-
###
|
|
1646
|
+
### **📡 API Modules Overview**
|
|
1647
|
+
|
|
1648
|
+
| Module | Purpose | Use Case |
|
|
1649
|
+
| ------------------- | ------------------------ | ----------------------- |
|
|
1650
|
+
| `SVGER` | Main entry point | General operations |
|
|
1651
|
+
| `svgProcessor` | SVG file processing | Custom processing |
|
|
1652
|
+
| `performanceEngine` | Performance optimization | Batch operations |
|
|
1653
|
+
| `styleCompiler` | CSS generation | Styling |
|
|
1654
|
+
| `pluginManager` | Plugin system | Extending functionality |
|
|
1655
|
+
|
|
1656
|
+
---
|
|
1657
|
+
|
|
1658
|
+
### **🔌 Core API Usage**
|
|
1468
1659
|
|
|
1469
1660
|
```typescript
|
|
1470
1661
|
import { SVGER, svgProcessor, frameworkTemplateEngine } from 'svger-cli';
|
|
@@ -1490,7 +1681,7 @@ const result = await svgProcessor.processSVGFile('./icon.svg', './components/',
|
|
|
1490
1681
|
});
|
|
1491
1682
|
```
|
|
1492
1683
|
|
|
1493
|
-
###
|
|
1684
|
+
### **⚡ Performance Engine API**
|
|
1494
1685
|
|
|
1495
1686
|
```typescript
|
|
1496
1687
|
import { performanceEngine } from 'svger-cli';
|
|
@@ -1511,7 +1702,7 @@ console.log(`Recommendations:`, metrics.recommendations);
|
|
|
1511
1702
|
const optimized = performanceEngine.optimizeSVGContent(svgContent, 'maximum');
|
|
1512
1703
|
```
|
|
1513
1704
|
|
|
1514
|
-
###
|
|
1705
|
+
### **🎨 Style Compiler API**
|
|
1515
1706
|
|
|
1516
1707
|
```typescript
|
|
1517
1708
|
import { styleCompiler } from 'svger-cli';
|
|
@@ -1530,7 +1721,7 @@ const styles = styleCompiler.compileStyles({
|
|
|
1530
1721
|
const css = styleCompiler.generateCSS(styles);
|
|
1531
1722
|
```
|
|
1532
1723
|
|
|
1533
|
-
###
|
|
1724
|
+
### **🔧 Plugin System API**
|
|
1534
1725
|
|
|
1535
1726
|
```typescript
|
|
1536
1727
|
import { pluginManager } from 'svger-cli';
|
|
@@ -1560,6 +1751,23 @@ const processed = await pluginManager.processContent(svgContent, [
|
|
|
1560
1751
|
|
|
1561
1752
|
## 🔧 **Configuration Reference**
|
|
1562
1753
|
|
|
1754
|
+
### **📝 Configuration Sections Quick Links**
|
|
1755
|
+
|
|
1756
|
+
| Section | Options | Purpose |
|
|
1757
|
+
| ------------------------------------------------- | ------------------------------- | ------------------ |
|
|
1758
|
+
| [Source & Output](#complete-configuration-schema) | `source`, `output` | Paths |
|
|
1759
|
+
| [Framework](#complete-configuration-schema) | `framework`, `typescript` | Framework choice |
|
|
1760
|
+
| [Processing](#complete-configuration-schema) | `parallel`, `batchSize` | Performance |
|
|
1761
|
+
| [Defaults](#complete-configuration-schema) | `defaultWidth`, `defaultHeight` | Defaults |
|
|
1762
|
+
| [Styling](#complete-configuration-schema) | `styleRules`, `responsive` | Styling |
|
|
1763
|
+
| [Theme](#complete-configuration-schema) | `theme`, `variables` | Theme system |
|
|
1764
|
+
| [Error Handling](#complete-configuration-schema) | `strategy`, `maxRetries` | Error handling |
|
|
1765
|
+
| [Performance](#complete-configuration-schema) | `optimization`, `memoryLimit` | Performance tuning |
|
|
1766
|
+
| [Output](#complete-configuration-schema) | `naming`, `extension` | Output format |
|
|
1767
|
+
| [Framework-Specific](#framework-specific-options) | `react`, `vue`, `angular` | Framework options |
|
|
1768
|
+
|
|
1769
|
+
---
|
|
1770
|
+
|
|
1563
1771
|
### **Complete Configuration Schema**
|
|
1564
1772
|
|
|
1565
1773
|
All configuration options are now fully implemented and tested:
|
|
@@ -1869,7 +2077,7 @@ jobs:
|
|
|
1869
2077
|
node-version: '18'
|
|
1870
2078
|
|
|
1871
2079
|
- name: Install SVGER-CLI
|
|
1872
|
-
run: npm install -g svger-cli@2.0.
|
|
2080
|
+
run: npm install -g svger-cli@2.0.7
|
|
1873
2081
|
|
|
1874
2082
|
- name: Generate Components
|
|
1875
2083
|
run: |
|
|
@@ -1900,7 +2108,7 @@ pipeline {
|
|
|
1900
2108
|
stage('Generate SVG Components') {
|
|
1901
2109
|
steps {
|
|
1902
2110
|
sh '''
|
|
1903
|
-
npm install -g svger-cli@2.0.
|
|
2111
|
+
npm install -g svger-cli@2.0.7
|
|
1904
2112
|
svger-cli build \
|
|
1905
2113
|
--src ./assets/svg \
|
|
1906
2114
|
--out ./components \
|
|
@@ -1922,7 +2130,7 @@ pipeline {
|
|
|
1922
2130
|
FROM node:18-alpine
|
|
1923
2131
|
|
|
1924
2132
|
# Install SVGER-CLI globally
|
|
1925
|
-
RUN npm install -g svger-cli@2.0.
|
|
2133
|
+
RUN npm install -g svger-cli@2.0.7
|
|
1926
2134
|
|
|
1927
2135
|
# Set working directory
|
|
1928
2136
|
WORKDIR /app
|
|
@@ -2057,7 +2265,7 @@ svger-cli build --performance --memory
|
|
|
2057
2265
|
```bash
|
|
2058
2266
|
# Install SVGER-CLI
|
|
2059
2267
|
npm uninstall @svgr/webpack @svgr/cli
|
|
2060
|
-
npm install -g svger-cli@2.0.
|
|
2268
|
+
npm install -g svger-cli@2.0.7
|
|
2061
2269
|
|
|
2062
2270
|
# Migrate configuration
|
|
2063
2271
|
svger-cli init --framework react --typescript
|
|
@@ -2070,7 +2278,7 @@ svger-cli build --src ./assets --out ./components
|
|
|
2070
2278
|
|
|
2071
2279
|
```bash
|
|
2072
2280
|
# Upgrade to v2.0
|
|
2073
|
-
npm install -g svger-cli@2.0.
|
|
2281
|
+
npm install -g svger-cli@2.0.7
|
|
2074
2282
|
|
|
2075
2283
|
# Migrate configuration
|
|
2076
2284
|
svger-cli config --migrate
|
|
@@ -5,6 +5,7 @@ export declare class FrameworkTemplateEngine {
|
|
|
5
5
|
getFileExtension(framework: FrameworkType, typescript?: boolean): string;
|
|
6
6
|
private parseSVG;
|
|
7
7
|
private generateReactComponent;
|
|
8
|
+
private generateReactNativeComponent;
|
|
8
9
|
private generateVueComponent;
|
|
9
10
|
private generateSvelteComponent;
|
|
10
11
|
private generateAngularComponent;
|
|
@@ -4,6 +4,8 @@ export class FrameworkTemplateEngine {
|
|
|
4
4
|
switch (framework) {
|
|
5
5
|
case 'react':
|
|
6
6
|
return this.generateReactComponent(componentName, svgContent, typescript, frameworkOptions);
|
|
7
|
+
case 'react-native':
|
|
8
|
+
return this.generateReactNativeComponent(componentName, svgContent, typescript, frameworkOptions);
|
|
7
9
|
case 'vue':
|
|
8
10
|
return this.generateVueComponent(componentName, svgContent, typescript, frameworkOptions);
|
|
9
11
|
case 'svelte':
|
|
@@ -26,6 +28,7 @@ export class FrameworkTemplateEngine {
|
|
|
26
28
|
const tsExt = typescript ? 'ts' : 'js';
|
|
27
29
|
switch (framework) {
|
|
28
30
|
case 'react':
|
|
31
|
+
case 'react-native':
|
|
29
32
|
case 'preact':
|
|
30
33
|
case 'solid':
|
|
31
34
|
return typescript ? 'tsx' : 'jsx';
|
|
@@ -93,6 +96,91 @@ const ${componentName} = React.forwardRef<SVGSVGElement, ${componentName}Props>(
|
|
|
93
96
|
|
|
94
97
|
${componentName}.displayName = "${componentName}";
|
|
95
98
|
|
|
99
|
+
export default ${componentName};
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
generateReactNativeComponent(componentName, svgContent, typescript, options) {
|
|
103
|
+
const { attributes, innerContent } = this.parseSVG(svgContent);
|
|
104
|
+
// Convert SVG elements to React Native SVG components
|
|
105
|
+
const convertedContent = innerContent
|
|
106
|
+
.replace(/<path/g, '<Path')
|
|
107
|
+
.replace(/<\/path>/g, '</Path>')
|
|
108
|
+
.replace(/<circle/g, '<Circle')
|
|
109
|
+
.replace(/<\/circle>/g, '</Circle>')
|
|
110
|
+
.replace(/<rect/g, '<Rect')
|
|
111
|
+
.replace(/<\/rect>/g, '</Rect>')
|
|
112
|
+
.replace(/<line/g, '<Line')
|
|
113
|
+
.replace(/<\/line>/g, '</Line>')
|
|
114
|
+
.replace(/<polygon/g, '<Polygon')
|
|
115
|
+
.replace(/<\/polygon>/g, '</Polygon>')
|
|
116
|
+
.replace(/<polyline/g, '<Polyline')
|
|
117
|
+
.replace(/<\/polyline>/g, '</Polyline>')
|
|
118
|
+
.replace(/<ellipse/g, '<Ellipse')
|
|
119
|
+
.replace(/<\/ellipse>/g, '</Ellipse>')
|
|
120
|
+
.replace(/<g>/g, '<G>')
|
|
121
|
+
.replace(/<\/g>/g, '</G>')
|
|
122
|
+
.replace(/<defs>/g, '<Defs>')
|
|
123
|
+
.replace(/<\/defs>/g, '</Defs>')
|
|
124
|
+
.replace(/<clipPath/g, '<ClipPath')
|
|
125
|
+
.replace(/<\/clipPath>/g, '</ClipPath>')
|
|
126
|
+
.replace(/<linearGradient/g, '<LinearGradient')
|
|
127
|
+
.replace(/<\/linearGradient>/g, '</LinearGradient>')
|
|
128
|
+
.replace(/<radialGradient/g, '<RadialGradient')
|
|
129
|
+
.replace(/<\/radialGradient>/g, '</RadialGradient>')
|
|
130
|
+
.replace(/<stop/g, '<Stop')
|
|
131
|
+
.replace(/<\/stop>/g, '</Stop>')
|
|
132
|
+
.replace(/stroke-width=/g, 'strokeWidth=')
|
|
133
|
+
.replace(/stroke-linecap=/g, 'strokeLinecap=')
|
|
134
|
+
.replace(/stroke-linejoin=/g, 'strokeLinejoin=')
|
|
135
|
+
.replace(/fill-rule=/g, 'fillRule=')
|
|
136
|
+
.replace(/clip-rule=/g, 'clipRule=');
|
|
137
|
+
return `import React from "react";
|
|
138
|
+
import Svg, {
|
|
139
|
+
Path,
|
|
140
|
+
Circle,
|
|
141
|
+
Rect,
|
|
142
|
+
Line,
|
|
143
|
+
Polygon,
|
|
144
|
+
Polyline,
|
|
145
|
+
Ellipse,
|
|
146
|
+
G,
|
|
147
|
+
Defs,
|
|
148
|
+
ClipPath,
|
|
149
|
+
LinearGradient,
|
|
150
|
+
RadialGradient,
|
|
151
|
+
Stop,
|
|
152
|
+
} from "react-native-svg";
|
|
153
|
+
import type { SvgProps } from "react-native-svg";
|
|
154
|
+
|
|
155
|
+
export interface ${componentName}Props extends SvgProps {
|
|
156
|
+
size?: number | string;
|
|
157
|
+
color?: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const ${componentName} = React.forwardRef<Svg, ${componentName}Props>(
|
|
161
|
+
({ size, color, ...props }, ref) => {
|
|
162
|
+
const dimensions = size ? { width: size, height: size } : {
|
|
163
|
+
width: props.width || ${attributes.width || 24},
|
|
164
|
+
height: props.height || ${attributes.height || 24}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<Svg
|
|
169
|
+
ref={ref}
|
|
170
|
+
viewBox="${attributes.viewBox || '0 0 24 24'}"
|
|
171
|
+
width={dimensions.width}
|
|
172
|
+
height={dimensions.height}
|
|
173
|
+
fill={color || props.fill || "${attributes.fill || 'currentColor'}"}
|
|
174
|
+
{...props}
|
|
175
|
+
>
|
|
176
|
+
${convertedContent}
|
|
177
|
+
</Svg>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
${componentName}.displayName = "${componentName}";
|
|
183
|
+
|
|
96
184
|
export default ${componentName};
|
|
97
185
|
`;
|
|
98
186
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type definitions for svger-cli
|
|
3
3
|
*/
|
|
4
|
-
export type FrameworkType = 'react' | 'vue' | 'svelte' | 'angular' | 'solid' | 'preact' | 'lit' | 'vanilla';
|
|
4
|
+
export type FrameworkType = 'react' | 'react-native' | 'vue' | 'svelte' | 'angular' | 'solid' | 'preact' | 'lit' | 'vanilla';
|
|
5
5
|
export type NamingConvention = 'kebab' | 'pascal' | 'camel';
|
|
6
6
|
export type ComponentType = 'functional' | 'class' | 'arrow';
|
|
7
7
|
export type ErrorHandlingStrategy = 'continue' | 'stop' | 'retry';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svger-cli",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "Enterprise-grade, zero-dependency SVG to component converter supporting React, Vue, Angular, Svelte, Solid, Lit, Preact & Vanilla. Features auto-generated TypeScript exports, responsive design, themes, performance optimization & 85% faster processing than SVGR.",
|
|
3
|
+
"version": "2.0.7",
|
|
4
|
+
"description": "Enterprise-grade, zero-dependency SVG to component converter supporting React, React Native, Vue, Angular, Svelte, Solid, Lit, Preact & Vanilla. Features auto-generated TypeScript exports, responsive design, themes, performance optimization & 85% faster processing than SVGR.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|