svger-cli 2.0.2 → 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 +119 -0
- package/CHANGELOG.md +64 -0
- package/DEVELOPMENT.md +353 -0
- package/README.md +430 -209
- package/SECURITY.md +69 -0
- package/dist/builder.js +16 -16
- package/dist/clean.js +2 -2
- package/dist/cli.js +38 -38
- package/dist/config.js +95 -12
- package/dist/core/error-handler.js +12 -9
- package/dist/core/framework-templates.js +5 -3
- package/dist/core/performance-engine.js +9 -8
- package/dist/core/plugin-manager.js +7 -5
- package/dist/core/style-compiler.js +17 -15
- package/dist/core/template-manager.js +14 -14
- package/dist/index.d.ts +8 -6
- package/dist/index.js +5 -5
- package/dist/lock.js +7 -7
- package/dist/processors/svg-processor.d.ts +9 -3
- package/dist/processors/svg-processor.js +56 -18
- package/dist/services/config.js +72 -20
- package/dist/services/file-watcher.js +3 -3
- package/dist/services/svg-service.js +34 -30
- package/dist/templates/ComponentTemplate.js +25 -25
- package/dist/types/index.d.ts +77 -19
- package/dist/utils/native.d.ts +32 -1
- package/dist/utils/native.js +47 -8
- package/dist/watch.d.ts +1 -1
- package/dist/watch.js +14 -14
- package/docs/ADR-SVG-INTRGRATION-METHODS-001.adr.md +157 -0
- package/docs/ADR-SVG-INTRGRATION-METHODS-002.adr.md +550 -0
- package/docs/FRAMEWORK-GUIDE.md +768 -0
- package/docs/IMPLEMENTATION-SUMMARY.md +376 -0
- package/docs/TDR-SVG-INTRGRATION-METHODS-001.tdr.md +115 -0
- package/package.json +155 -14
package/README.md
CHANGED
|
@@ -1,63 +1,112 @@
|
|
|
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
|
|
|
12
|
-
###
|
|
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
|
+
|
|
28
|
+
### **Auto-Generated index.ts Exports (Enhanced)**
|
|
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
|
-
|
|
17
|
-
export {
|
|
18
|
-
|
|
35
|
+
// Named exports for tree-shaking
|
|
36
|
+
export { default as ArrowLeft } from './ArrowLeft';
|
|
37
|
+
export { default as ArrowRight } from './ArrowRight';
|
|
38
|
+
|
|
39
|
+
// Grouped named exports
|
|
40
|
+
export { ArrowLeft, ArrowRight };
|
|
41
|
+
|
|
42
|
+
// Default export for convenience
|
|
43
|
+
export default { ArrowLeft, ArrowRight };
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Import flexibility:**
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Named imports (tree-shaking friendly)
|
|
50
|
+
import { ArrowLeft, ArrowRight } from './components';
|
|
51
|
+
|
|
52
|
+
// Namespace import
|
|
53
|
+
import * as Icons from './components';
|
|
54
|
+
|
|
55
|
+
// Default import
|
|
56
|
+
import Icons from './components';
|
|
57
|
+
const { ArrowLeft } = Icons;
|
|
19
58
|
```
|
|
20
59
|
|
|
21
60
|
### **Enhanced Props & Styling**
|
|
61
|
+
|
|
22
62
|
Components now support comprehensive prop interfaces with React.forwardRef:
|
|
63
|
+
|
|
23
64
|
```typescript
|
|
24
65
|
<Icon className="custom-class" style={{ color: 'red' }} size={32} />
|
|
25
66
|
```
|
|
26
67
|
|
|
27
68
|
### **Comprehensive File Protection**
|
|
69
|
+
|
|
28
70
|
Lock files to prevent accidental modifications during builds:
|
|
71
|
+
|
|
29
72
|
```bash
|
|
30
73
|
svger-cli lock ./icons/critical-logo.svg # Protects during all operations
|
|
31
74
|
```
|
|
32
75
|
|
|
33
76
|
## 🚀 **Key Features & Competitive Advantages**
|
|
34
77
|
|
|
35
|
-
| **Feature**
|
|
36
|
-
|
|
37
|
-
| **Dependencies**
|
|
38
|
-
| **Auto-Generated Exports** | ✅ **Full Support**
|
|
39
|
-
| **Framework Support**
|
|
40
|
-
| **Advanced Props**
|
|
41
|
-
| **File Protection**
|
|
42
|
-
| **Performance**
|
|
43
|
-
| **Bundle Size**
|
|
44
|
-
| **Enterprise Features**
|
|
45
|
-
| **TypeScript**
|
|
46
|
-
| **Batch Processing**
|
|
47
|
-
| **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 |
|
|
48
95
|
|
|
49
96
|
---
|
|
50
97
|
|
|
51
98
|
## � **Why SVGER-CLI? The Zero-Dependency Advantage**
|
|
52
99
|
|
|
53
|
-
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**.
|
|
54
102
|
|
|
55
103
|
- **No `node_modules` bloat**: Drastically smaller footprint.
|
|
56
104
|
- **Faster installs**: Perfect for CI/CD and rapid development.
|
|
57
105
|
- **Unmatched security**: No third-party vulnerabilities.
|
|
58
106
|
- **Cross-framework consistency**: The same powerful engine for every framework.
|
|
59
107
|
|
|
60
|
-
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.
|
|
61
110
|
|
|
62
111
|
---
|
|
63
112
|
|
|
@@ -107,7 +156,8 @@ npm install --save-dev svger-cli
|
|
|
107
156
|
|
|
108
157
|
## 🌐 **Multi-Framework Usage Guide**
|
|
109
158
|
|
|
110
|
-
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.
|
|
111
161
|
|
|
112
162
|
### **React**
|
|
113
163
|
|
|
@@ -118,6 +168,7 @@ svger-cli build ./my-svgs ./react-components --framework react
|
|
|
118
168
|
```
|
|
119
169
|
|
|
120
170
|
**Generated React Component (`.tsx`):**
|
|
171
|
+
|
|
121
172
|
```tsx
|
|
122
173
|
import * as React from 'react';
|
|
123
174
|
|
|
@@ -127,13 +178,7 @@ interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
|
127
178
|
|
|
128
179
|
const MyIcon: React.FC<IconProps> = React.memo(
|
|
129
180
|
React.forwardRef<SVGSVGElement, IconProps>(({ size = 24, ...props }, ref) => (
|
|
130
|
-
<svg
|
|
131
|
-
ref={ref}
|
|
132
|
-
width={size}
|
|
133
|
-
height={size}
|
|
134
|
-
viewBox="0 0 24 24"
|
|
135
|
-
{...props}
|
|
136
|
-
>
|
|
181
|
+
<svg ref={ref} width={size} height={size} viewBox="0 0 24 24" {...props}>
|
|
137
182
|
{/* SVG content */}
|
|
138
183
|
</svg>
|
|
139
184
|
))
|
|
@@ -156,6 +201,7 @@ svger-cli build ./my-svgs ./vue-components --framework vue
|
|
|
156
201
|
```
|
|
157
202
|
|
|
158
203
|
**Generated Vue Component (`.vue`):**
|
|
204
|
+
|
|
159
205
|
```vue
|
|
160
206
|
<script setup lang="ts">
|
|
161
207
|
import { computed } from 'vue';
|
|
@@ -172,12 +218,7 @@ const sizeValue = computed(() => `${props.size}px`);
|
|
|
172
218
|
</script>
|
|
173
219
|
|
|
174
220
|
<template>
|
|
175
|
-
<svg
|
|
176
|
-
:width="sizeValue"
|
|
177
|
-
:height="sizeValue"
|
|
178
|
-
viewBox="0 0 24 24"
|
|
179
|
-
v-bind="$attrs"
|
|
180
|
-
>
|
|
221
|
+
<svg :width="sizeValue" :height="sizeValue" viewBox="0 0 24 24" v-bind="$attrs">
|
|
181
222
|
{/* SVG content */}
|
|
182
223
|
</svg>
|
|
183
224
|
</template>
|
|
@@ -196,6 +237,7 @@ svger-cli build ./my-svgs ./angular-components --framework angular
|
|
|
196
237
|
```
|
|
197
238
|
|
|
198
239
|
**Generated Angular Component (`.component.ts`):**
|
|
240
|
+
|
|
199
241
|
```typescript
|
|
200
242
|
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
|
|
201
243
|
|
|
@@ -227,19 +269,13 @@ svger-cli build ./my-svgs ./svelte-components --framework svelte
|
|
|
227
269
|
```
|
|
228
270
|
|
|
229
271
|
**Generated Svelte Component (`.svelte`):**
|
|
272
|
+
|
|
230
273
|
```html
|
|
231
274
|
<script lang="ts">
|
|
232
275
|
export let size: number | string = 24;
|
|
233
276
|
</script>
|
|
234
277
|
|
|
235
|
-
<svg
|
|
236
|
-
width={size}
|
|
237
|
-
height={size}
|
|
238
|
-
viewBox="0 0 24 24"
|
|
239
|
-
{...$$restProps}
|
|
240
|
-
>
|
|
241
|
-
{/* SVG content */}
|
|
242
|
-
</svg>
|
|
278
|
+
<svg width="{size}" height="{size}" viewBox="0 0 24 24" {...$$restProps}>{/* SVG content */}</svg>
|
|
243
279
|
```
|
|
244
280
|
|
|
245
281
|
### **Solid**
|
|
@@ -251,6 +287,7 @@ svger-cli build ./my-svgs ./solid-components --framework solid
|
|
|
251
287
|
```
|
|
252
288
|
|
|
253
289
|
**Generated Solid Component (`.tsx`):**
|
|
290
|
+
|
|
254
291
|
```tsx
|
|
255
292
|
import type { Component, JSX } from 'solid-js';
|
|
256
293
|
|
|
@@ -258,14 +295,9 @@ interface IconProps extends JSX.SvgSVGAttributes<SVGSVGElement> {
|
|
|
258
295
|
size?: number | string;
|
|
259
296
|
}
|
|
260
297
|
|
|
261
|
-
const MyIcon: Component<IconProps> =
|
|
298
|
+
const MyIcon: Component<IconProps> = props => {
|
|
262
299
|
return (
|
|
263
|
-
<svg
|
|
264
|
-
width={props.size || 24}
|
|
265
|
-
height={props.size || 24}
|
|
266
|
-
viewBox="0 0 24 24"
|
|
267
|
-
{...props}
|
|
268
|
-
>
|
|
300
|
+
<svg width={props.size || 24} height={props.size || 24} viewBox="0 0 24 24" {...props}>
|
|
269
301
|
{/* SVG content */}
|
|
270
302
|
</svg>
|
|
271
303
|
);
|
|
@@ -283,6 +315,7 @@ svger-cli build ./my-svgs ./lit-components --framework lit
|
|
|
283
315
|
```
|
|
284
316
|
|
|
285
317
|
**Generated Lit Component (`.ts`):**
|
|
318
|
+
|
|
286
319
|
```ts
|
|
287
320
|
import { LitElement, html, svg } from 'lit';
|
|
288
321
|
import { customElement, property } from 'lit/decorators.js';
|
|
@@ -294,11 +327,7 @@ export class MyIcon extends LitElement {
|
|
|
294
327
|
|
|
295
328
|
render() {
|
|
296
329
|
return html`
|
|
297
|
-
<svg
|
|
298
|
-
width=${this.size}
|
|
299
|
-
height=${this.size}
|
|
300
|
-
viewBox="0 0 24 24"
|
|
301
|
-
>
|
|
330
|
+
<svg width=${this.size} height=${this.size} viewBox="0 0 24 24">
|
|
302
331
|
${svg`{/* SVG content */}`}
|
|
303
332
|
</svg>
|
|
304
333
|
`;
|
|
@@ -315,6 +344,7 @@ svger-cli build ./my-svgs ./preact-components --framework preact
|
|
|
315
344
|
```
|
|
316
345
|
|
|
317
346
|
**Generated Preact Component (`.tsx`):**
|
|
347
|
+
|
|
318
348
|
```tsx
|
|
319
349
|
import { h } from 'preact';
|
|
320
350
|
import type { FunctionalComponent } from 'preact';
|
|
@@ -325,12 +355,7 @@ interface IconProps extends h.JSX.SVGAttributes<SVGSVGElement> {
|
|
|
325
355
|
|
|
326
356
|
const MyIcon: FunctionalComponent<IconProps> = ({ size = 24, ...props }) => {
|
|
327
357
|
return (
|
|
328
|
-
<svg
|
|
329
|
-
width={size}
|
|
330
|
-
height={size}
|
|
331
|
-
viewBox="0 0 24 24"
|
|
332
|
-
{...props}
|
|
333
|
-
>
|
|
358
|
+
<svg width={size} height={size} viewBox="0 0 24 24" {...props}>
|
|
334
359
|
{/* SVG content */}
|
|
335
360
|
</svg>
|
|
336
361
|
);
|
|
@@ -348,6 +373,7 @@ svger-cli build ./my-svgs ./vanilla-components --framework vanilla
|
|
|
348
373
|
```
|
|
349
374
|
|
|
350
375
|
**Generated Vanilla Component (`.ts`):**
|
|
376
|
+
|
|
351
377
|
```ts
|
|
352
378
|
interface IconOptions {
|
|
353
379
|
size?: number | string;
|
|
@@ -372,6 +398,7 @@ export function createMyIcon(options: IconOptions = {}): SVGSVGElement {
|
|
|
372
398
|
## 🔧 **Comprehensive CLI Reference**
|
|
373
399
|
|
|
374
400
|
### **1. Initialize Command**
|
|
401
|
+
|
|
375
402
|
Set up SVGER-CLI configuration for your project.
|
|
376
403
|
|
|
377
404
|
```bash
|
|
@@ -379,6 +406,7 @@ svger-cli init [options]
|
|
|
379
406
|
```
|
|
380
407
|
|
|
381
408
|
**Options:**
|
|
409
|
+
|
|
382
410
|
- `--framework <type>` - Target framework (react|vue|svelte|angular|solid|preact|lit|vanilla)
|
|
383
411
|
- `--typescript` - Enable TypeScript generation (default: true)
|
|
384
412
|
- `--src <path>` - Source directory for SVG files (default: ./src/assets/svg)
|
|
@@ -386,6 +414,7 @@ svger-cli init [options]
|
|
|
386
414
|
- `--interactive` - Interactive configuration wizard
|
|
387
415
|
|
|
388
416
|
**Examples:**
|
|
417
|
+
|
|
389
418
|
```bash
|
|
390
419
|
# Initialize with React + TypeScript
|
|
391
420
|
svger-cli init --framework react --typescript
|
|
@@ -398,40 +427,114 @@ svger-cli init --interactive
|
|
|
398
427
|
```
|
|
399
428
|
|
|
400
429
|
**Generated Configuration (`.svgerconfig.json`):**
|
|
430
|
+
|
|
401
431
|
```json
|
|
402
432
|
{
|
|
403
433
|
"source": "./src/assets/svg",
|
|
404
|
-
"output": "./src/components/icons",
|
|
434
|
+
"output": "./src/components/icons",
|
|
405
435
|
"framework": "react",
|
|
406
436
|
"typescript": true,
|
|
437
|
+
"componentType": "functional",
|
|
438
|
+
|
|
407
439
|
"watch": false,
|
|
408
440
|
"parallel": true,
|
|
409
441
|
"batchSize": 10,
|
|
442
|
+
"maxConcurrency": 4,
|
|
443
|
+
"cache": true,
|
|
444
|
+
|
|
410
445
|
"defaultWidth": 24,
|
|
411
446
|
"defaultHeight": 24,
|
|
412
447
|
"defaultFill": "currentColor",
|
|
448
|
+
"defaultStroke": "none",
|
|
449
|
+
"defaultStrokeWidth": 1,
|
|
450
|
+
|
|
413
451
|
"exclude": ["logo.svg"],
|
|
452
|
+
"include": ["icons/**", "illustrations/**"],
|
|
453
|
+
|
|
414
454
|
"styleRules": {
|
|
415
455
|
"fill": "inherit",
|
|
416
|
-
"stroke": "none"
|
|
456
|
+
"stroke": "none",
|
|
457
|
+
"strokeWidth": "1",
|
|
458
|
+
"opacity": "1"
|
|
417
459
|
},
|
|
460
|
+
|
|
418
461
|
"responsive": {
|
|
419
|
-
"breakpoints": ["sm", "md", "lg"],
|
|
462
|
+
"breakpoints": ["sm", "md", "lg", "xl"],
|
|
420
463
|
"values": {
|
|
421
|
-
"width": ["20px", "24px", "32px"]
|
|
464
|
+
"width": ["16px", "20px", "24px", "32px"],
|
|
465
|
+
"height": ["16px", "20px", "24px", "32px"]
|
|
422
466
|
}
|
|
423
467
|
},
|
|
468
|
+
|
|
424
469
|
"theme": {
|
|
425
|
-
"mode": "
|
|
470
|
+
"mode": "auto",
|
|
426
471
|
"variables": {
|
|
427
|
-
"primary": "
|
|
428
|
-
"secondary": "#
|
|
472
|
+
"primary": "currentColor",
|
|
473
|
+
"secondary": "#6b7280",
|
|
474
|
+
"accent": "#3b82f6",
|
|
475
|
+
"background": "#ffffff",
|
|
476
|
+
"foreground": "#000000"
|
|
429
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
|
+
}
|
|
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"
|
|
430
532
|
}
|
|
431
533
|
}
|
|
432
534
|
```
|
|
433
535
|
|
|
434
536
|
### **2. Build Command**
|
|
537
|
+
|
|
435
538
|
Convert SVG files to framework components with advanced processing.
|
|
436
539
|
|
|
437
540
|
```bash
|
|
@@ -439,6 +542,7 @@ svger-cli build [options]
|
|
|
439
542
|
```
|
|
440
543
|
|
|
441
544
|
**Core Options:**
|
|
545
|
+
|
|
442
546
|
- `--src <path>` - Source directory containing SVG files
|
|
443
547
|
- `--out <path>` - Output directory for generated components
|
|
444
548
|
- `--framework <type>` - Target framework for component generation
|
|
@@ -446,6 +550,7 @@ svger-cli build [options]
|
|
|
446
550
|
- `--clean` - Clean output directory before building
|
|
447
551
|
|
|
448
552
|
**Performance Options:**
|
|
553
|
+
|
|
449
554
|
- `--parallel` - Enable parallel processing (default: true)
|
|
450
555
|
- `--batch-size <number>` - Number of files per batch (default: 10)
|
|
451
556
|
- `--max-concurrency <number>` - Maximum concurrent processes (default: CPU cores)
|
|
@@ -453,6 +558,7 @@ svger-cli build [options]
|
|
|
453
558
|
- `--performance` - Display performance metrics
|
|
454
559
|
|
|
455
560
|
**Framework-Specific Options:**
|
|
561
|
+
|
|
456
562
|
- `--composition` - Use Vue Composition API (Vue only)
|
|
457
563
|
- `--setup` - Use Vue script setup syntax (Vue only)
|
|
458
564
|
- `--standalone` - Generate Angular standalone components (Angular only)
|
|
@@ -460,12 +566,14 @@ svger-cli build [options]
|
|
|
460
566
|
- `--forward-ref` - Generate React forwardRef components (React only)
|
|
461
567
|
|
|
462
568
|
**Styling Options:**
|
|
569
|
+
|
|
463
570
|
- `--responsive` - Enable responsive design utilities
|
|
464
571
|
- `--theme <mode>` - Apply theme mode (light|dark|auto)
|
|
465
572
|
- `--styled-components` - Generate styled-components (React/Solid)
|
|
466
573
|
- `--css-modules` - Enable CSS Modules support
|
|
467
574
|
|
|
468
575
|
**Examples:**
|
|
576
|
+
|
|
469
577
|
```bash
|
|
470
578
|
# Basic build
|
|
471
579
|
svger-cli build --src ./icons --out ./components
|
|
@@ -512,6 +620,7 @@ svger-cli build \
|
|
|
512
620
|
```
|
|
513
621
|
|
|
514
622
|
### **3. Watch Command**
|
|
623
|
+
|
|
515
624
|
Monitor directories for SVG changes and auto-generate components.
|
|
516
625
|
|
|
517
626
|
```bash
|
|
@@ -519,12 +628,14 @@ svger-cli watch [options]
|
|
|
519
628
|
```
|
|
520
629
|
|
|
521
630
|
**Options:**
|
|
631
|
+
|
|
522
632
|
- All `build` command options
|
|
523
633
|
- `--debounce <ms>` - Debounce time for file changes (default: 300ms)
|
|
524
634
|
- `--ignore <patterns>` - Ignore file patterns (glob syntax)
|
|
525
635
|
- `--verbose` - Detailed logging of file changes
|
|
526
636
|
|
|
527
637
|
**Examples:**
|
|
638
|
+
|
|
528
639
|
```bash
|
|
529
640
|
# Basic watch mode
|
|
530
641
|
svger-cli watch --src ./icons --out ./components
|
|
@@ -550,6 +661,7 @@ svger-cli watch \
|
|
|
550
661
|
```
|
|
551
662
|
|
|
552
663
|
### **4. Generate Command**
|
|
664
|
+
|
|
553
665
|
Process specific SVG files with precise control.
|
|
554
666
|
|
|
555
667
|
```bash
|
|
@@ -557,14 +669,17 @@ svger-cli generate <input> [options]
|
|
|
557
669
|
```
|
|
558
670
|
|
|
559
671
|
**Arguments:**
|
|
672
|
+
|
|
560
673
|
- `<input>` - SVG file path or glob pattern
|
|
561
674
|
|
|
562
675
|
**Options:**
|
|
676
|
+
|
|
563
677
|
- All `build` command options
|
|
564
678
|
- `--name <string>` - Override component name
|
|
565
679
|
- `--template <type>` - Component template (functional|class|forwardRef|memo)
|
|
566
680
|
|
|
567
681
|
**Examples:**
|
|
682
|
+
|
|
568
683
|
```bash
|
|
569
684
|
# Generate single component
|
|
570
685
|
svger-cli generate ./icons/heart.svg --out ./components --name HeartIcon
|
|
@@ -592,6 +707,7 @@ svger-cli generate ./icons/logo.svg \
|
|
|
592
707
|
```
|
|
593
708
|
|
|
594
709
|
### **5. Lock/Unlock Commands**
|
|
710
|
+
|
|
595
711
|
Manage file protection during batch operations.
|
|
596
712
|
|
|
597
713
|
```bash
|
|
@@ -600,6 +716,7 @@ svger-cli unlock <files...>
|
|
|
600
716
|
```
|
|
601
717
|
|
|
602
718
|
**Examples:**
|
|
719
|
+
|
|
603
720
|
```bash
|
|
604
721
|
# Lock specific files
|
|
605
722
|
svger-cli lock ./icons/logo.svg ./icons/brand.svg
|
|
@@ -615,6 +732,7 @@ svger-cli unlock --all
|
|
|
615
732
|
```
|
|
616
733
|
|
|
617
734
|
### **6. Config Command**
|
|
735
|
+
|
|
618
736
|
Manage project configuration dynamically.
|
|
619
737
|
|
|
620
738
|
```bash
|
|
@@ -622,6 +740,7 @@ svger-cli config [options]
|
|
|
622
740
|
```
|
|
623
741
|
|
|
624
742
|
**Options:**
|
|
743
|
+
|
|
625
744
|
- `--show` - Display current configuration
|
|
626
745
|
- `--set <key=value>` - Set configuration value
|
|
627
746
|
- `--get <key>` - Get specific configuration value
|
|
@@ -629,6 +748,7 @@ svger-cli config [options]
|
|
|
629
748
|
- `--validate` - Validate current configuration
|
|
630
749
|
|
|
631
750
|
**Examples:**
|
|
751
|
+
|
|
632
752
|
```bash
|
|
633
753
|
# Show current config
|
|
634
754
|
svger-cli config --show
|
|
@@ -650,6 +770,7 @@ svger-cli config --validate
|
|
|
650
770
|
```
|
|
651
771
|
|
|
652
772
|
### **7. Clean Command**
|
|
773
|
+
|
|
653
774
|
Remove generated components and clean workspace.
|
|
654
775
|
|
|
655
776
|
```bash
|
|
@@ -657,6 +778,7 @@ svger-cli clean [options]
|
|
|
657
778
|
```
|
|
658
779
|
|
|
659
780
|
**Options:**
|
|
781
|
+
|
|
660
782
|
- `--out <path>` - Output directory to clean
|
|
661
783
|
- `--cache` - Clear processing cache
|
|
662
784
|
- `--logs` - Clear log files
|
|
@@ -664,6 +786,7 @@ svger-cli clean [options]
|
|
|
664
786
|
- `--dry-run` - Preview what would be cleaned
|
|
665
787
|
|
|
666
788
|
**Examples:**
|
|
789
|
+
|
|
667
790
|
```bash
|
|
668
791
|
# Clean output directory
|
|
669
792
|
svger-cli clean --out ./components
|
|
@@ -679,6 +802,7 @@ svger-cli clean --all --dry-run
|
|
|
679
802
|
```
|
|
680
803
|
|
|
681
804
|
### **8. Performance Command**
|
|
805
|
+
|
|
682
806
|
Analyze and optimize processing performance.
|
|
683
807
|
|
|
684
808
|
```bash
|
|
@@ -686,6 +810,7 @@ svger-cli performance [options]
|
|
|
686
810
|
```
|
|
687
811
|
|
|
688
812
|
**Options:**
|
|
813
|
+
|
|
689
814
|
- `--analyze` - Analyze current project performance
|
|
690
815
|
- `--benchmark` - Run performance benchmarks
|
|
691
816
|
- `--memory` - Display memory usage statistics
|
|
@@ -693,6 +818,7 @@ svger-cli performance [options]
|
|
|
693
818
|
- `--optimize` - Apply performance optimizations
|
|
694
819
|
|
|
695
820
|
**Examples:**
|
|
821
|
+
|
|
696
822
|
```bash
|
|
697
823
|
# Analyze performance
|
|
698
824
|
svger-cli performance --analyze
|
|
@@ -715,6 +841,7 @@ svger-cli performance --optimize
|
|
|
715
841
|
## 💻 **Usage Examples: From Simple to Complex**
|
|
716
842
|
|
|
717
843
|
### **🔥 Example 1: Quick Start (Simplest)**
|
|
844
|
+
|
|
718
845
|
Get started in 30 seconds:
|
|
719
846
|
|
|
720
847
|
```bash
|
|
@@ -739,6 +866,7 @@ function App() {
|
|
|
739
866
|
```
|
|
740
867
|
|
|
741
868
|
**What happens:**
|
|
869
|
+
|
|
742
870
|
- ✅ All SVGs in `./my-icons` converted to React components
|
|
743
871
|
- ✅ Auto-generated `index.ts` with clean exports
|
|
744
872
|
- ✅ Components support `className`, `style`, `size` props
|
|
@@ -747,6 +875,7 @@ function App() {
|
|
|
747
875
|
---
|
|
748
876
|
|
|
749
877
|
### **🚀 Example 2: Production Setup (Intermediate)**
|
|
878
|
+
|
|
750
879
|
Professional setup with configuration and optimization:
|
|
751
880
|
|
|
752
881
|
```bash
|
|
@@ -778,6 +907,7 @@ svger-cli watch --debounce 500 --verbose
|
|
|
778
907
|
```
|
|
779
908
|
|
|
780
909
|
**Generated Components:**
|
|
910
|
+
|
|
781
911
|
```typescript
|
|
782
912
|
// Auto-generated: src/components/icons/ArrowLeft.tsx
|
|
783
913
|
import React from 'react';
|
|
@@ -788,8 +918,8 @@ interface ArrowLeftProps extends React.SVGProps<SVGSVGElement> {
|
|
|
788
918
|
|
|
789
919
|
const ArrowLeft = React.forwardRef<SVGSVGElement, ArrowLeftProps>(
|
|
790
920
|
({ size = 24, className, style, ...props }, ref) => {
|
|
791
|
-
const sizeValue = typeof size === 'string'
|
|
792
|
-
? { sm: 16, md: 24, lg: 32 }[size]
|
|
921
|
+
const sizeValue = typeof size === 'string'
|
|
922
|
+
? { sm: 16, md: 24, lg: 32 }[size]
|
|
793
923
|
: size;
|
|
794
924
|
|
|
795
925
|
return (
|
|
@@ -814,6 +944,7 @@ export default ArrowLeft;
|
|
|
814
944
|
```
|
|
815
945
|
|
|
816
946
|
**Auto-generated index.ts:**
|
|
947
|
+
|
|
817
948
|
```typescript
|
|
818
949
|
/**
|
|
819
950
|
* Auto-generated icon exports
|
|
@@ -832,23 +963,24 @@ export default {
|
|
|
832
963
|
```
|
|
833
964
|
|
|
834
965
|
**Usage in App:**
|
|
966
|
+
|
|
835
967
|
```typescript
|
|
836
968
|
import { ArrowLeft, Home, User } from './components/icons';
|
|
837
969
|
|
|
838
970
|
function Navigation() {
|
|
839
971
|
return (
|
|
840
972
|
<nav className="flex items-center space-x-4">
|
|
841
|
-
<ArrowLeft
|
|
842
|
-
size="sm"
|
|
843
|
-
className="text-gray-600 hover:text-gray-900"
|
|
973
|
+
<ArrowLeft
|
|
974
|
+
size="sm"
|
|
975
|
+
className="text-gray-600 hover:text-gray-900"
|
|
844
976
|
onClick={() => history.back()}
|
|
845
977
|
/>
|
|
846
|
-
<Home
|
|
847
|
-
size={28}
|
|
978
|
+
<Home
|
|
979
|
+
size={28}
|
|
848
980
|
style={{ color: 'var(--primary-color)' }}
|
|
849
981
|
/>
|
|
850
|
-
<User
|
|
851
|
-
className="w-6 h-6 text-blue-500"
|
|
982
|
+
<User
|
|
983
|
+
className="w-6 h-6 text-blue-500"
|
|
852
984
|
ref={userIconRef}
|
|
853
985
|
/>
|
|
854
986
|
</nav>
|
|
@@ -859,6 +991,7 @@ function Navigation() {
|
|
|
859
991
|
---
|
|
860
992
|
|
|
861
993
|
### **🏗️ Example 3: Enterprise Multi-Framework (Advanced)**
|
|
994
|
+
|
|
862
995
|
Complete enterprise setup supporting multiple frameworks:
|
|
863
996
|
|
|
864
997
|
```bash
|
|
@@ -912,6 +1045,7 @@ svger-cli build \
|
|
|
912
1045
|
```
|
|
913
1046
|
|
|
914
1047
|
**React Components with Styled Components:**
|
|
1048
|
+
|
|
915
1049
|
```typescript
|
|
916
1050
|
// Generated: react-components/ArrowLeft.tsx
|
|
917
1051
|
import React from 'react';
|
|
@@ -925,24 +1059,24 @@ interface ArrowLeftProps extends React.SVGProps<SVGSVGElement> {
|
|
|
925
1059
|
|
|
926
1060
|
const StyledSVG = styled.svg<ArrowLeftProps>`
|
|
927
1061
|
${({ theme, variant }) => css`
|
|
928
|
-
color: ${theme === 'dark'
|
|
929
|
-
? 'var(--icon-color-dark)'
|
|
1062
|
+
color: ${theme === 'dark'
|
|
1063
|
+
? 'var(--icon-color-dark)'
|
|
930
1064
|
: 'var(--icon-color-light)'};
|
|
931
|
-
|
|
1065
|
+
|
|
932
1066
|
${variant === 'primary' && css`
|
|
933
1067
|
color: var(--primary-color);
|
|
934
1068
|
`}
|
|
935
|
-
|
|
1069
|
+
|
|
936
1070
|
${variant === 'secondary' && css`
|
|
937
1071
|
color: var(--secondary-color);
|
|
938
1072
|
`}
|
|
939
|
-
|
|
1073
|
+
|
|
940
1074
|
${variant === 'accent' && css`
|
|
941
1075
|
color: var(--accent-color);
|
|
942
1076
|
`}
|
|
943
|
-
|
|
1077
|
+
|
|
944
1078
|
transition: all 0.2s ease;
|
|
945
|
-
|
|
1079
|
+
|
|
946
1080
|
&:hover {
|
|
947
1081
|
transform: scale(1.1);
|
|
948
1082
|
}
|
|
@@ -954,9 +1088,9 @@ const ArrowLeft = React.forwardRef<SVGSVGElement, ArrowLeftProps>(
|
|
|
954
1088
|
const sizeMap = {
|
|
955
1089
|
sm: 16, md: 24, lg: 32, xl: 40
|
|
956
1090
|
};
|
|
957
|
-
|
|
1091
|
+
|
|
958
1092
|
const sizeValue = typeof size === 'string' ? sizeMap[size] : size;
|
|
959
|
-
|
|
1093
|
+
|
|
960
1094
|
return (
|
|
961
1095
|
<StyledSVG
|
|
962
1096
|
ref={ref}
|
|
@@ -968,9 +1102,9 @@ const ArrowLeft = React.forwardRef<SVGSVGElement, ArrowLeftProps>(
|
|
|
968
1102
|
theme={theme}
|
|
969
1103
|
{...props}
|
|
970
1104
|
>
|
|
971
|
-
<path
|
|
972
|
-
d="M19 12H5M12 19l-7-7 7-7"
|
|
973
|
-
stroke="currentColor"
|
|
1105
|
+
<path
|
|
1106
|
+
d="M19 12H5M12 19l-7-7 7-7"
|
|
1107
|
+
stroke="currentColor"
|
|
974
1108
|
strokeWidth="2"
|
|
975
1109
|
/>
|
|
976
1110
|
</StyledSVG>
|
|
@@ -983,6 +1117,7 @@ export default ArrowLeft;
|
|
|
983
1117
|
```
|
|
984
1118
|
|
|
985
1119
|
**Vue Composition API Components:**
|
|
1120
|
+
|
|
986
1121
|
```vue
|
|
987
1122
|
<!-- Generated: vue-components/ArrowLeft.vue -->
|
|
988
1123
|
<script setup lang="ts">
|
|
@@ -993,7 +1128,7 @@ interface Props {
|
|
|
993
1128
|
}
|
|
994
1129
|
|
|
995
1130
|
const props = withDefaults(defineProps<Props>(), {
|
|
996
|
-
size: 'md'
|
|
1131
|
+
size: 'md',
|
|
997
1132
|
});
|
|
998
1133
|
|
|
999
1134
|
const sizeValue = computed(() => {
|
|
@@ -1014,11 +1149,7 @@ const sizeValue = computed(() => {
|
|
|
1014
1149
|
:style="style"
|
|
1015
1150
|
v-bind="$attrs"
|
|
1016
1151
|
>
|
|
1017
|
-
<path
|
|
1018
|
-
d="M19 12H5M12 19l-7-7 7-7"
|
|
1019
|
-
stroke="currentColor"
|
|
1020
|
-
stroke-width="2"
|
|
1021
|
-
/>
|
|
1152
|
+
<path d="M19 12H5M12 19l-7-7 7-7" stroke="currentColor" stroke-width="2" />
|
|
1022
1153
|
</svg>
|
|
1023
1154
|
</template>
|
|
1024
1155
|
|
|
@@ -1035,6 +1166,7 @@ svg:hover {
|
|
|
1035
1166
|
```
|
|
1036
1167
|
|
|
1037
1168
|
**Angular Standalone Components:**
|
|
1169
|
+
|
|
1038
1170
|
```typescript
|
|
1039
1171
|
// Generated: angular-components/arrow-left.component.ts
|
|
1040
1172
|
import { Component, Input, signal } from '@angular/core';
|
|
@@ -1053,34 +1185,30 @@ import { CommonModule } from '@angular/common';
|
|
|
1053
1185
|
[class]="className"
|
|
1054
1186
|
[style]="style"
|
|
1055
1187
|
>
|
|
1056
|
-
<path
|
|
1057
|
-
d="M19 12H5M12 19l-7-7 7-7"
|
|
1058
|
-
stroke="currentColor"
|
|
1059
|
-
stroke-width="2"
|
|
1060
|
-
/>
|
|
1188
|
+
<path d="M19 12H5M12 19l-7-7 7-7" stroke="currentColor" stroke-width="2" />
|
|
1061
1189
|
</svg>
|
|
1062
1190
|
`,
|
|
1063
|
-
styles: [
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
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
|
+
],
|
|
1072
1202
|
})
|
|
1073
1203
|
export class ArrowLeftComponent {
|
|
1074
1204
|
@Input() size: number | 'sm' | 'md' | 'lg' = 'md';
|
|
1075
1205
|
@Input() className: string = '';
|
|
1076
1206
|
@Input() style: Record<string, any> = {};
|
|
1077
|
-
|
|
1207
|
+
|
|
1078
1208
|
private sizeMap = { sm: 16, md: 24, lg: 32 };
|
|
1079
|
-
|
|
1209
|
+
|
|
1080
1210
|
computedSize = signal(() => {
|
|
1081
|
-
return typeof this.size === 'string'
|
|
1082
|
-
? this.sizeMap[this.size]
|
|
1083
|
-
: this.size;
|
|
1211
|
+
return typeof this.size === 'string' ? this.sizeMap[this.size] : this.size;
|
|
1084
1212
|
});
|
|
1085
1213
|
}
|
|
1086
1214
|
```
|
|
@@ -1088,6 +1216,7 @@ export class ArrowLeftComponent {
|
|
|
1088
1216
|
---
|
|
1089
1217
|
|
|
1090
1218
|
### **🔒 Example 4: File Protection & Team Workflows (Advanced)**
|
|
1219
|
+
|
|
1091
1220
|
Protect critical files and manage team workflows:
|
|
1092
1221
|
|
|
1093
1222
|
```bash
|
|
@@ -1114,6 +1243,7 @@ svger-cli status --locked
|
|
|
1114
1243
|
```
|
|
1115
1244
|
|
|
1116
1245
|
**Team Configuration (.svgerconfig.json):**
|
|
1246
|
+
|
|
1117
1247
|
```json
|
|
1118
1248
|
{
|
|
1119
1249
|
"source": "./src/assets/icons",
|
|
@@ -1121,10 +1251,7 @@ svger-cli status --locked
|
|
|
1121
1251
|
"framework": "react",
|
|
1122
1252
|
"typescript": true,
|
|
1123
1253
|
"forwardRef": true,
|
|
1124
|
-
"lockedFiles": [
|
|
1125
|
-
"./src/assets/icons/logo.svg",
|
|
1126
|
-
"./src/assets/icons/brand-mark.svg"
|
|
1127
|
-
],
|
|
1254
|
+
"lockedFiles": ["./src/assets/icons/logo.svg", "./src/assets/icons/brand-mark.svg"],
|
|
1128
1255
|
"teamSettings": {
|
|
1129
1256
|
"requireConfirmation": true,
|
|
1130
1257
|
"lockByDefault": false,
|
|
@@ -1136,6 +1263,7 @@ svger-cli status --locked
|
|
|
1136
1263
|
---
|
|
1137
1264
|
|
|
1138
1265
|
### **⚡ Example 5: Performance Optimization (Expert)**
|
|
1266
|
+
|
|
1139
1267
|
Maximum performance setup for large-scale projects:
|
|
1140
1268
|
|
|
1141
1269
|
```bash
|
|
@@ -1175,6 +1303,7 @@ svger-cli performance --benchmark --compare-with v1.5.0
|
|
|
1175
1303
|
```
|
|
1176
1304
|
|
|
1177
1305
|
**Performance Configuration:**
|
|
1306
|
+
|
|
1178
1307
|
```json
|
|
1179
1308
|
{
|
|
1180
1309
|
"performance": {
|
|
@@ -1198,6 +1327,7 @@ svger-cli performance --benchmark --compare-with v1.5.0
|
|
|
1198
1327
|
```
|
|
1199
1328
|
|
|
1200
1329
|
**Enterprise Usage Patterns:**
|
|
1330
|
+
|
|
1201
1331
|
```typescript
|
|
1202
1332
|
// Large-scale import pattern
|
|
1203
1333
|
import IconLibrary from './components/icons';
|
|
@@ -1206,12 +1336,12 @@ import IconLibrary from './components/icons';
|
|
|
1206
1336
|
const LazyIcon = React.lazy(() => import('./components/icons/SpecificIcon'));
|
|
1207
1337
|
|
|
1208
1338
|
// Tree-shaking friendly imports
|
|
1209
|
-
import {
|
|
1339
|
+
import {
|
|
1210
1340
|
ArrowLeft,
|
|
1211
1341
|
ArrowRight,
|
|
1212
1342
|
Home,
|
|
1213
1343
|
User,
|
|
1214
|
-
Settings
|
|
1344
|
+
Settings
|
|
1215
1345
|
} from './components/icons';
|
|
1216
1346
|
|
|
1217
1347
|
// Dynamic icon loading
|
|
@@ -1226,6 +1356,7 @@ const DynamicIcon = ({ name, ...props }) => {
|
|
|
1226
1356
|
## 🎨 **Advanced Styling & Theming**
|
|
1227
1357
|
|
|
1228
1358
|
### **Responsive Design System**
|
|
1359
|
+
|
|
1229
1360
|
SVGER-CLI includes a comprehensive responsive design system:
|
|
1230
1361
|
|
|
1231
1362
|
```bash
|
|
@@ -1234,6 +1365,7 @@ svger-cli build --responsive --src ./icons --out ./components
|
|
|
1234
1365
|
```
|
|
1235
1366
|
|
|
1236
1367
|
**Configuration:**
|
|
1368
|
+
|
|
1237
1369
|
```json
|
|
1238
1370
|
{
|
|
1239
1371
|
"responsive": {
|
|
@@ -1248,6 +1380,7 @@ svger-cli build --responsive --src ./icons --out ./components
|
|
|
1248
1380
|
```
|
|
1249
1381
|
|
|
1250
1382
|
**Generated React Component:**
|
|
1383
|
+
|
|
1251
1384
|
```tsx
|
|
1252
1385
|
interface ResponsiveIconProps extends React.SVGProps<SVGSVGElement> {
|
|
1253
1386
|
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -1258,14 +1391,19 @@ const ResponsiveIcon: React.FC<ResponsiveIconProps> = ({ size = 'md', ...props }
|
|
|
1258
1391
|
sm: { width: 16, height: 16 },
|
|
1259
1392
|
md: { width: 20, height: 20 },
|
|
1260
1393
|
lg: { width: 24, height: 24 },
|
|
1261
|
-
xl: { width: 32, height: 32 }
|
|
1394
|
+
xl: { width: 32, height: 32 },
|
|
1262
1395
|
};
|
|
1263
|
-
|
|
1264
|
-
return
|
|
1396
|
+
|
|
1397
|
+
return (
|
|
1398
|
+
<svg {...sizeMap[size]} {...props}>
|
|
1399
|
+
...
|
|
1400
|
+
</svg>
|
|
1401
|
+
);
|
|
1265
1402
|
};
|
|
1266
1403
|
```
|
|
1267
1404
|
|
|
1268
1405
|
### **Theme System**
|
|
1406
|
+
|
|
1269
1407
|
Built-in dark/light theme support with CSS variables:
|
|
1270
1408
|
|
|
1271
1409
|
```bash
|
|
@@ -1274,6 +1412,7 @@ svger-cli build --theme dark --src ./icons --out ./components
|
|
|
1274
1412
|
```
|
|
1275
1413
|
|
|
1276
1414
|
**Theme Configuration:**
|
|
1415
|
+
|
|
1277
1416
|
```json
|
|
1278
1417
|
{
|
|
1279
1418
|
"theme": {
|
|
@@ -1288,6 +1427,7 @@ svger-cli build --theme dark --src ./icons --out ./components
|
|
|
1288
1427
|
```
|
|
1289
1428
|
|
|
1290
1429
|
**Generated CSS Variables:**
|
|
1430
|
+
|
|
1291
1431
|
```css
|
|
1292
1432
|
:root {
|
|
1293
1433
|
--icon-primary: #ffffff;
|
|
@@ -1302,6 +1442,7 @@ svger-cli build --theme dark --src ./icons --out ./components
|
|
|
1302
1442
|
```
|
|
1303
1443
|
|
|
1304
1444
|
### **Animation System**
|
|
1445
|
+
|
|
1305
1446
|
Built-in animation utilities:
|
|
1306
1447
|
|
|
1307
1448
|
```bash
|
|
@@ -1310,8 +1451,9 @@ svger-cli build --animations hover,focus --src ./icons --out ./components
|
|
|
1310
1451
|
```
|
|
1311
1452
|
|
|
1312
1453
|
**Available Animations:**
|
|
1454
|
+
|
|
1313
1455
|
- `hover` - Hover state transitions
|
|
1314
|
-
- `focus` - Focus state transitions
|
|
1456
|
+
- `focus` - Focus state transitions
|
|
1315
1457
|
- `spin` - Continuous rotation
|
|
1316
1458
|
- `pulse` - Pulsing opacity
|
|
1317
1459
|
- `bounce` - Bouncing effect
|
|
@@ -1322,6 +1464,7 @@ svger-cli build --animations hover,focus --src ./icons --out ./components
|
|
|
1322
1464
|
## 💻 **Programmatic API**
|
|
1323
1465
|
|
|
1324
1466
|
### **Core API Usage**
|
|
1467
|
+
|
|
1325
1468
|
```typescript
|
|
1326
1469
|
import { SVGER, svgProcessor, frameworkTemplateEngine } from 'svger-cli';
|
|
1327
1470
|
|
|
@@ -1333,24 +1476,21 @@ await SVGER.processBatch(files, { parallel: true, batchSize: 20 });
|
|
|
1333
1476
|
await SVGER.generateFrameworkComponent('IconName', svgContent, {
|
|
1334
1477
|
framework: 'vue',
|
|
1335
1478
|
composition: true,
|
|
1336
|
-
typescript: true
|
|
1479
|
+
typescript: true,
|
|
1337
1480
|
});
|
|
1338
1481
|
|
|
1339
1482
|
// Advanced processing
|
|
1340
|
-
const result = await svgProcessor.processSVGFile(
|
|
1341
|
-
'
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
responsive: true,
|
|
1348
|
-
theme: 'dark'
|
|
1349
|
-
}
|
|
1350
|
-
);
|
|
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
|
+
});
|
|
1351
1490
|
```
|
|
1352
1491
|
|
|
1353
1492
|
### **Performance Engine API**
|
|
1493
|
+
|
|
1354
1494
|
```typescript
|
|
1355
1495
|
import { performanceEngine } from 'svger-cli';
|
|
1356
1496
|
|
|
@@ -1358,7 +1498,7 @@ import { performanceEngine } from 'svger-cli';
|
|
|
1358
1498
|
const results = await performanceEngine.processBatch(files, {
|
|
1359
1499
|
batchSize: 15,
|
|
1360
1500
|
parallel: true,
|
|
1361
|
-
maxConcurrency: 6
|
|
1501
|
+
maxConcurrency: 6,
|
|
1362
1502
|
});
|
|
1363
1503
|
|
|
1364
1504
|
// Memory monitoring
|
|
@@ -1371,6 +1511,7 @@ const optimized = performanceEngine.optimizeSVGContent(svgContent, 'maximum');
|
|
|
1371
1511
|
```
|
|
1372
1512
|
|
|
1373
1513
|
### **Style Compiler API**
|
|
1514
|
+
|
|
1374
1515
|
```typescript
|
|
1375
1516
|
import { styleCompiler } from 'svger-cli';
|
|
1376
1517
|
|
|
@@ -1378,10 +1519,10 @@ import { styleCompiler } from 'svger-cli';
|
|
|
1378
1519
|
const styles = styleCompiler.compileStyles({
|
|
1379
1520
|
responsive: {
|
|
1380
1521
|
width: ['20px', '24px', '32px'],
|
|
1381
|
-
height: ['20px', '24px', '32px']
|
|
1522
|
+
height: ['20px', '24px', '32px'],
|
|
1382
1523
|
},
|
|
1383
1524
|
theme: 'dark',
|
|
1384
|
-
animations: ['hover', 'focus']
|
|
1525
|
+
animations: ['hover', 'focus'],
|
|
1385
1526
|
});
|
|
1386
1527
|
|
|
1387
1528
|
// Generate CSS
|
|
@@ -1389,6 +1530,7 @@ const css = styleCompiler.generateCSS(styles);
|
|
|
1389
1530
|
```
|
|
1390
1531
|
|
|
1391
1532
|
### **Plugin System API**
|
|
1533
|
+
|
|
1392
1534
|
```typescript
|
|
1393
1535
|
import { pluginManager } from 'svger-cli';
|
|
1394
1536
|
|
|
@@ -1400,7 +1542,7 @@ pluginManager.registerPlugin({
|
|
|
1400
1542
|
// Custom SVG processing logic
|
|
1401
1543
|
return processedContent;
|
|
1402
1544
|
},
|
|
1403
|
-
validate: (options?: any) => true
|
|
1545
|
+
validate: (options?: any) => true,
|
|
1404
1546
|
});
|
|
1405
1547
|
|
|
1406
1548
|
// Enable plugin
|
|
@@ -1409,7 +1551,7 @@ pluginManager.enablePlugin('custom-optimizer', { level: 'maximum' });
|
|
|
1409
1551
|
// Process with plugins
|
|
1410
1552
|
const processed = await pluginManager.processContent(svgContent, [
|
|
1411
1553
|
{ name: 'svg-optimizer', options: { level: 'balanced' } },
|
|
1412
|
-
{ name: 'custom-optimizer', options: { level: 'maximum' } }
|
|
1554
|
+
{ name: 'custom-optimizer', options: { level: 'maximum' } },
|
|
1413
1555
|
]);
|
|
1414
1556
|
```
|
|
1415
1557
|
|
|
@@ -1418,83 +1560,135 @@ const processed = await pluginManager.processContent(svgContent, [
|
|
|
1418
1560
|
## 🔧 **Configuration Reference**
|
|
1419
1561
|
|
|
1420
1562
|
### **Complete Configuration Schema**
|
|
1563
|
+
|
|
1564
|
+
All configuration options are now fully implemented and tested:
|
|
1565
|
+
|
|
1421
1566
|
```typescript
|
|
1422
1567
|
interface SVGConfig {
|
|
1423
1568
|
// Source & Output
|
|
1424
|
-
source: string;
|
|
1425
|
-
output: string;
|
|
1426
|
-
|
|
1569
|
+
source: string; // Input directory path
|
|
1570
|
+
output: string; // Output directory path
|
|
1571
|
+
|
|
1427
1572
|
// Framework Configuration
|
|
1428
|
-
framework: FrameworkType;
|
|
1429
|
-
typescript: boolean;
|
|
1430
|
-
componentType: ComponentType;
|
|
1431
|
-
|
|
1573
|
+
framework: FrameworkType; // Target framework
|
|
1574
|
+
typescript: boolean; // Generate TypeScript
|
|
1575
|
+
componentType: ComponentType; // Component pattern
|
|
1576
|
+
|
|
1432
1577
|
// Processing Options
|
|
1433
|
-
watch: boolean;
|
|
1434
|
-
parallel: boolean;
|
|
1435
|
-
batchSize: number;
|
|
1436
|
-
maxConcurrency: number;
|
|
1437
|
-
cache: boolean;
|
|
1438
|
-
|
|
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
|
+
|
|
1439
1584
|
// Default Properties
|
|
1440
|
-
defaultWidth: number;
|
|
1441
|
-
defaultHeight: number;
|
|
1442
|
-
defaultFill: string;
|
|
1443
|
-
defaultStroke: string;
|
|
1444
|
-
defaultStrokeWidth: number;
|
|
1445
|
-
|
|
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
|
+
|
|
1446
1591
|
// Styling Configuration
|
|
1447
|
-
styleRules: {
|
|
1592
|
+
styleRules: {
|
|
1593
|
+
// CSS styling rules
|
|
1448
1594
|
[property: string]: string;
|
|
1449
1595
|
};
|
|
1450
|
-
|
|
1451
|
-
responsive: {
|
|
1596
|
+
|
|
1597
|
+
responsive: {
|
|
1598
|
+
// Responsive design
|
|
1452
1599
|
breakpoints: string[];
|
|
1453
1600
|
values: {
|
|
1454
1601
|
[property: string]: string[];
|
|
1455
1602
|
};
|
|
1456
1603
|
};
|
|
1457
|
-
|
|
1458
|
-
theme: {
|
|
1604
|
+
|
|
1605
|
+
theme: {
|
|
1606
|
+
// Theme configuration
|
|
1459
1607
|
mode: 'light' | 'dark' | 'auto';
|
|
1460
1608
|
variables: {
|
|
1461
1609
|
[name: string]: string;
|
|
1462
1610
|
};
|
|
1463
1611
|
};
|
|
1464
|
-
|
|
1465
|
-
animations: string[];
|
|
1466
|
-
|
|
1612
|
+
|
|
1613
|
+
animations: string[]; // Animation effects
|
|
1614
|
+
|
|
1467
1615
|
// Advanced Options
|
|
1468
|
-
plugins: PluginConfig[];
|
|
1469
|
-
exclude: string[];
|
|
1470
|
-
include: string[];
|
|
1471
|
-
|
|
1616
|
+
plugins: PluginConfig[]; // Plugin configurations
|
|
1617
|
+
exclude: string[]; // Files to exclude
|
|
1618
|
+
include: string[]; // Files to include (overrides exclude)
|
|
1619
|
+
|
|
1472
1620
|
// Error Handling
|
|
1473
1621
|
errorHandling: {
|
|
1474
1622
|
strategy: 'continue' | 'stop' | 'retry';
|
|
1475
1623
|
maxRetries: number;
|
|
1476
1624
|
timeout: number;
|
|
1477
1625
|
};
|
|
1478
|
-
|
|
1626
|
+
|
|
1479
1627
|
// Performance Settings
|
|
1480
1628
|
performance: {
|
|
1481
1629
|
optimization: 'fast' | 'balanced' | 'maximum';
|
|
1482
|
-
memoryLimit: number;
|
|
1483
|
-
cacheTimeout: number;
|
|
1630
|
+
memoryLimit: number; // Memory limit in MB
|
|
1631
|
+
cacheTimeout: number; // Cache timeout in ms
|
|
1484
1632
|
};
|
|
1485
|
-
|
|
1633
|
+
|
|
1486
1634
|
// Output Customization
|
|
1487
|
-
|
|
1635
|
+
outputConfig: {
|
|
1488
1636
|
naming: 'kebab' | 'pascal' | 'camel';
|
|
1489
|
-
extension: string;
|
|
1490
|
-
directory: string;
|
|
1637
|
+
extension: string; // File extension override
|
|
1638
|
+
directory: string; // Output directory structure
|
|
1491
1639
|
};
|
|
1640
|
+
|
|
1641
|
+
// Framework-specific configurations
|
|
1642
|
+
react?: ReactConfig;
|
|
1643
|
+
vue?: VueConfig;
|
|
1644
|
+
angular?: AngularConfig;
|
|
1492
1645
|
}
|
|
1493
1646
|
```
|
|
1494
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
|
+
|
|
1495
1688
|
### **Framework-Specific Options**
|
|
1496
1689
|
|
|
1497
1690
|
#### **React Configuration**
|
|
1691
|
+
|
|
1498
1692
|
```json
|
|
1499
1693
|
{
|
|
1500
1694
|
"framework": "react",
|
|
@@ -1509,7 +1703,8 @@ interface SVGConfig {
|
|
|
1509
1703
|
}
|
|
1510
1704
|
```
|
|
1511
1705
|
|
|
1512
|
-
#### **Vue Configuration**
|
|
1706
|
+
#### **Vue Configuration**
|
|
1707
|
+
|
|
1513
1708
|
```json
|
|
1514
1709
|
{
|
|
1515
1710
|
"framework": "vue",
|
|
@@ -1524,9 +1719,10 @@ interface SVGConfig {
|
|
|
1524
1719
|
```
|
|
1525
1720
|
|
|
1526
1721
|
#### **Angular Configuration**
|
|
1722
|
+
|
|
1527
1723
|
```json
|
|
1528
1724
|
{
|
|
1529
|
-
"framework": "angular",
|
|
1725
|
+
"framework": "angular",
|
|
1530
1726
|
"angular": {
|
|
1531
1727
|
"standalone": true,
|
|
1532
1728
|
"signals": true,
|
|
@@ -1541,17 +1737,19 @@ interface SVGConfig {
|
|
|
1541
1737
|
## 📊 **Performance Optimization**
|
|
1542
1738
|
|
|
1543
1739
|
### **Benchmarks vs Competitors**
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
|
1547
|
-
|
|
|
1548
|
-
|
|
|
1549
|
-
|
|
|
1550
|
-
|
|
|
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** |
|
|
1551
1748
|
|
|
1552
1749
|
### **Performance Best Practices**
|
|
1553
1750
|
|
|
1554
1751
|
#### **Batch Processing Optimization**
|
|
1752
|
+
|
|
1555
1753
|
```bash
|
|
1556
1754
|
# Optimal batch processing
|
|
1557
1755
|
svger-cli build \
|
|
@@ -1565,6 +1763,7 @@ svger-cli build \
|
|
|
1565
1763
|
```
|
|
1566
1764
|
|
|
1567
1765
|
#### **Memory Management**
|
|
1766
|
+
|
|
1568
1767
|
```typescript
|
|
1569
1768
|
// Monitor memory usage
|
|
1570
1769
|
import { performanceEngine } from 'svger-cli';
|
|
@@ -1579,6 +1778,7 @@ const monitor = setInterval(() => {
|
|
|
1579
1778
|
```
|
|
1580
1779
|
|
|
1581
1780
|
#### **Cache Configuration**
|
|
1781
|
+
|
|
1582
1782
|
```json
|
|
1583
1783
|
{
|
|
1584
1784
|
"performance": {
|
|
@@ -1594,6 +1794,7 @@ const monitor = setInterval(() => {
|
|
|
1594
1794
|
## 🧪 **Testing & Quality Assurance**
|
|
1595
1795
|
|
|
1596
1796
|
### **Component Testing**
|
|
1797
|
+
|
|
1597
1798
|
Generated components include comprehensive testing utilities:
|
|
1598
1799
|
|
|
1599
1800
|
```typescript
|
|
@@ -1607,7 +1808,7 @@ describe('IconName', () => {
|
|
|
1607
1808
|
const svg = screen.getByRole('img', { hidden: true });
|
|
1608
1809
|
expect(svg).toBeInTheDocument();
|
|
1609
1810
|
});
|
|
1610
|
-
|
|
1811
|
+
|
|
1611
1812
|
it('accepts custom props', () => {
|
|
1612
1813
|
render(<IconName width={32} height={32} fill="red" />);
|
|
1613
1814
|
const svg = screen.getByRole('img', { hidden: true });
|
|
@@ -1619,6 +1820,7 @@ describe('IconName', () => {
|
|
|
1619
1820
|
```
|
|
1620
1821
|
|
|
1621
1822
|
### **Integration Testing**
|
|
1823
|
+
|
|
1622
1824
|
```bash
|
|
1623
1825
|
# Run integration tests
|
|
1624
1826
|
npm run test:integration
|
|
@@ -1630,6 +1832,7 @@ npm run test:framework:angular
|
|
|
1630
1832
|
```
|
|
1631
1833
|
|
|
1632
1834
|
### **Performance Testing**
|
|
1835
|
+
|
|
1633
1836
|
```bash
|
|
1634
1837
|
# Run performance benchmarks
|
|
1635
1838
|
svger-cli performance --benchmark
|
|
@@ -1648,6 +1851,7 @@ svger-cli performance --load --files 1000
|
|
|
1648
1851
|
### **CI/CD Integration**
|
|
1649
1852
|
|
|
1650
1853
|
#### **GitHub Actions**
|
|
1854
|
+
|
|
1651
1855
|
```yaml
|
|
1652
1856
|
name: SVG Component Generation
|
|
1653
1857
|
on:
|
|
@@ -1662,10 +1866,10 @@ jobs:
|
|
|
1662
1866
|
- uses: actions/setup-node@v3
|
|
1663
1867
|
with:
|
|
1664
1868
|
node-version: '18'
|
|
1665
|
-
|
|
1869
|
+
|
|
1666
1870
|
- name: Install SVGER-CLI
|
|
1667
|
-
run: npm install -g svger-cli@2.0.
|
|
1668
|
-
|
|
1871
|
+
run: npm install -g svger-cli@2.0.4
|
|
1872
|
+
|
|
1669
1873
|
- name: Generate Components
|
|
1670
1874
|
run: |
|
|
1671
1875
|
svger-cli build \
|
|
@@ -1675,7 +1879,7 @@ jobs:
|
|
|
1675
1879
|
--typescript \
|
|
1676
1880
|
--parallel \
|
|
1677
1881
|
--performance
|
|
1678
|
-
|
|
1882
|
+
|
|
1679
1883
|
- name: Commit Generated Components
|
|
1680
1884
|
run: |
|
|
1681
1885
|
git config --local user.email "action@github.com"
|
|
@@ -1686,15 +1890,16 @@ jobs:
|
|
|
1686
1890
|
```
|
|
1687
1891
|
|
|
1688
1892
|
#### **Jenkins Pipeline**
|
|
1893
|
+
|
|
1689
1894
|
```groovy
|
|
1690
1895
|
pipeline {
|
|
1691
1896
|
agent any
|
|
1692
|
-
|
|
1897
|
+
|
|
1693
1898
|
stages {
|
|
1694
1899
|
stage('Generate SVG Components') {
|
|
1695
1900
|
steps {
|
|
1696
1901
|
sh '''
|
|
1697
|
-
npm install -g svger-cli@2.0.
|
|
1902
|
+
npm install -g svger-cli@2.0.4
|
|
1698
1903
|
svger-cli build \
|
|
1699
1904
|
--src ./assets/svg \
|
|
1700
1905
|
--out ./components \
|
|
@@ -1711,11 +1916,12 @@ pipeline {
|
|
|
1711
1916
|
```
|
|
1712
1917
|
|
|
1713
1918
|
### **Docker Integration**
|
|
1919
|
+
|
|
1714
1920
|
```dockerfile
|
|
1715
1921
|
FROM node:18-alpine
|
|
1716
1922
|
|
|
1717
1923
|
# Install SVGER-CLI globally
|
|
1718
|
-
RUN npm install -g svger-cli@2.0.
|
|
1924
|
+
RUN npm install -g svger-cli@2.0.4
|
|
1719
1925
|
|
|
1720
1926
|
# Set working directory
|
|
1721
1927
|
WORKDIR /app
|
|
@@ -1740,25 +1946,26 @@ COPY src/components ./src/components
|
|
|
1740
1946
|
## 🔌 **Plugin Development**
|
|
1741
1947
|
|
|
1742
1948
|
### **Creating Custom Plugins**
|
|
1949
|
+
|
|
1743
1950
|
```typescript
|
|
1744
1951
|
import { Plugin } from 'svger-cli';
|
|
1745
1952
|
|
|
1746
1953
|
const customOptimizer: Plugin = {
|
|
1747
1954
|
name: 'custom-svg-optimizer',
|
|
1748
1955
|
version: '1.0.0',
|
|
1749
|
-
|
|
1956
|
+
|
|
1750
1957
|
process: async (content: string, options?: any) => {
|
|
1751
1958
|
// Custom SVG processing logic
|
|
1752
1959
|
const optimized = content
|
|
1753
1960
|
.replace(/fill="none"/g, '')
|
|
1754
1961
|
.replace(/stroke="currentColor"/g, 'stroke="inherit"');
|
|
1755
|
-
|
|
1962
|
+
|
|
1756
1963
|
return optimized;
|
|
1757
1964
|
},
|
|
1758
|
-
|
|
1965
|
+
|
|
1759
1966
|
validate: (options?: any) => {
|
|
1760
1967
|
return options && typeof options.level === 'string';
|
|
1761
|
-
}
|
|
1968
|
+
},
|
|
1762
1969
|
};
|
|
1763
1970
|
|
|
1764
1971
|
// Register plugin
|
|
@@ -1767,6 +1974,7 @@ pluginManager.registerPlugin(customOptimizer);
|
|
|
1767
1974
|
```
|
|
1768
1975
|
|
|
1769
1976
|
### **Plugin Configuration**
|
|
1977
|
+
|
|
1770
1978
|
```json
|
|
1771
1979
|
{
|
|
1772
1980
|
"plugins": [
|
|
@@ -1793,6 +2001,7 @@ pluginManager.registerPlugin(customOptimizer);
|
|
|
1793
2001
|
### **Common Issues**
|
|
1794
2002
|
|
|
1795
2003
|
#### **Memory Issues**
|
|
2004
|
+
|
|
1796
2005
|
```bash
|
|
1797
2006
|
# If experiencing memory issues with large batches
|
|
1798
2007
|
svger-cli build \
|
|
@@ -1803,6 +2012,7 @@ svger-cli build \
|
|
|
1803
2012
|
```
|
|
1804
2013
|
|
|
1805
2014
|
#### **Performance Issues**
|
|
2015
|
+
|
|
1806
2016
|
```bash
|
|
1807
2017
|
# Enable performance monitoring
|
|
1808
2018
|
svger-cli performance --analyze
|
|
@@ -1815,6 +2025,7 @@ svger-cli performance --optimize
|
|
|
1815
2025
|
```
|
|
1816
2026
|
|
|
1817
2027
|
#### **TypeScript Errors**
|
|
2028
|
+
|
|
1818
2029
|
```bash
|
|
1819
2030
|
# Validate configuration
|
|
1820
2031
|
svger-cli config --validate
|
|
@@ -1824,6 +2035,7 @@ svger-cli build --typescript --strict
|
|
|
1824
2035
|
```
|
|
1825
2036
|
|
|
1826
2037
|
### **Debugging**
|
|
2038
|
+
|
|
1827
2039
|
```bash
|
|
1828
2040
|
# Enable verbose logging
|
|
1829
2041
|
svger-cli build --verbose --src ./icons --out ./components
|
|
@@ -1840,10 +2052,11 @@ svger-cli build --performance --memory
|
|
|
1840
2052
|
## 📚 **Migration Guide**
|
|
1841
2053
|
|
|
1842
2054
|
### **From SVGR**
|
|
2055
|
+
|
|
1843
2056
|
```bash
|
|
1844
2057
|
# Install SVGER-CLI
|
|
1845
2058
|
npm uninstall @svgr/webpack @svgr/cli
|
|
1846
|
-
npm install -g svger-cli@2.0.
|
|
2059
|
+
npm install -g svger-cli@2.0.4
|
|
1847
2060
|
|
|
1848
2061
|
# Migrate configuration
|
|
1849
2062
|
svger-cli init --framework react --typescript
|
|
@@ -1853,9 +2066,10 @@ svger-cli build --src ./assets --out ./components
|
|
|
1853
2066
|
```
|
|
1854
2067
|
|
|
1855
2068
|
### **From v1.x**
|
|
2069
|
+
|
|
1856
2070
|
```bash
|
|
1857
2071
|
# Upgrade to v2.0
|
|
1858
|
-
npm install -g svger-cli@2.0.
|
|
2072
|
+
npm install -g svger-cli@2.0.4
|
|
1859
2073
|
|
|
1860
2074
|
# Migrate configuration
|
|
1861
2075
|
svger-cli config --migrate
|
|
@@ -1869,37 +2083,44 @@ svger-cli build --framework react --responsive --theme dark
|
|
|
1869
2083
|
## 🤝 **Contributing & Support**
|
|
1870
2084
|
|
|
1871
2085
|
### **Contributing**
|
|
2086
|
+
|
|
1872
2087
|
1. Fork the repository
|
|
1873
2088
|
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
1874
2089
|
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
1875
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
2090
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
1876
2091
|
5. Open a Pull Request
|
|
1877
2092
|
|
|
1878
2093
|
### **Support**
|
|
2094
|
+
|
|
1879
2095
|
- 📧 **Email**: navidrezadoost07@gmail.com
|
|
1880
2096
|
- 🐛 **Issues**: [GitHub Issues](https://github.com/faezemohades/svger-cli/issues)
|
|
1881
2097
|
- 📖 **Documentation**: [docs.svger-cli.com](https://docs.svger-cli.com)
|
|
1882
2098
|
|
|
1883
|
-
|
|
1884
2099
|
---
|
|
1885
2100
|
|
|
1886
2101
|
## 📄 **License & Acknowledgements**
|
|
1887
2102
|
|
|
1888
2103
|
### **License**
|
|
2104
|
+
|
|
1889
2105
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
1890
2106
|
|
|
1891
2107
|
### **Acknowledgements**
|
|
1892
2108
|
|
|
1893
2109
|
This project was developed through the collaborative efforts of:
|
|
1894
2110
|
|
|
1895
|
-
- **🏗️ Architecture Design**: [ADR-001](./docs/ADR-SVG-INTRGRATION-METHODS-001.adr.md) authored by
|
|
1896
|
-
|
|
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**
|
|
1897
2116
|
- **💻 Implementation**: **Navid Rezadoost** - Faeze Mohades Lead developer and package maintainer
|
|
1898
2117
|
- **🏢 Enterprise Architecture**: SVGER Development Team
|
|
1899
2118
|
|
|
1900
|
-
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.
|
|
1901
2121
|
|
|
1902
2122
|
### **Special Thanks**
|
|
2123
|
+
|
|
1903
2124
|
- The open-source community for inspiration and feedback
|
|
1904
2125
|
- Framework maintainers for excellent documentation
|
|
1905
2126
|
- Beta testers who provided valuable insights
|
|
@@ -1907,4 +2128,4 @@ Their guidance and documentation on SVG integration methods in React, Vue, and o
|
|
|
1907
2128
|
|
|
1908
2129
|
---
|
|
1909
2130
|
|
|
1910
|
-
**© 2025 SVGER-CLI Development Team. Built with ❤️ for the developer community.**
|
|
2131
|
+
**© 2025 SVGER-CLI Development Team. Built with ❤️ for the developer community.**
|