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