svger-cli 2.0.3 → 2.0.5
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/.svgerconfig.example.json +93 -12
- package/README.md +408 -205
- package/dist/config.js +84 -1
- package/dist/processors/svg-processor.js +8 -6
- package/dist/services/config.js +65 -15
- package/dist/services/svg-service.js +13 -21
- package/dist/types/index.d.ts +72 -20
- package/dist/utils/native.d.ts +3 -2
- package/dist/utils/native.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
|
-
# SVGER-CLI v2.0 - Enterprise SVG Processing Framework
|
|
1
|
+
# SVGER-CLI v2.0.5 - Enterprise SVG Processing Framework
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/svger-cli)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
[](https://www.npmjs.com/package/svger-cli)
|
|
7
7
|
|
|
8
|
-
> **The most advanced, zero-dependency SVG to component converter, now with first-class support for
|
|
8
|
+
> **The most advanced, zero-dependency SVG to component converter, now with first-class support for
|
|
9
|
+
> 8+ UI frameworks. Enjoy enterprise-grade performance, auto-generated exports, and a unified
|
|
10
|
+
> workflow for your entire design system.**
|
|
9
11
|
|
|
10
12
|
## 🆕 **Latest Developer Experience Improvements**
|
|
11
13
|
|
|
14
|
+
### **🔧 Recent Critical Fixes (v2.0.5)**
|
|
15
|
+
|
|
16
|
+
- **🆕 CRITICAL FIX: PascalCase Component Naming**: Fixed issue where files like "ArrowBendDownLeft.svg" were incorrectly converted to "Arrowbenddownleft.tsx" instead of preserving the correct "ArrowBendDownLeft.tsx" format
|
|
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
|
|
28
|
+
|
|
12
29
|
### **Auto-Generated index.ts Exports (Enhanced)**
|
|
13
|
-
|
|
30
|
+
|
|
31
|
+
Automatically generates clean index.ts files with **unified export pattern** for maximum
|
|
32
|
+
flexibility:
|
|
33
|
+
|
|
14
34
|
```typescript
|
|
15
35
|
// Auto-generated in your output directory
|
|
16
36
|
// Named exports for tree-shaking
|
|
@@ -25,6 +45,7 @@ export default { ArrowLeft, ArrowRight };
|
|
|
25
45
|
```
|
|
26
46
|
|
|
27
47
|
**Import flexibility:**
|
|
48
|
+
|
|
28
49
|
```typescript
|
|
29
50
|
// Named imports (tree-shaking friendly)
|
|
30
51
|
import { ArrowLeft, ArrowRight } from './components';
|
|
@@ -38,45 +59,55 @@ const { ArrowLeft } = Icons;
|
|
|
38
59
|
```
|
|
39
60
|
|
|
40
61
|
### **Enhanced Props & Styling**
|
|
62
|
+
|
|
41
63
|
Components now support comprehensive prop interfaces with React.forwardRef:
|
|
64
|
+
|
|
42
65
|
```typescript
|
|
43
66
|
<Icon className="custom-class" style={{ color: 'red' }} size={32} />
|
|
44
67
|
```
|
|
45
68
|
|
|
46
69
|
### **Comprehensive File Protection**
|
|
70
|
+
|
|
47
71
|
Lock files to prevent accidental modifications during builds:
|
|
72
|
+
|
|
48
73
|
```bash
|
|
49
74
|
svger-cli lock ./icons/critical-logo.svg # Protects during all operations
|
|
50
75
|
```
|
|
51
76
|
|
|
52
77
|
## 🚀 **Key Features & Competitive Advantages**
|
|
53
78
|
|
|
54
|
-
| **Feature**
|
|
55
|
-
|
|
56
|
-
| **Dependencies**
|
|
57
|
-
| **Auto-Generated Exports** | ✅ **Full Support**
|
|
58
|
-
| **Framework Support**
|
|
59
|
-
| **Advanced Props**
|
|
60
|
-
| **File Protection**
|
|
61
|
-
| **Performance**
|
|
62
|
-
| **Bundle Size**
|
|
63
|
-
| **Enterprise Features**
|
|
64
|
-
| **TypeScript**
|
|
65
|
-
| **Batch Processing**
|
|
66
|
-
| **Plugin System**
|
|
79
|
+
| **Feature** | **SVGER-CLI v2.0.4** | **SVGR (React)** | **vite-svg-loader (Vue)** | **svelte-svg (Svelte)** | **SVGO** |
|
|
80
|
+
| -------------------------- | -------------------------- | ---------------- | ------------------------- | ----------------------- | ------------------- |
|
|
81
|
+
| **Dependencies** | ✅ **Zero** | ❌ 15+ deps | ❌ 9+ deps | ❌ 7+ deps | ❌ 8+ deps |
|
|
82
|
+
| **Auto-Generated Exports** | ✅ **Full Support** | ❌ Manual | ❌ Manual | ❌ Manual | ❌ N/A |
|
|
83
|
+
| **Framework Support** | ✅ **8+ Frameworks** | ❌ React only | ❌ Vue only | ❌ Svelte only | ❌ N/A |
|
|
84
|
+
| **Advanced Props** | ✅ **Full Support** | ❌ Basic | ❌ Basic | ❌ Basic | ❌ N/A |
|
|
85
|
+
| **File Protection** | ✅ **Lock System** | ❌ None | ❌ None | ❌ None | ❌ None |
|
|
86
|
+
| **Performance** | ✅ **Up to 85% Faster** | Standard | Slow | Standard | Fast (Optimization) |
|
|
87
|
+
| **Bundle Size** | ✅ **~2MB** | ~18.7MB | ~14.2MB | ~11.8MB | ~12.3MB |
|
|
88
|
+
| **Enterprise Features** | ✅ **Full Suite** | ❌ Limited | ❌ None | ❌ None | ❌ None |
|
|
89
|
+
| **TypeScript** | ✅ **Native** | Plugin | Limited | Limited | None |
|
|
90
|
+
| **Batch Processing** | ✅ **Optimized** | Basic | None | None | None |
|
|
91
|
+
| **Plugin System** | ✅ **Extensible** | Limited | None | None | None |
|
|
92
|
+
| **Configuration Schema** | ✅ **28 Options** | ❌ 8 Options | ❌ 4 Options | ❌ 3 Options | ❌ N/A |
|
|
93
|
+
| **Responsive Design** | ✅ **Built-in** | ❌ Manual | ❌ None | ❌ None | ❌ None |
|
|
94
|
+
| **Theme System** | ✅ **Auto Dark/Light** | ❌ Manual | ❌ None | ❌ None | ❌ None |
|
|
95
|
+
| **Error Handling** | ✅ **Advanced Strategies** | ❌ Basic | ❌ Basic | ❌ Basic | ❌ Basic |
|
|
67
96
|
|
|
68
97
|
---
|
|
69
98
|
|
|
70
99
|
## � **Why SVGER-CLI? The Zero-Dependency Advantage**
|
|
71
100
|
|
|
72
|
-
In a landscape cluttered with heavy, single-framework tools, **SVGER-CLI** stands alone. It's
|
|
101
|
+
In a landscape cluttered with heavy, single-framework tools, **SVGER-CLI** stands alone. It's
|
|
102
|
+
engineered from the ground up with a single philosophy: **native, zero-dependency performance**.
|
|
73
103
|
|
|
74
104
|
- **No `node_modules` bloat**: Drastically smaller footprint.
|
|
75
105
|
- **Faster installs**: Perfect for CI/CD and rapid development.
|
|
76
106
|
- **Unmatched security**: No third-party vulnerabilities.
|
|
77
107
|
- **Cross-framework consistency**: The same powerful engine for every framework.
|
|
78
108
|
|
|
79
|
-
This lean approach delivers up to **85% faster processing** and a **90% smaller bundle size**
|
|
109
|
+
This lean approach delivers up to **85% faster processing** and a **90% smaller bundle size**
|
|
110
|
+
compared to alternatives that rely on dozens of transitive dependencies.
|
|
80
111
|
|
|
81
112
|
---
|
|
82
113
|
|
|
@@ -126,7 +157,8 @@ npm install --save-dev svger-cli
|
|
|
126
157
|
|
|
127
158
|
## 🌐 **Multi-Framework Usage Guide**
|
|
128
159
|
|
|
129
|
-
SVGER-CLI brings a unified, powerful experience to every major framework. Select your target with
|
|
160
|
+
SVGER-CLI brings a unified, powerful experience to every major framework. Select your target with
|
|
161
|
+
the `--framework` flag.
|
|
130
162
|
|
|
131
163
|
### **React**
|
|
132
164
|
|
|
@@ -137,6 +169,7 @@ svger-cli build ./my-svgs ./react-components --framework react
|
|
|
137
169
|
```
|
|
138
170
|
|
|
139
171
|
**Generated React Component (`.tsx`):**
|
|
172
|
+
|
|
140
173
|
```tsx
|
|
141
174
|
import * as React from 'react';
|
|
142
175
|
|
|
@@ -146,13 +179,7 @@ interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
|
146
179
|
|
|
147
180
|
const MyIcon: React.FC<IconProps> = React.memo(
|
|
148
181
|
React.forwardRef<SVGSVGElement, IconProps>(({ size = 24, ...props }, ref) => (
|
|
149
|
-
<svg
|
|
150
|
-
ref={ref}
|
|
151
|
-
width={size}
|
|
152
|
-
height={size}
|
|
153
|
-
viewBox="0 0 24 24"
|
|
154
|
-
{...props}
|
|
155
|
-
>
|
|
182
|
+
<svg ref={ref} width={size} height={size} viewBox="0 0 24 24" {...props}>
|
|
156
183
|
{/* SVG content */}
|
|
157
184
|
</svg>
|
|
158
185
|
))
|
|
@@ -175,6 +202,7 @@ svger-cli build ./my-svgs ./vue-components --framework vue
|
|
|
175
202
|
```
|
|
176
203
|
|
|
177
204
|
**Generated Vue Component (`.vue`):**
|
|
205
|
+
|
|
178
206
|
```vue
|
|
179
207
|
<script setup lang="ts">
|
|
180
208
|
import { computed } from 'vue';
|
|
@@ -191,12 +219,7 @@ const sizeValue = computed(() => `${props.size}px`);
|
|
|
191
219
|
</script>
|
|
192
220
|
|
|
193
221
|
<template>
|
|
194
|
-
<svg
|
|
195
|
-
:width="sizeValue"
|
|
196
|
-
:height="sizeValue"
|
|
197
|
-
viewBox="0 0 24 24"
|
|
198
|
-
v-bind="$attrs"
|
|
199
|
-
>
|
|
222
|
+
<svg :width="sizeValue" :height="sizeValue" viewBox="0 0 24 24" v-bind="$attrs">
|
|
200
223
|
{/* SVG content */}
|
|
201
224
|
</svg>
|
|
202
225
|
</template>
|
|
@@ -215,6 +238,7 @@ svger-cli build ./my-svgs ./angular-components --framework angular
|
|
|
215
238
|
```
|
|
216
239
|
|
|
217
240
|
**Generated Angular Component (`.component.ts`):**
|
|
241
|
+
|
|
218
242
|
```typescript
|
|
219
243
|
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
|
|
220
244
|
|
|
@@ -246,19 +270,13 @@ svger-cli build ./my-svgs ./svelte-components --framework svelte
|
|
|
246
270
|
```
|
|
247
271
|
|
|
248
272
|
**Generated Svelte Component (`.svelte`):**
|
|
273
|
+
|
|
249
274
|
```html
|
|
250
275
|
<script lang="ts">
|
|
251
276
|
export let size: number | string = 24;
|
|
252
277
|
</script>
|
|
253
278
|
|
|
254
|
-
<svg
|
|
255
|
-
width={size}
|
|
256
|
-
height={size}
|
|
257
|
-
viewBox="0 0 24 24"
|
|
258
|
-
{...$$restProps}
|
|
259
|
-
>
|
|
260
|
-
{/* SVG content */}
|
|
261
|
-
</svg>
|
|
279
|
+
<svg width="{size}" height="{size}" viewBox="0 0 24 24" {...$$restProps}>{/* SVG content */}</svg>
|
|
262
280
|
```
|
|
263
281
|
|
|
264
282
|
### **Solid**
|
|
@@ -270,6 +288,7 @@ svger-cli build ./my-svgs ./solid-components --framework solid
|
|
|
270
288
|
```
|
|
271
289
|
|
|
272
290
|
**Generated Solid Component (`.tsx`):**
|
|
291
|
+
|
|
273
292
|
```tsx
|
|
274
293
|
import type { Component, JSX } from 'solid-js';
|
|
275
294
|
|
|
@@ -277,14 +296,9 @@ interface IconProps extends JSX.SvgSVGAttributes<SVGSVGElement> {
|
|
|
277
296
|
size?: number | string;
|
|
278
297
|
}
|
|
279
298
|
|
|
280
|
-
const MyIcon: Component<IconProps> =
|
|
299
|
+
const MyIcon: Component<IconProps> = props => {
|
|
281
300
|
return (
|
|
282
|
-
<svg
|
|
283
|
-
width={props.size || 24}
|
|
284
|
-
height={props.size || 24}
|
|
285
|
-
viewBox="0 0 24 24"
|
|
286
|
-
{...props}
|
|
287
|
-
>
|
|
301
|
+
<svg width={props.size || 24} height={props.size || 24} viewBox="0 0 24 24" {...props}>
|
|
288
302
|
{/* SVG content */}
|
|
289
303
|
</svg>
|
|
290
304
|
);
|
|
@@ -302,6 +316,7 @@ svger-cli build ./my-svgs ./lit-components --framework lit
|
|
|
302
316
|
```
|
|
303
317
|
|
|
304
318
|
**Generated Lit Component (`.ts`):**
|
|
319
|
+
|
|
305
320
|
```ts
|
|
306
321
|
import { LitElement, html, svg } from 'lit';
|
|
307
322
|
import { customElement, property } from 'lit/decorators.js';
|
|
@@ -313,11 +328,7 @@ export class MyIcon extends LitElement {
|
|
|
313
328
|
|
|
314
329
|
render() {
|
|
315
330
|
return html`
|
|
316
|
-
<svg
|
|
317
|
-
width=${this.size}
|
|
318
|
-
height=${this.size}
|
|
319
|
-
viewBox="0 0 24 24"
|
|
320
|
-
>
|
|
331
|
+
<svg width=${this.size} height=${this.size} viewBox="0 0 24 24">
|
|
321
332
|
${svg`{/* SVG content */}`}
|
|
322
333
|
</svg>
|
|
323
334
|
`;
|
|
@@ -334,6 +345,7 @@ svger-cli build ./my-svgs ./preact-components --framework preact
|
|
|
334
345
|
```
|
|
335
346
|
|
|
336
347
|
**Generated Preact Component (`.tsx`):**
|
|
348
|
+
|
|
337
349
|
```tsx
|
|
338
350
|
import { h } from 'preact';
|
|
339
351
|
import type { FunctionalComponent } from 'preact';
|
|
@@ -344,12 +356,7 @@ interface IconProps extends h.JSX.SVGAttributes<SVGSVGElement> {
|
|
|
344
356
|
|
|
345
357
|
const MyIcon: FunctionalComponent<IconProps> = ({ size = 24, ...props }) => {
|
|
346
358
|
return (
|
|
347
|
-
<svg
|
|
348
|
-
width={size}
|
|
349
|
-
height={size}
|
|
350
|
-
viewBox="0 0 24 24"
|
|
351
|
-
{...props}
|
|
352
|
-
>
|
|
359
|
+
<svg width={size} height={size} viewBox="0 0 24 24" {...props}>
|
|
353
360
|
{/* SVG content */}
|
|
354
361
|
</svg>
|
|
355
362
|
);
|
|
@@ -367,6 +374,7 @@ svger-cli build ./my-svgs ./vanilla-components --framework vanilla
|
|
|
367
374
|
```
|
|
368
375
|
|
|
369
376
|
**Generated Vanilla Component (`.ts`):**
|
|
377
|
+
|
|
370
378
|
```ts
|
|
371
379
|
interface IconOptions {
|
|
372
380
|
size?: number | string;
|
|
@@ -391,6 +399,7 @@ export function createMyIcon(options: IconOptions = {}): SVGSVGElement {
|
|
|
391
399
|
## 🔧 **Comprehensive CLI Reference**
|
|
392
400
|
|
|
393
401
|
### **1. Initialize Command**
|
|
402
|
+
|
|
394
403
|
Set up SVGER-CLI configuration for your project.
|
|
395
404
|
|
|
396
405
|
```bash
|
|
@@ -398,6 +407,7 @@ svger-cli init [options]
|
|
|
398
407
|
```
|
|
399
408
|
|
|
400
409
|
**Options:**
|
|
410
|
+
|
|
401
411
|
- `--framework <type>` - Target framework (react|vue|svelte|angular|solid|preact|lit|vanilla)
|
|
402
412
|
- `--typescript` - Enable TypeScript generation (default: true)
|
|
403
413
|
- `--src <path>` - Source directory for SVG files (default: ./src/assets/svg)
|
|
@@ -405,6 +415,7 @@ svger-cli init [options]
|
|
|
405
415
|
- `--interactive` - Interactive configuration wizard
|
|
406
416
|
|
|
407
417
|
**Examples:**
|
|
418
|
+
|
|
408
419
|
```bash
|
|
409
420
|
# Initialize with React + TypeScript
|
|
410
421
|
svger-cli init --framework react --typescript
|
|
@@ -417,40 +428,114 @@ svger-cli init --interactive
|
|
|
417
428
|
```
|
|
418
429
|
|
|
419
430
|
**Generated Configuration (`.svgerconfig.json`):**
|
|
431
|
+
|
|
420
432
|
```json
|
|
421
433
|
{
|
|
422
434
|
"source": "./src/assets/svg",
|
|
423
|
-
"output": "./src/components/icons",
|
|
435
|
+
"output": "./src/components/icons",
|
|
424
436
|
"framework": "react",
|
|
425
437
|
"typescript": true,
|
|
438
|
+
"componentType": "functional",
|
|
439
|
+
|
|
426
440
|
"watch": false,
|
|
427
441
|
"parallel": true,
|
|
428
442
|
"batchSize": 10,
|
|
443
|
+
"maxConcurrency": 4,
|
|
444
|
+
"cache": true,
|
|
445
|
+
|
|
429
446
|
"defaultWidth": 24,
|
|
430
447
|
"defaultHeight": 24,
|
|
431
448
|
"defaultFill": "currentColor",
|
|
449
|
+
"defaultStroke": "none",
|
|
450
|
+
"defaultStrokeWidth": 1,
|
|
451
|
+
|
|
432
452
|
"exclude": ["logo.svg"],
|
|
453
|
+
"include": ["icons/**", "illustrations/**"],
|
|
454
|
+
|
|
433
455
|
"styleRules": {
|
|
434
456
|
"fill": "inherit",
|
|
435
|
-
"stroke": "none"
|
|
457
|
+
"stroke": "none",
|
|
458
|
+
"strokeWidth": "1",
|
|
459
|
+
"opacity": "1"
|
|
436
460
|
},
|
|
461
|
+
|
|
437
462
|
"responsive": {
|
|
438
|
-
"breakpoints": ["sm", "md", "lg"],
|
|
463
|
+
"breakpoints": ["sm", "md", "lg", "xl"],
|
|
439
464
|
"values": {
|
|
440
|
-
"width": ["20px", "24px", "32px"]
|
|
465
|
+
"width": ["16px", "20px", "24px", "32px"],
|
|
466
|
+
"height": ["16px", "20px", "24px", "32px"]
|
|
441
467
|
}
|
|
442
468
|
},
|
|
469
|
+
|
|
443
470
|
"theme": {
|
|
444
|
-
"mode": "
|
|
471
|
+
"mode": "auto",
|
|
445
472
|
"variables": {
|
|
446
|
-
"primary": "
|
|
447
|
-
"secondary": "#
|
|
473
|
+
"primary": "currentColor",
|
|
474
|
+
"secondary": "#6b7280",
|
|
475
|
+
"accent": "#3b82f6",
|
|
476
|
+
"background": "#ffffff",
|
|
477
|
+
"foreground": "#000000"
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
|
|
481
|
+
"animations": ["fadeIn", "slideIn", "bounce"],
|
|
482
|
+
|
|
483
|
+
"plugins": [
|
|
484
|
+
{
|
|
485
|
+
"name": "svg-optimizer",
|
|
486
|
+
"options": {
|
|
487
|
+
"removeComments": true,
|
|
488
|
+
"removeMetadata": true
|
|
489
|
+
}
|
|
448
490
|
}
|
|
491
|
+
],
|
|
492
|
+
|
|
493
|
+
"errorHandling": {
|
|
494
|
+
"strategy": "continue",
|
|
495
|
+
"maxRetries": 3,
|
|
496
|
+
"timeout": 30000
|
|
497
|
+
},
|
|
498
|
+
|
|
499
|
+
"performance": {
|
|
500
|
+
"optimization": "balanced",
|
|
501
|
+
"memoryLimit": 512,
|
|
502
|
+
"cacheTimeout": 3600000
|
|
503
|
+
},
|
|
504
|
+
|
|
505
|
+
"outputConfig": {
|
|
506
|
+
"naming": "pascal",
|
|
507
|
+
"extension": "tsx",
|
|
508
|
+
"directory": "./src/components/icons"
|
|
509
|
+
},
|
|
510
|
+
|
|
511
|
+
"react": {
|
|
512
|
+
"componentType": "functional",
|
|
513
|
+
"forwardRef": true,
|
|
514
|
+
"memo": false,
|
|
515
|
+
"propsInterface": "SVGProps",
|
|
516
|
+
"styledComponents": false,
|
|
517
|
+
"cssModules": false
|
|
518
|
+
},
|
|
519
|
+
|
|
520
|
+
"vue": {
|
|
521
|
+
"api": "composition",
|
|
522
|
+
"setup": true,
|
|
523
|
+
"typescript": true,
|
|
524
|
+
"scoped": true,
|
|
525
|
+
"cssVariables": true
|
|
526
|
+
},
|
|
527
|
+
|
|
528
|
+
"angular": {
|
|
529
|
+
"standalone": true,
|
|
530
|
+
"signals": true,
|
|
531
|
+
"changeDetection": "OnPush",
|
|
532
|
+
"encapsulation": "Emulated"
|
|
449
533
|
}
|
|
450
534
|
}
|
|
451
535
|
```
|
|
452
536
|
|
|
453
537
|
### **2. Build Command**
|
|
538
|
+
|
|
454
539
|
Convert SVG files to framework components with advanced processing.
|
|
455
540
|
|
|
456
541
|
```bash
|
|
@@ -458,6 +543,7 @@ svger-cli build [options]
|
|
|
458
543
|
```
|
|
459
544
|
|
|
460
545
|
**Core Options:**
|
|
546
|
+
|
|
461
547
|
- `--src <path>` - Source directory containing SVG files
|
|
462
548
|
- `--out <path>` - Output directory for generated components
|
|
463
549
|
- `--framework <type>` - Target framework for component generation
|
|
@@ -465,6 +551,7 @@ svger-cli build [options]
|
|
|
465
551
|
- `--clean` - Clean output directory before building
|
|
466
552
|
|
|
467
553
|
**Performance Options:**
|
|
554
|
+
|
|
468
555
|
- `--parallel` - Enable parallel processing (default: true)
|
|
469
556
|
- `--batch-size <number>` - Number of files per batch (default: 10)
|
|
470
557
|
- `--max-concurrency <number>` - Maximum concurrent processes (default: CPU cores)
|
|
@@ -472,6 +559,7 @@ svger-cli build [options]
|
|
|
472
559
|
- `--performance` - Display performance metrics
|
|
473
560
|
|
|
474
561
|
**Framework-Specific Options:**
|
|
562
|
+
|
|
475
563
|
- `--composition` - Use Vue Composition API (Vue only)
|
|
476
564
|
- `--setup` - Use Vue script setup syntax (Vue only)
|
|
477
565
|
- `--standalone` - Generate Angular standalone components (Angular only)
|
|
@@ -479,12 +567,14 @@ svger-cli build [options]
|
|
|
479
567
|
- `--forward-ref` - Generate React forwardRef components (React only)
|
|
480
568
|
|
|
481
569
|
**Styling Options:**
|
|
570
|
+
|
|
482
571
|
- `--responsive` - Enable responsive design utilities
|
|
483
572
|
- `--theme <mode>` - Apply theme mode (light|dark|auto)
|
|
484
573
|
- `--styled-components` - Generate styled-components (React/Solid)
|
|
485
574
|
- `--css-modules` - Enable CSS Modules support
|
|
486
575
|
|
|
487
576
|
**Examples:**
|
|
577
|
+
|
|
488
578
|
```bash
|
|
489
579
|
# Basic build
|
|
490
580
|
svger-cli build --src ./icons --out ./components
|
|
@@ -531,6 +621,7 @@ svger-cli build \
|
|
|
531
621
|
```
|
|
532
622
|
|
|
533
623
|
### **3. Watch Command**
|
|
624
|
+
|
|
534
625
|
Monitor directories for SVG changes and auto-generate components.
|
|
535
626
|
|
|
536
627
|
```bash
|
|
@@ -538,12 +629,14 @@ svger-cli watch [options]
|
|
|
538
629
|
```
|
|
539
630
|
|
|
540
631
|
**Options:**
|
|
632
|
+
|
|
541
633
|
- All `build` command options
|
|
542
634
|
- `--debounce <ms>` - Debounce time for file changes (default: 300ms)
|
|
543
635
|
- `--ignore <patterns>` - Ignore file patterns (glob syntax)
|
|
544
636
|
- `--verbose` - Detailed logging of file changes
|
|
545
637
|
|
|
546
638
|
**Examples:**
|
|
639
|
+
|
|
547
640
|
```bash
|
|
548
641
|
# Basic watch mode
|
|
549
642
|
svger-cli watch --src ./icons --out ./components
|
|
@@ -569,6 +662,7 @@ svger-cli watch \
|
|
|
569
662
|
```
|
|
570
663
|
|
|
571
664
|
### **4. Generate Command**
|
|
665
|
+
|
|
572
666
|
Process specific SVG files with precise control.
|
|
573
667
|
|
|
574
668
|
```bash
|
|
@@ -576,14 +670,17 @@ svger-cli generate <input> [options]
|
|
|
576
670
|
```
|
|
577
671
|
|
|
578
672
|
**Arguments:**
|
|
673
|
+
|
|
579
674
|
- `<input>` - SVG file path or glob pattern
|
|
580
675
|
|
|
581
676
|
**Options:**
|
|
677
|
+
|
|
582
678
|
- All `build` command options
|
|
583
679
|
- `--name <string>` - Override component name
|
|
584
680
|
- `--template <type>` - Component template (functional|class|forwardRef|memo)
|
|
585
681
|
|
|
586
682
|
**Examples:**
|
|
683
|
+
|
|
587
684
|
```bash
|
|
588
685
|
# Generate single component
|
|
589
686
|
svger-cli generate ./icons/heart.svg --out ./components --name HeartIcon
|
|
@@ -611,6 +708,7 @@ svger-cli generate ./icons/logo.svg \
|
|
|
611
708
|
```
|
|
612
709
|
|
|
613
710
|
### **5. Lock/Unlock Commands**
|
|
711
|
+
|
|
614
712
|
Manage file protection during batch operations.
|
|
615
713
|
|
|
616
714
|
```bash
|
|
@@ -619,6 +717,7 @@ svger-cli unlock <files...>
|
|
|
619
717
|
```
|
|
620
718
|
|
|
621
719
|
**Examples:**
|
|
720
|
+
|
|
622
721
|
```bash
|
|
623
722
|
# Lock specific files
|
|
624
723
|
svger-cli lock ./icons/logo.svg ./icons/brand.svg
|
|
@@ -634,6 +733,7 @@ svger-cli unlock --all
|
|
|
634
733
|
```
|
|
635
734
|
|
|
636
735
|
### **6. Config Command**
|
|
736
|
+
|
|
637
737
|
Manage project configuration dynamically.
|
|
638
738
|
|
|
639
739
|
```bash
|
|
@@ -641,6 +741,7 @@ svger-cli config [options]
|
|
|
641
741
|
```
|
|
642
742
|
|
|
643
743
|
**Options:**
|
|
744
|
+
|
|
644
745
|
- `--show` - Display current configuration
|
|
645
746
|
- `--set <key=value>` - Set configuration value
|
|
646
747
|
- `--get <key>` - Get specific configuration value
|
|
@@ -648,6 +749,7 @@ svger-cli config [options]
|
|
|
648
749
|
- `--validate` - Validate current configuration
|
|
649
750
|
|
|
650
751
|
**Examples:**
|
|
752
|
+
|
|
651
753
|
```bash
|
|
652
754
|
# Show current config
|
|
653
755
|
svger-cli config --show
|
|
@@ -669,6 +771,7 @@ svger-cli config --validate
|
|
|
669
771
|
```
|
|
670
772
|
|
|
671
773
|
### **7. Clean Command**
|
|
774
|
+
|
|
672
775
|
Remove generated components and clean workspace.
|
|
673
776
|
|
|
674
777
|
```bash
|
|
@@ -676,6 +779,7 @@ svger-cli clean [options]
|
|
|
676
779
|
```
|
|
677
780
|
|
|
678
781
|
**Options:**
|
|
782
|
+
|
|
679
783
|
- `--out <path>` - Output directory to clean
|
|
680
784
|
- `--cache` - Clear processing cache
|
|
681
785
|
- `--logs` - Clear log files
|
|
@@ -683,6 +787,7 @@ svger-cli clean [options]
|
|
|
683
787
|
- `--dry-run` - Preview what would be cleaned
|
|
684
788
|
|
|
685
789
|
**Examples:**
|
|
790
|
+
|
|
686
791
|
```bash
|
|
687
792
|
# Clean output directory
|
|
688
793
|
svger-cli clean --out ./components
|
|
@@ -698,6 +803,7 @@ svger-cli clean --all --dry-run
|
|
|
698
803
|
```
|
|
699
804
|
|
|
700
805
|
### **8. Performance Command**
|
|
806
|
+
|
|
701
807
|
Analyze and optimize processing performance.
|
|
702
808
|
|
|
703
809
|
```bash
|
|
@@ -705,6 +811,7 @@ svger-cli performance [options]
|
|
|
705
811
|
```
|
|
706
812
|
|
|
707
813
|
**Options:**
|
|
814
|
+
|
|
708
815
|
- `--analyze` - Analyze current project performance
|
|
709
816
|
- `--benchmark` - Run performance benchmarks
|
|
710
817
|
- `--memory` - Display memory usage statistics
|
|
@@ -712,6 +819,7 @@ svger-cli performance [options]
|
|
|
712
819
|
- `--optimize` - Apply performance optimizations
|
|
713
820
|
|
|
714
821
|
**Examples:**
|
|
822
|
+
|
|
715
823
|
```bash
|
|
716
824
|
# Analyze performance
|
|
717
825
|
svger-cli performance --analyze
|
|
@@ -734,6 +842,7 @@ svger-cli performance --optimize
|
|
|
734
842
|
## 💻 **Usage Examples: From Simple to Complex**
|
|
735
843
|
|
|
736
844
|
### **🔥 Example 1: Quick Start (Simplest)**
|
|
845
|
+
|
|
737
846
|
Get started in 30 seconds:
|
|
738
847
|
|
|
739
848
|
```bash
|
|
@@ -758,6 +867,7 @@ function App() {
|
|
|
758
867
|
```
|
|
759
868
|
|
|
760
869
|
**What happens:**
|
|
870
|
+
|
|
761
871
|
- ✅ All SVGs in `./my-icons` converted to React components
|
|
762
872
|
- ✅ Auto-generated `index.ts` with clean exports
|
|
763
873
|
- ✅ Components support `className`, `style`, `size` props
|
|
@@ -766,6 +876,7 @@ function App() {
|
|
|
766
876
|
---
|
|
767
877
|
|
|
768
878
|
### **🚀 Example 2: Production Setup (Intermediate)**
|
|
879
|
+
|
|
769
880
|
Professional setup with configuration and optimization:
|
|
770
881
|
|
|
771
882
|
```bash
|
|
@@ -797,6 +908,7 @@ svger-cli watch --debounce 500 --verbose
|
|
|
797
908
|
```
|
|
798
909
|
|
|
799
910
|
**Generated Components:**
|
|
911
|
+
|
|
800
912
|
```typescript
|
|
801
913
|
// Auto-generated: src/components/icons/ArrowLeft.tsx
|
|
802
914
|
import React from 'react';
|
|
@@ -807,8 +919,8 @@ interface ArrowLeftProps extends React.SVGProps<SVGSVGElement> {
|
|
|
807
919
|
|
|
808
920
|
const ArrowLeft = React.forwardRef<SVGSVGElement, ArrowLeftProps>(
|
|
809
921
|
({ size = 24, className, style, ...props }, ref) => {
|
|
810
|
-
const sizeValue = typeof size === 'string'
|
|
811
|
-
? { sm: 16, md: 24, lg: 32 }[size]
|
|
922
|
+
const sizeValue = typeof size === 'string'
|
|
923
|
+
? { sm: 16, md: 24, lg: 32 }[size]
|
|
812
924
|
: size;
|
|
813
925
|
|
|
814
926
|
return (
|
|
@@ -833,6 +945,7 @@ export default ArrowLeft;
|
|
|
833
945
|
```
|
|
834
946
|
|
|
835
947
|
**Auto-generated index.ts:**
|
|
948
|
+
|
|
836
949
|
```typescript
|
|
837
950
|
/**
|
|
838
951
|
* Auto-generated icon exports
|
|
@@ -851,23 +964,24 @@ export default {
|
|
|
851
964
|
```
|
|
852
965
|
|
|
853
966
|
**Usage in App:**
|
|
967
|
+
|
|
854
968
|
```typescript
|
|
855
969
|
import { ArrowLeft, Home, User } from './components/icons';
|
|
856
970
|
|
|
857
971
|
function Navigation() {
|
|
858
972
|
return (
|
|
859
973
|
<nav className="flex items-center space-x-4">
|
|
860
|
-
<ArrowLeft
|
|
861
|
-
size="sm"
|
|
862
|
-
className="text-gray-600 hover:text-gray-900"
|
|
974
|
+
<ArrowLeft
|
|
975
|
+
size="sm"
|
|
976
|
+
className="text-gray-600 hover:text-gray-900"
|
|
863
977
|
onClick={() => history.back()}
|
|
864
978
|
/>
|
|
865
|
-
<Home
|
|
866
|
-
size={28}
|
|
979
|
+
<Home
|
|
980
|
+
size={28}
|
|
867
981
|
style={{ color: 'var(--primary-color)' }}
|
|
868
982
|
/>
|
|
869
|
-
<User
|
|
870
|
-
className="w-6 h-6 text-blue-500"
|
|
983
|
+
<User
|
|
984
|
+
className="w-6 h-6 text-blue-500"
|
|
871
985
|
ref={userIconRef}
|
|
872
986
|
/>
|
|
873
987
|
</nav>
|
|
@@ -878,6 +992,7 @@ function Navigation() {
|
|
|
878
992
|
---
|
|
879
993
|
|
|
880
994
|
### **🏗️ Example 3: Enterprise Multi-Framework (Advanced)**
|
|
995
|
+
|
|
881
996
|
Complete enterprise setup supporting multiple frameworks:
|
|
882
997
|
|
|
883
998
|
```bash
|
|
@@ -931,6 +1046,7 @@ svger-cli build \
|
|
|
931
1046
|
```
|
|
932
1047
|
|
|
933
1048
|
**React Components with Styled Components:**
|
|
1049
|
+
|
|
934
1050
|
```typescript
|
|
935
1051
|
// Generated: react-components/ArrowLeft.tsx
|
|
936
1052
|
import React from 'react';
|
|
@@ -944,24 +1060,24 @@ interface ArrowLeftProps extends React.SVGProps<SVGSVGElement> {
|
|
|
944
1060
|
|
|
945
1061
|
const StyledSVG = styled.svg<ArrowLeftProps>`
|
|
946
1062
|
${({ theme, variant }) => css`
|
|
947
|
-
color: ${theme === 'dark'
|
|
948
|
-
? 'var(--icon-color-dark)'
|
|
1063
|
+
color: ${theme === 'dark'
|
|
1064
|
+
? 'var(--icon-color-dark)'
|
|
949
1065
|
: 'var(--icon-color-light)'};
|
|
950
|
-
|
|
1066
|
+
|
|
951
1067
|
${variant === 'primary' && css`
|
|
952
1068
|
color: var(--primary-color);
|
|
953
1069
|
`}
|
|
954
|
-
|
|
1070
|
+
|
|
955
1071
|
${variant === 'secondary' && css`
|
|
956
1072
|
color: var(--secondary-color);
|
|
957
1073
|
`}
|
|
958
|
-
|
|
1074
|
+
|
|
959
1075
|
${variant === 'accent' && css`
|
|
960
1076
|
color: var(--accent-color);
|
|
961
1077
|
`}
|
|
962
|
-
|
|
1078
|
+
|
|
963
1079
|
transition: all 0.2s ease;
|
|
964
|
-
|
|
1080
|
+
|
|
965
1081
|
&:hover {
|
|
966
1082
|
transform: scale(1.1);
|
|
967
1083
|
}
|
|
@@ -973,9 +1089,9 @@ const ArrowLeft = React.forwardRef<SVGSVGElement, ArrowLeftProps>(
|
|
|
973
1089
|
const sizeMap = {
|
|
974
1090
|
sm: 16, md: 24, lg: 32, xl: 40
|
|
975
1091
|
};
|
|
976
|
-
|
|
1092
|
+
|
|
977
1093
|
const sizeValue = typeof size === 'string' ? sizeMap[size] : size;
|
|
978
|
-
|
|
1094
|
+
|
|
979
1095
|
return (
|
|
980
1096
|
<StyledSVG
|
|
981
1097
|
ref={ref}
|
|
@@ -987,9 +1103,9 @@ const ArrowLeft = React.forwardRef<SVGSVGElement, ArrowLeftProps>(
|
|
|
987
1103
|
theme={theme}
|
|
988
1104
|
{...props}
|
|
989
1105
|
>
|
|
990
|
-
<path
|
|
991
|
-
d="M19 12H5M12 19l-7-7 7-7"
|
|
992
|
-
stroke="currentColor"
|
|
1106
|
+
<path
|
|
1107
|
+
d="M19 12H5M12 19l-7-7 7-7"
|
|
1108
|
+
stroke="currentColor"
|
|
993
1109
|
strokeWidth="2"
|
|
994
1110
|
/>
|
|
995
1111
|
</StyledSVG>
|
|
@@ -1002,6 +1118,7 @@ export default ArrowLeft;
|
|
|
1002
1118
|
```
|
|
1003
1119
|
|
|
1004
1120
|
**Vue Composition API Components:**
|
|
1121
|
+
|
|
1005
1122
|
```vue
|
|
1006
1123
|
<!-- Generated: vue-components/ArrowLeft.vue -->
|
|
1007
1124
|
<script setup lang="ts">
|
|
@@ -1012,7 +1129,7 @@ interface Props {
|
|
|
1012
1129
|
}
|
|
1013
1130
|
|
|
1014
1131
|
const props = withDefaults(defineProps<Props>(), {
|
|
1015
|
-
size: 'md'
|
|
1132
|
+
size: 'md',
|
|
1016
1133
|
});
|
|
1017
1134
|
|
|
1018
1135
|
const sizeValue = computed(() => {
|
|
@@ -1033,11 +1150,7 @@ const sizeValue = computed(() => {
|
|
|
1033
1150
|
:style="style"
|
|
1034
1151
|
v-bind="$attrs"
|
|
1035
1152
|
>
|
|
1036
|
-
<path
|
|
1037
|
-
d="M19 12H5M12 19l-7-7 7-7"
|
|
1038
|
-
stroke="currentColor"
|
|
1039
|
-
stroke-width="2"
|
|
1040
|
-
/>
|
|
1153
|
+
<path d="M19 12H5M12 19l-7-7 7-7" stroke="currentColor" stroke-width="2" />
|
|
1041
1154
|
</svg>
|
|
1042
1155
|
</template>
|
|
1043
1156
|
|
|
@@ -1054,6 +1167,7 @@ svg:hover {
|
|
|
1054
1167
|
```
|
|
1055
1168
|
|
|
1056
1169
|
**Angular Standalone Components:**
|
|
1170
|
+
|
|
1057
1171
|
```typescript
|
|
1058
1172
|
// Generated: angular-components/arrow-left.component.ts
|
|
1059
1173
|
import { Component, Input, signal } from '@angular/core';
|
|
@@ -1072,34 +1186,30 @@ import { CommonModule } from '@angular/common';
|
|
|
1072
1186
|
[class]="className"
|
|
1073
1187
|
[style]="style"
|
|
1074
1188
|
>
|
|
1075
|
-
<path
|
|
1076
|
-
d="M19 12H5M12 19l-7-7 7-7"
|
|
1077
|
-
stroke="currentColor"
|
|
1078
|
-
stroke-width="2"
|
|
1079
|
-
/>
|
|
1189
|
+
<path d="M19 12H5M12 19l-7-7 7-7" stroke="currentColor" stroke-width="2" />
|
|
1080
1190
|
</svg>
|
|
1081
1191
|
`,
|
|
1082
|
-
styles: [
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1192
|
+
styles: [
|
|
1193
|
+
`
|
|
1194
|
+
svg {
|
|
1195
|
+
color: var(--icon-color, currentColor);
|
|
1196
|
+
transition: all 0.2s ease;
|
|
1197
|
+
}
|
|
1198
|
+
svg:hover {
|
|
1199
|
+
transform: scale(1.05);
|
|
1200
|
+
}
|
|
1201
|
+
`,
|
|
1202
|
+
],
|
|
1091
1203
|
})
|
|
1092
1204
|
export class ArrowLeftComponent {
|
|
1093
1205
|
@Input() size: number | 'sm' | 'md' | 'lg' = 'md';
|
|
1094
1206
|
@Input() className: string = '';
|
|
1095
1207
|
@Input() style: Record<string, any> = {};
|
|
1096
|
-
|
|
1208
|
+
|
|
1097
1209
|
private sizeMap = { sm: 16, md: 24, lg: 32 };
|
|
1098
|
-
|
|
1210
|
+
|
|
1099
1211
|
computedSize = signal(() => {
|
|
1100
|
-
return typeof this.size === 'string'
|
|
1101
|
-
? this.sizeMap[this.size]
|
|
1102
|
-
: this.size;
|
|
1212
|
+
return typeof this.size === 'string' ? this.sizeMap[this.size] : this.size;
|
|
1103
1213
|
});
|
|
1104
1214
|
}
|
|
1105
1215
|
```
|
|
@@ -1107,6 +1217,7 @@ export class ArrowLeftComponent {
|
|
|
1107
1217
|
---
|
|
1108
1218
|
|
|
1109
1219
|
### **🔒 Example 4: File Protection & Team Workflows (Advanced)**
|
|
1220
|
+
|
|
1110
1221
|
Protect critical files and manage team workflows:
|
|
1111
1222
|
|
|
1112
1223
|
```bash
|
|
@@ -1133,6 +1244,7 @@ svger-cli status --locked
|
|
|
1133
1244
|
```
|
|
1134
1245
|
|
|
1135
1246
|
**Team Configuration (.svgerconfig.json):**
|
|
1247
|
+
|
|
1136
1248
|
```json
|
|
1137
1249
|
{
|
|
1138
1250
|
"source": "./src/assets/icons",
|
|
@@ -1140,10 +1252,7 @@ svger-cli status --locked
|
|
|
1140
1252
|
"framework": "react",
|
|
1141
1253
|
"typescript": true,
|
|
1142
1254
|
"forwardRef": true,
|
|
1143
|
-
"lockedFiles": [
|
|
1144
|
-
"./src/assets/icons/logo.svg",
|
|
1145
|
-
"./src/assets/icons/brand-mark.svg"
|
|
1146
|
-
],
|
|
1255
|
+
"lockedFiles": ["./src/assets/icons/logo.svg", "./src/assets/icons/brand-mark.svg"],
|
|
1147
1256
|
"teamSettings": {
|
|
1148
1257
|
"requireConfirmation": true,
|
|
1149
1258
|
"lockByDefault": false,
|
|
@@ -1155,6 +1264,7 @@ svger-cli status --locked
|
|
|
1155
1264
|
---
|
|
1156
1265
|
|
|
1157
1266
|
### **⚡ Example 5: Performance Optimization (Expert)**
|
|
1267
|
+
|
|
1158
1268
|
Maximum performance setup for large-scale projects:
|
|
1159
1269
|
|
|
1160
1270
|
```bash
|
|
@@ -1194,6 +1304,7 @@ svger-cli performance --benchmark --compare-with v1.5.0
|
|
|
1194
1304
|
```
|
|
1195
1305
|
|
|
1196
1306
|
**Performance Configuration:**
|
|
1307
|
+
|
|
1197
1308
|
```json
|
|
1198
1309
|
{
|
|
1199
1310
|
"performance": {
|
|
@@ -1217,6 +1328,7 @@ svger-cli performance --benchmark --compare-with v1.5.0
|
|
|
1217
1328
|
```
|
|
1218
1329
|
|
|
1219
1330
|
**Enterprise Usage Patterns:**
|
|
1331
|
+
|
|
1220
1332
|
```typescript
|
|
1221
1333
|
// Large-scale import pattern
|
|
1222
1334
|
import IconLibrary from './components/icons';
|
|
@@ -1225,12 +1337,12 @@ import IconLibrary from './components/icons';
|
|
|
1225
1337
|
const LazyIcon = React.lazy(() => import('./components/icons/SpecificIcon'));
|
|
1226
1338
|
|
|
1227
1339
|
// Tree-shaking friendly imports
|
|
1228
|
-
import {
|
|
1340
|
+
import {
|
|
1229
1341
|
ArrowLeft,
|
|
1230
1342
|
ArrowRight,
|
|
1231
1343
|
Home,
|
|
1232
1344
|
User,
|
|
1233
|
-
Settings
|
|
1345
|
+
Settings
|
|
1234
1346
|
} from './components/icons';
|
|
1235
1347
|
|
|
1236
1348
|
// Dynamic icon loading
|
|
@@ -1245,6 +1357,7 @@ const DynamicIcon = ({ name, ...props }) => {
|
|
|
1245
1357
|
## 🎨 **Advanced Styling & Theming**
|
|
1246
1358
|
|
|
1247
1359
|
### **Responsive Design System**
|
|
1360
|
+
|
|
1248
1361
|
SVGER-CLI includes a comprehensive responsive design system:
|
|
1249
1362
|
|
|
1250
1363
|
```bash
|
|
@@ -1253,6 +1366,7 @@ svger-cli build --responsive --src ./icons --out ./components
|
|
|
1253
1366
|
```
|
|
1254
1367
|
|
|
1255
1368
|
**Configuration:**
|
|
1369
|
+
|
|
1256
1370
|
```json
|
|
1257
1371
|
{
|
|
1258
1372
|
"responsive": {
|
|
@@ -1267,6 +1381,7 @@ svger-cli build --responsive --src ./icons --out ./components
|
|
|
1267
1381
|
```
|
|
1268
1382
|
|
|
1269
1383
|
**Generated React Component:**
|
|
1384
|
+
|
|
1270
1385
|
```tsx
|
|
1271
1386
|
interface ResponsiveIconProps extends React.SVGProps<SVGSVGElement> {
|
|
1272
1387
|
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -1277,14 +1392,19 @@ const ResponsiveIcon: React.FC<ResponsiveIconProps> = ({ size = 'md', ...props }
|
|
|
1277
1392
|
sm: { width: 16, height: 16 },
|
|
1278
1393
|
md: { width: 20, height: 20 },
|
|
1279
1394
|
lg: { width: 24, height: 24 },
|
|
1280
|
-
xl: { width: 32, height: 32 }
|
|
1395
|
+
xl: { width: 32, height: 32 },
|
|
1281
1396
|
};
|
|
1282
|
-
|
|
1283
|
-
return
|
|
1397
|
+
|
|
1398
|
+
return (
|
|
1399
|
+
<svg {...sizeMap[size]} {...props}>
|
|
1400
|
+
...
|
|
1401
|
+
</svg>
|
|
1402
|
+
);
|
|
1284
1403
|
};
|
|
1285
1404
|
```
|
|
1286
1405
|
|
|
1287
1406
|
### **Theme System**
|
|
1407
|
+
|
|
1288
1408
|
Built-in dark/light theme support with CSS variables:
|
|
1289
1409
|
|
|
1290
1410
|
```bash
|
|
@@ -1293,6 +1413,7 @@ svger-cli build --theme dark --src ./icons --out ./components
|
|
|
1293
1413
|
```
|
|
1294
1414
|
|
|
1295
1415
|
**Theme Configuration:**
|
|
1416
|
+
|
|
1296
1417
|
```json
|
|
1297
1418
|
{
|
|
1298
1419
|
"theme": {
|
|
@@ -1307,6 +1428,7 @@ svger-cli build --theme dark --src ./icons --out ./components
|
|
|
1307
1428
|
```
|
|
1308
1429
|
|
|
1309
1430
|
**Generated CSS Variables:**
|
|
1431
|
+
|
|
1310
1432
|
```css
|
|
1311
1433
|
:root {
|
|
1312
1434
|
--icon-primary: #ffffff;
|
|
@@ -1321,6 +1443,7 @@ svger-cli build --theme dark --src ./icons --out ./components
|
|
|
1321
1443
|
```
|
|
1322
1444
|
|
|
1323
1445
|
### **Animation System**
|
|
1446
|
+
|
|
1324
1447
|
Built-in animation utilities:
|
|
1325
1448
|
|
|
1326
1449
|
```bash
|
|
@@ -1329,8 +1452,9 @@ svger-cli build --animations hover,focus --src ./icons --out ./components
|
|
|
1329
1452
|
```
|
|
1330
1453
|
|
|
1331
1454
|
**Available Animations:**
|
|
1455
|
+
|
|
1332
1456
|
- `hover` - Hover state transitions
|
|
1333
|
-
- `focus` - Focus state transitions
|
|
1457
|
+
- `focus` - Focus state transitions
|
|
1334
1458
|
- `spin` - Continuous rotation
|
|
1335
1459
|
- `pulse` - Pulsing opacity
|
|
1336
1460
|
- `bounce` - Bouncing effect
|
|
@@ -1341,6 +1465,7 @@ svger-cli build --animations hover,focus --src ./icons --out ./components
|
|
|
1341
1465
|
## 💻 **Programmatic API**
|
|
1342
1466
|
|
|
1343
1467
|
### **Core API Usage**
|
|
1468
|
+
|
|
1344
1469
|
```typescript
|
|
1345
1470
|
import { SVGER, svgProcessor, frameworkTemplateEngine } from 'svger-cli';
|
|
1346
1471
|
|
|
@@ -1352,24 +1477,21 @@ await SVGER.processBatch(files, { parallel: true, batchSize: 20 });
|
|
|
1352
1477
|
await SVGER.generateFrameworkComponent('IconName', svgContent, {
|
|
1353
1478
|
framework: 'vue',
|
|
1354
1479
|
composition: true,
|
|
1355
|
-
typescript: true
|
|
1480
|
+
typescript: true,
|
|
1356
1481
|
});
|
|
1357
1482
|
|
|
1358
1483
|
// Advanced processing
|
|
1359
|
-
const result = await svgProcessor.processSVGFile(
|
|
1360
|
-
'
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
responsive: true,
|
|
1367
|
-
theme: 'dark'
|
|
1368
|
-
}
|
|
1369
|
-
);
|
|
1484
|
+
const result = await svgProcessor.processSVGFile('./icon.svg', './components/', {
|
|
1485
|
+
framework: 'react',
|
|
1486
|
+
typescript: true,
|
|
1487
|
+
forwardRef: true,
|
|
1488
|
+
responsive: true,
|
|
1489
|
+
theme: 'dark',
|
|
1490
|
+
});
|
|
1370
1491
|
```
|
|
1371
1492
|
|
|
1372
1493
|
### **Performance Engine API**
|
|
1494
|
+
|
|
1373
1495
|
```typescript
|
|
1374
1496
|
import { performanceEngine } from 'svger-cli';
|
|
1375
1497
|
|
|
@@ -1377,7 +1499,7 @@ import { performanceEngine } from 'svger-cli';
|
|
|
1377
1499
|
const results = await performanceEngine.processBatch(files, {
|
|
1378
1500
|
batchSize: 15,
|
|
1379
1501
|
parallel: true,
|
|
1380
|
-
maxConcurrency: 6
|
|
1502
|
+
maxConcurrency: 6,
|
|
1381
1503
|
});
|
|
1382
1504
|
|
|
1383
1505
|
// Memory monitoring
|
|
@@ -1390,6 +1512,7 @@ const optimized = performanceEngine.optimizeSVGContent(svgContent, 'maximum');
|
|
|
1390
1512
|
```
|
|
1391
1513
|
|
|
1392
1514
|
### **Style Compiler API**
|
|
1515
|
+
|
|
1393
1516
|
```typescript
|
|
1394
1517
|
import { styleCompiler } from 'svger-cli';
|
|
1395
1518
|
|
|
@@ -1397,10 +1520,10 @@ import { styleCompiler } from 'svger-cli';
|
|
|
1397
1520
|
const styles = styleCompiler.compileStyles({
|
|
1398
1521
|
responsive: {
|
|
1399
1522
|
width: ['20px', '24px', '32px'],
|
|
1400
|
-
height: ['20px', '24px', '32px']
|
|
1523
|
+
height: ['20px', '24px', '32px'],
|
|
1401
1524
|
},
|
|
1402
1525
|
theme: 'dark',
|
|
1403
|
-
animations: ['hover', 'focus']
|
|
1526
|
+
animations: ['hover', 'focus'],
|
|
1404
1527
|
});
|
|
1405
1528
|
|
|
1406
1529
|
// Generate CSS
|
|
@@ -1408,6 +1531,7 @@ const css = styleCompiler.generateCSS(styles);
|
|
|
1408
1531
|
```
|
|
1409
1532
|
|
|
1410
1533
|
### **Plugin System API**
|
|
1534
|
+
|
|
1411
1535
|
```typescript
|
|
1412
1536
|
import { pluginManager } from 'svger-cli';
|
|
1413
1537
|
|
|
@@ -1419,7 +1543,7 @@ pluginManager.registerPlugin({
|
|
|
1419
1543
|
// Custom SVG processing logic
|
|
1420
1544
|
return processedContent;
|
|
1421
1545
|
},
|
|
1422
|
-
validate: (options?: any) => true
|
|
1546
|
+
validate: (options?: any) => true,
|
|
1423
1547
|
});
|
|
1424
1548
|
|
|
1425
1549
|
// Enable plugin
|
|
@@ -1428,7 +1552,7 @@ pluginManager.enablePlugin('custom-optimizer', { level: 'maximum' });
|
|
|
1428
1552
|
// Process with plugins
|
|
1429
1553
|
const processed = await pluginManager.processContent(svgContent, [
|
|
1430
1554
|
{ name: 'svg-optimizer', options: { level: 'balanced' } },
|
|
1431
|
-
{ name: 'custom-optimizer', options: { level: 'maximum' } }
|
|
1555
|
+
{ name: 'custom-optimizer', options: { level: 'maximum' } },
|
|
1432
1556
|
]);
|
|
1433
1557
|
```
|
|
1434
1558
|
|
|
@@ -1437,83 +1561,135 @@ const processed = await pluginManager.processContent(svgContent, [
|
|
|
1437
1561
|
## 🔧 **Configuration Reference**
|
|
1438
1562
|
|
|
1439
1563
|
### **Complete Configuration Schema**
|
|
1564
|
+
|
|
1565
|
+
All configuration options are now fully implemented and tested:
|
|
1566
|
+
|
|
1440
1567
|
```typescript
|
|
1441
1568
|
interface SVGConfig {
|
|
1442
1569
|
// Source & Output
|
|
1443
|
-
source: string;
|
|
1444
|
-
output: string;
|
|
1445
|
-
|
|
1570
|
+
source: string; // Input directory path
|
|
1571
|
+
output: string; // Output directory path
|
|
1572
|
+
|
|
1446
1573
|
// Framework Configuration
|
|
1447
|
-
framework: FrameworkType;
|
|
1448
|
-
typescript: boolean;
|
|
1449
|
-
componentType: ComponentType;
|
|
1450
|
-
|
|
1574
|
+
framework: FrameworkType; // Target framework
|
|
1575
|
+
typescript: boolean; // Generate TypeScript
|
|
1576
|
+
componentType: ComponentType; // Component pattern
|
|
1577
|
+
|
|
1451
1578
|
// Processing Options
|
|
1452
|
-
watch: boolean;
|
|
1453
|
-
parallel: boolean;
|
|
1454
|
-
batchSize: number;
|
|
1455
|
-
maxConcurrency: number;
|
|
1456
|
-
cache: boolean;
|
|
1457
|
-
|
|
1579
|
+
watch: boolean; // Enable file watching
|
|
1580
|
+
parallel: boolean; // Enable parallel processing
|
|
1581
|
+
batchSize: number; // Batch processing size
|
|
1582
|
+
maxConcurrency: number; // Maximum concurrent processes
|
|
1583
|
+
cache: boolean; // Enable processing cache
|
|
1584
|
+
|
|
1458
1585
|
// Default Properties
|
|
1459
|
-
defaultWidth: number;
|
|
1460
|
-
defaultHeight: number;
|
|
1461
|
-
defaultFill: string;
|
|
1462
|
-
defaultStroke: string;
|
|
1463
|
-
defaultStrokeWidth: number;
|
|
1464
|
-
|
|
1586
|
+
defaultWidth: number; // Default SVG width
|
|
1587
|
+
defaultHeight: number; // Default SVG height
|
|
1588
|
+
defaultFill: string; // Default fill color
|
|
1589
|
+
defaultStroke: string; // Default stroke color
|
|
1590
|
+
defaultStrokeWidth: number; // Default stroke width
|
|
1591
|
+
|
|
1465
1592
|
// Styling Configuration
|
|
1466
|
-
styleRules: {
|
|
1593
|
+
styleRules: {
|
|
1594
|
+
// CSS styling rules
|
|
1467
1595
|
[property: string]: string;
|
|
1468
1596
|
};
|
|
1469
|
-
|
|
1470
|
-
responsive: {
|
|
1597
|
+
|
|
1598
|
+
responsive: {
|
|
1599
|
+
// Responsive design
|
|
1471
1600
|
breakpoints: string[];
|
|
1472
1601
|
values: {
|
|
1473
1602
|
[property: string]: string[];
|
|
1474
1603
|
};
|
|
1475
1604
|
};
|
|
1476
|
-
|
|
1477
|
-
theme: {
|
|
1605
|
+
|
|
1606
|
+
theme: {
|
|
1607
|
+
// Theme configuration
|
|
1478
1608
|
mode: 'light' | 'dark' | 'auto';
|
|
1479
1609
|
variables: {
|
|
1480
1610
|
[name: string]: string;
|
|
1481
1611
|
};
|
|
1482
1612
|
};
|
|
1483
|
-
|
|
1484
|
-
animations: string[];
|
|
1485
|
-
|
|
1613
|
+
|
|
1614
|
+
animations: string[]; // Animation effects
|
|
1615
|
+
|
|
1486
1616
|
// Advanced Options
|
|
1487
|
-
plugins: PluginConfig[];
|
|
1488
|
-
exclude: string[];
|
|
1489
|
-
include: string[];
|
|
1490
|
-
|
|
1617
|
+
plugins: PluginConfig[]; // Plugin configurations
|
|
1618
|
+
exclude: string[]; // Files to exclude
|
|
1619
|
+
include: string[]; // Files to include (overrides exclude)
|
|
1620
|
+
|
|
1491
1621
|
// Error Handling
|
|
1492
1622
|
errorHandling: {
|
|
1493
1623
|
strategy: 'continue' | 'stop' | 'retry';
|
|
1494
1624
|
maxRetries: number;
|
|
1495
1625
|
timeout: number;
|
|
1496
1626
|
};
|
|
1497
|
-
|
|
1627
|
+
|
|
1498
1628
|
// Performance Settings
|
|
1499
1629
|
performance: {
|
|
1500
1630
|
optimization: 'fast' | 'balanced' | 'maximum';
|
|
1501
|
-
memoryLimit: number;
|
|
1502
|
-
cacheTimeout: number;
|
|
1631
|
+
memoryLimit: number; // Memory limit in MB
|
|
1632
|
+
cacheTimeout: number; // Cache timeout in ms
|
|
1503
1633
|
};
|
|
1504
|
-
|
|
1634
|
+
|
|
1505
1635
|
// Output Customization
|
|
1506
|
-
|
|
1636
|
+
outputConfig: {
|
|
1507
1637
|
naming: 'kebab' | 'pascal' | 'camel';
|
|
1508
|
-
extension: string;
|
|
1509
|
-
directory: string;
|
|
1638
|
+
extension: string; // File extension override
|
|
1639
|
+
directory: string; // Output directory structure
|
|
1510
1640
|
};
|
|
1641
|
+
|
|
1642
|
+
// Framework-specific configurations
|
|
1643
|
+
react?: ReactConfig;
|
|
1644
|
+
vue?: VueConfig;
|
|
1645
|
+
angular?: AngularConfig;
|
|
1511
1646
|
}
|
|
1512
1647
|
```
|
|
1513
1648
|
|
|
1649
|
+
**✅ All 28 configuration properties are fully implemented and tested**
|
|
1650
|
+
|
|
1651
|
+
### **Configuration Validation**
|
|
1652
|
+
|
|
1653
|
+
SVGER-CLI includes comprehensive configuration validation to ensure all settings are correct:
|
|
1654
|
+
|
|
1655
|
+
```bash
|
|
1656
|
+
# Validate current configuration
|
|
1657
|
+
svger-cli config --validate
|
|
1658
|
+
|
|
1659
|
+
# Show detailed configuration analysis
|
|
1660
|
+
svger-cli config --show
|
|
1661
|
+
|
|
1662
|
+
# Test configuration with sample files
|
|
1663
|
+
svger-cli build --dry-run --src ./test-svg --out ./test-output
|
|
1664
|
+
```
|
|
1665
|
+
|
|
1666
|
+
**Validation Features:**
|
|
1667
|
+
|
|
1668
|
+
- ✅ **Type Safety**: All configuration options are type-checked
|
|
1669
|
+
- ✅ **Framework Compatibility**: Validates framework-specific options
|
|
1670
|
+
- ✅ **Performance Settings**: Ensures optimal performance configuration
|
|
1671
|
+
- ✅ **Path Validation**: Verifies source and output directories
|
|
1672
|
+
- ✅ **Plugin Validation**: Checks plugin compatibility and options
|
|
1673
|
+
|
|
1674
|
+
### **Example Configuration Files**
|
|
1675
|
+
|
|
1676
|
+
A comprehensive example configuration is included with detailed explanations:
|
|
1677
|
+
|
|
1678
|
+
```bash
|
|
1679
|
+
# Copy example configuration
|
|
1680
|
+
cp .svgerconfig.example.json .svgerconfig.json
|
|
1681
|
+
|
|
1682
|
+
# Initialize with interactive setup
|
|
1683
|
+
svger-cli init --interactive
|
|
1684
|
+
```
|
|
1685
|
+
|
|
1686
|
+
The example file includes all 28 configuration options with documentation and examples for React,
|
|
1687
|
+
Vue, Angular, and other frameworks.
|
|
1688
|
+
|
|
1514
1689
|
### **Framework-Specific Options**
|
|
1515
1690
|
|
|
1516
1691
|
#### **React Configuration**
|
|
1692
|
+
|
|
1517
1693
|
```json
|
|
1518
1694
|
{
|
|
1519
1695
|
"framework": "react",
|
|
@@ -1528,7 +1704,8 @@ interface SVGConfig {
|
|
|
1528
1704
|
}
|
|
1529
1705
|
```
|
|
1530
1706
|
|
|
1531
|
-
#### **Vue Configuration**
|
|
1707
|
+
#### **Vue Configuration**
|
|
1708
|
+
|
|
1532
1709
|
```json
|
|
1533
1710
|
{
|
|
1534
1711
|
"framework": "vue",
|
|
@@ -1543,9 +1720,10 @@ interface SVGConfig {
|
|
|
1543
1720
|
```
|
|
1544
1721
|
|
|
1545
1722
|
#### **Angular Configuration**
|
|
1723
|
+
|
|
1546
1724
|
```json
|
|
1547
1725
|
{
|
|
1548
|
-
"framework": "angular",
|
|
1726
|
+
"framework": "angular",
|
|
1549
1727
|
"angular": {
|
|
1550
1728
|
"standalone": true,
|
|
1551
1729
|
"signals": true,
|
|
@@ -1560,17 +1738,19 @@ interface SVGConfig {
|
|
|
1560
1738
|
## 📊 **Performance Optimization**
|
|
1561
1739
|
|
|
1562
1740
|
### **Benchmarks vs Competitors**
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
|
1566
|
-
|
|
|
1567
|
-
|
|
|
1568
|
-
|
|
|
1569
|
-
|
|
|
1741
|
+
|
|
1742
|
+
| **Operation** | **SVGER v2.0** | **SVGR** | **Improvement** |
|
|
1743
|
+
| ----------------------- | -------------- | -------- | --------------- |
|
|
1744
|
+
| Single file (100KB SVG) | 15ms | 25ms | **40% faster** |
|
|
1745
|
+
| Batch (100 files) | 850ms | 1,450ms | **70% faster** |
|
|
1746
|
+
| Memory (1000 files) | 45MB | 120MB | **62% less** |
|
|
1747
|
+
| Bundle size | 2.1MB | 18.7MB | **89% smaller** |
|
|
1748
|
+
| Startup time | 120ms | 340ms | **65% faster** |
|
|
1570
1749
|
|
|
1571
1750
|
### **Performance Best Practices**
|
|
1572
1751
|
|
|
1573
1752
|
#### **Batch Processing Optimization**
|
|
1753
|
+
|
|
1574
1754
|
```bash
|
|
1575
1755
|
# Optimal batch processing
|
|
1576
1756
|
svger-cli build \
|
|
@@ -1584,6 +1764,7 @@ svger-cli build \
|
|
|
1584
1764
|
```
|
|
1585
1765
|
|
|
1586
1766
|
#### **Memory Management**
|
|
1767
|
+
|
|
1587
1768
|
```typescript
|
|
1588
1769
|
// Monitor memory usage
|
|
1589
1770
|
import { performanceEngine } from 'svger-cli';
|
|
@@ -1598,6 +1779,7 @@ const monitor = setInterval(() => {
|
|
|
1598
1779
|
```
|
|
1599
1780
|
|
|
1600
1781
|
#### **Cache Configuration**
|
|
1782
|
+
|
|
1601
1783
|
```json
|
|
1602
1784
|
{
|
|
1603
1785
|
"performance": {
|
|
@@ -1613,6 +1795,7 @@ const monitor = setInterval(() => {
|
|
|
1613
1795
|
## 🧪 **Testing & Quality Assurance**
|
|
1614
1796
|
|
|
1615
1797
|
### **Component Testing**
|
|
1798
|
+
|
|
1616
1799
|
Generated components include comprehensive testing utilities:
|
|
1617
1800
|
|
|
1618
1801
|
```typescript
|
|
@@ -1626,7 +1809,7 @@ describe('IconName', () => {
|
|
|
1626
1809
|
const svg = screen.getByRole('img', { hidden: true });
|
|
1627
1810
|
expect(svg).toBeInTheDocument();
|
|
1628
1811
|
});
|
|
1629
|
-
|
|
1812
|
+
|
|
1630
1813
|
it('accepts custom props', () => {
|
|
1631
1814
|
render(<IconName width={32} height={32} fill="red" />);
|
|
1632
1815
|
const svg = screen.getByRole('img', { hidden: true });
|
|
@@ -1638,6 +1821,7 @@ describe('IconName', () => {
|
|
|
1638
1821
|
```
|
|
1639
1822
|
|
|
1640
1823
|
### **Integration Testing**
|
|
1824
|
+
|
|
1641
1825
|
```bash
|
|
1642
1826
|
# Run integration tests
|
|
1643
1827
|
npm run test:integration
|
|
@@ -1649,6 +1833,7 @@ npm run test:framework:angular
|
|
|
1649
1833
|
```
|
|
1650
1834
|
|
|
1651
1835
|
### **Performance Testing**
|
|
1836
|
+
|
|
1652
1837
|
```bash
|
|
1653
1838
|
# Run performance benchmarks
|
|
1654
1839
|
svger-cli performance --benchmark
|
|
@@ -1667,6 +1852,7 @@ svger-cli performance --load --files 1000
|
|
|
1667
1852
|
### **CI/CD Integration**
|
|
1668
1853
|
|
|
1669
1854
|
#### **GitHub Actions**
|
|
1855
|
+
|
|
1670
1856
|
```yaml
|
|
1671
1857
|
name: SVG Component Generation
|
|
1672
1858
|
on:
|
|
@@ -1681,10 +1867,10 @@ jobs:
|
|
|
1681
1867
|
- uses: actions/setup-node@v3
|
|
1682
1868
|
with:
|
|
1683
1869
|
node-version: '18'
|
|
1684
|
-
|
|
1870
|
+
|
|
1685
1871
|
- name: Install SVGER-CLI
|
|
1686
|
-
run: npm install -g svger-cli@2.0.
|
|
1687
|
-
|
|
1872
|
+
run: npm install -g svger-cli@2.0.5
|
|
1873
|
+
|
|
1688
1874
|
- name: Generate Components
|
|
1689
1875
|
run: |
|
|
1690
1876
|
svger-cli build \
|
|
@@ -1694,7 +1880,7 @@ jobs:
|
|
|
1694
1880
|
--typescript \
|
|
1695
1881
|
--parallel \
|
|
1696
1882
|
--performance
|
|
1697
|
-
|
|
1883
|
+
|
|
1698
1884
|
- name: Commit Generated Components
|
|
1699
1885
|
run: |
|
|
1700
1886
|
git config --local user.email "action@github.com"
|
|
@@ -1705,15 +1891,16 @@ jobs:
|
|
|
1705
1891
|
```
|
|
1706
1892
|
|
|
1707
1893
|
#### **Jenkins Pipeline**
|
|
1894
|
+
|
|
1708
1895
|
```groovy
|
|
1709
1896
|
pipeline {
|
|
1710
1897
|
agent any
|
|
1711
|
-
|
|
1898
|
+
|
|
1712
1899
|
stages {
|
|
1713
1900
|
stage('Generate SVG Components') {
|
|
1714
1901
|
steps {
|
|
1715
1902
|
sh '''
|
|
1716
|
-
npm install -g svger-cli@2.0.
|
|
1903
|
+
npm install -g svger-cli@2.0.5
|
|
1717
1904
|
svger-cli build \
|
|
1718
1905
|
--src ./assets/svg \
|
|
1719
1906
|
--out ./components \
|
|
@@ -1730,11 +1917,12 @@ pipeline {
|
|
|
1730
1917
|
```
|
|
1731
1918
|
|
|
1732
1919
|
### **Docker Integration**
|
|
1920
|
+
|
|
1733
1921
|
```dockerfile
|
|
1734
1922
|
FROM node:18-alpine
|
|
1735
1923
|
|
|
1736
1924
|
# Install SVGER-CLI globally
|
|
1737
|
-
RUN npm install -g svger-cli@2.0.
|
|
1925
|
+
RUN npm install -g svger-cli@2.0.5
|
|
1738
1926
|
|
|
1739
1927
|
# Set working directory
|
|
1740
1928
|
WORKDIR /app
|
|
@@ -1759,25 +1947,26 @@ COPY src/components ./src/components
|
|
|
1759
1947
|
## 🔌 **Plugin Development**
|
|
1760
1948
|
|
|
1761
1949
|
### **Creating Custom Plugins**
|
|
1950
|
+
|
|
1762
1951
|
```typescript
|
|
1763
1952
|
import { Plugin } from 'svger-cli';
|
|
1764
1953
|
|
|
1765
1954
|
const customOptimizer: Plugin = {
|
|
1766
1955
|
name: 'custom-svg-optimizer',
|
|
1767
1956
|
version: '1.0.0',
|
|
1768
|
-
|
|
1957
|
+
|
|
1769
1958
|
process: async (content: string, options?: any) => {
|
|
1770
1959
|
// Custom SVG processing logic
|
|
1771
1960
|
const optimized = content
|
|
1772
1961
|
.replace(/fill="none"/g, '')
|
|
1773
1962
|
.replace(/stroke="currentColor"/g, 'stroke="inherit"');
|
|
1774
|
-
|
|
1963
|
+
|
|
1775
1964
|
return optimized;
|
|
1776
1965
|
},
|
|
1777
|
-
|
|
1966
|
+
|
|
1778
1967
|
validate: (options?: any) => {
|
|
1779
1968
|
return options && typeof options.level === 'string';
|
|
1780
|
-
}
|
|
1969
|
+
},
|
|
1781
1970
|
};
|
|
1782
1971
|
|
|
1783
1972
|
// Register plugin
|
|
@@ -1786,6 +1975,7 @@ pluginManager.registerPlugin(customOptimizer);
|
|
|
1786
1975
|
```
|
|
1787
1976
|
|
|
1788
1977
|
### **Plugin Configuration**
|
|
1978
|
+
|
|
1789
1979
|
```json
|
|
1790
1980
|
{
|
|
1791
1981
|
"plugins": [
|
|
@@ -1812,6 +2002,7 @@ pluginManager.registerPlugin(customOptimizer);
|
|
|
1812
2002
|
### **Common Issues**
|
|
1813
2003
|
|
|
1814
2004
|
#### **Memory Issues**
|
|
2005
|
+
|
|
1815
2006
|
```bash
|
|
1816
2007
|
# If experiencing memory issues with large batches
|
|
1817
2008
|
svger-cli build \
|
|
@@ -1822,6 +2013,7 @@ svger-cli build \
|
|
|
1822
2013
|
```
|
|
1823
2014
|
|
|
1824
2015
|
#### **Performance Issues**
|
|
2016
|
+
|
|
1825
2017
|
```bash
|
|
1826
2018
|
# Enable performance monitoring
|
|
1827
2019
|
svger-cli performance --analyze
|
|
@@ -1834,6 +2026,7 @@ svger-cli performance --optimize
|
|
|
1834
2026
|
```
|
|
1835
2027
|
|
|
1836
2028
|
#### **TypeScript Errors**
|
|
2029
|
+
|
|
1837
2030
|
```bash
|
|
1838
2031
|
# Validate configuration
|
|
1839
2032
|
svger-cli config --validate
|
|
@@ -1843,6 +2036,7 @@ svger-cli build --typescript --strict
|
|
|
1843
2036
|
```
|
|
1844
2037
|
|
|
1845
2038
|
### **Debugging**
|
|
2039
|
+
|
|
1846
2040
|
```bash
|
|
1847
2041
|
# Enable verbose logging
|
|
1848
2042
|
svger-cli build --verbose --src ./icons --out ./components
|
|
@@ -1859,10 +2053,11 @@ svger-cli build --performance --memory
|
|
|
1859
2053
|
## 📚 **Migration Guide**
|
|
1860
2054
|
|
|
1861
2055
|
### **From SVGR**
|
|
2056
|
+
|
|
1862
2057
|
```bash
|
|
1863
2058
|
# Install SVGER-CLI
|
|
1864
2059
|
npm uninstall @svgr/webpack @svgr/cli
|
|
1865
|
-
npm install -g svger-cli@2.0.
|
|
2060
|
+
npm install -g svger-cli@2.0.5
|
|
1866
2061
|
|
|
1867
2062
|
# Migrate configuration
|
|
1868
2063
|
svger-cli init --framework react --typescript
|
|
@@ -1872,9 +2067,10 @@ svger-cli build --src ./assets --out ./components
|
|
|
1872
2067
|
```
|
|
1873
2068
|
|
|
1874
2069
|
### **From v1.x**
|
|
2070
|
+
|
|
1875
2071
|
```bash
|
|
1876
2072
|
# Upgrade to v2.0
|
|
1877
|
-
npm install -g svger-cli@2.0.
|
|
2073
|
+
npm install -g svger-cli@2.0.5
|
|
1878
2074
|
|
|
1879
2075
|
# Migrate configuration
|
|
1880
2076
|
svger-cli config --migrate
|
|
@@ -1888,37 +2084,44 @@ svger-cli build --framework react --responsive --theme dark
|
|
|
1888
2084
|
## 🤝 **Contributing & Support**
|
|
1889
2085
|
|
|
1890
2086
|
### **Contributing**
|
|
2087
|
+
|
|
1891
2088
|
1. Fork the repository
|
|
1892
2089
|
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
1893
2090
|
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
1894
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
2091
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
1895
2092
|
5. Open a Pull Request
|
|
1896
2093
|
|
|
1897
2094
|
### **Support**
|
|
2095
|
+
|
|
1898
2096
|
- 📧 **Email**: navidrezadoost07@gmail.com
|
|
1899
2097
|
- 🐛 **Issues**: [GitHub Issues](https://github.com/faezemohades/svger-cli/issues)
|
|
1900
2098
|
- 📖 **Documentation**: [docs.svger-cli.com](https://docs.svger-cli.com)
|
|
1901
2099
|
|
|
1902
|
-
|
|
1903
2100
|
---
|
|
1904
2101
|
|
|
1905
2102
|
## 📄 **License & Acknowledgements**
|
|
1906
2103
|
|
|
1907
2104
|
### **License**
|
|
2105
|
+
|
|
1908
2106
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
1909
2107
|
|
|
1910
2108
|
### **Acknowledgements**
|
|
1911
2109
|
|
|
1912
2110
|
This project was developed through the collaborative efforts of:
|
|
1913
2111
|
|
|
1914
|
-
- **🏗️ Architecture Design**: [ADR-001](./docs/ADR-SVG-INTRGRATION-METHODS-001.adr.md) authored by
|
|
1915
|
-
|
|
2112
|
+
- **🏗️ Architecture Design**: [ADR-001](./docs/ADR-SVG-INTRGRATION-METHODS-001.adr.md) authored by
|
|
2113
|
+
**Engineer Navid Rezadoost**
|
|
2114
|
+
- **📋 Technical Requirements**:
|
|
2115
|
+
[TDR-001](https://docs.google.com/document/d/1b04_V01xOvLiSMzuPdaRynANlnt2wYdJ_vjs9MAqtn4/edit?tab=t.0)
|
|
2116
|
+
prepared by **Ehsan Jafari**
|
|
1916
2117
|
- **💻 Implementation**: **Navid Rezadoost** - Faeze Mohades Lead developer and package maintainer
|
|
1917
2118
|
- **🏢 Enterprise Architecture**: SVGER Development Team
|
|
1918
2119
|
|
|
1919
|
-
Their guidance and documentation on SVG integration methods in React, Vue, and other frameworks were
|
|
2120
|
+
Their guidance and documentation on SVG integration methods in React, Vue, and other frameworks were
|
|
2121
|
+
instrumental in shaping the design and functionality of the SVGER-CLI v2.0.
|
|
1920
2122
|
|
|
1921
2123
|
### **Special Thanks**
|
|
2124
|
+
|
|
1922
2125
|
- The open-source community for inspiration and feedback
|
|
1923
2126
|
- Framework maintainers for excellent documentation
|
|
1924
2127
|
- Beta testers who provided valuable insights
|
|
@@ -1926,4 +2129,4 @@ Their guidance and documentation on SVG integration methods in React, Vue, and o
|
|
|
1926
2129
|
|
|
1927
2130
|
---
|
|
1928
2131
|
|
|
1929
|
-
**© 2025 SVGER-CLI Development Team. Built with ❤️ for the developer community.**
|
|
2132
|
+
**© 2025 SVGER-CLI Development Team. Built with ❤️ for the developer community.**
|