svger-cli 4.0.4 โ 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +42 -32
- package/dist/core/performance-engine.d.ts +1 -0
- package/dist/core/performance-engine.js +11 -13
- package/dist/optimizers/basic-cleaner.js +3 -6
- package/dist/processors/svg-processor.d.ts +2 -0
- package/dist/processors/svg-processor.js +24 -25
- package/dist/services/svg-service.js +10 -3
- package/dist/watch.js +13 -6
- package/docs/api/media/ADR-SVG-INTRGRATION-METHODS-001.adr.md +157 -0
- package/docs/api/media/CICD.md +315 -0
- package/docs/api/media/INTEGRATIONS.md +543 -0
- package/docs/api/media/LICENSE +21 -0
- package/docs/api/media/PERFORMANCE-RESULTS.md +31 -0
- package/docs/api/media/README.md +364 -0
- package/docs/api/media/REAL-WORLD-BENCHMARKS.md +159 -0
- package/docs/api/media/SAMPLE-SVGS-TESTING.md +276 -0
- package/package.json +5 -5
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# ๐งช Interactive Testing with Sample SVGs
|
|
2
|
+
|
|
3
|
+
This package includes **500+ sample SVG files** and an interactive test utility to help you quickly evaluate svger-cli with real-world icons and logos.
|
|
4
|
+
|
|
5
|
+
## ๐ฆ What's Included
|
|
6
|
+
|
|
7
|
+
The `assets/svges/` directory contains:
|
|
8
|
+
- **500+ popular brand logos** (Google, Facebook, GitHub, etc.)
|
|
9
|
+
- **Common UI icons** (home, user, settings, etc.)
|
|
10
|
+
- **Various SVG complexity levels** (simple shapes to complex paths)
|
|
11
|
+
- **Real-world test cases** (different SVG structures and attributes)
|
|
12
|
+
|
|
13
|
+
## ๐ Quick Start
|
|
14
|
+
|
|
15
|
+
### Method 1: CLI Test Utility (Recommended)
|
|
16
|
+
|
|
17
|
+
After installing the package, you can run the interactive test utility:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Install globally
|
|
21
|
+
npm install -g svger-cli
|
|
22
|
+
|
|
23
|
+
# Run test with default settings (React, 10 files)
|
|
24
|
+
test-svger
|
|
25
|
+
|
|
26
|
+
# Test with Vue and TypeScript
|
|
27
|
+
test-svger --framework=vue --typescript
|
|
28
|
+
|
|
29
|
+
# Test with Angular, processing 20 files
|
|
30
|
+
test-svger --framework=angular --count=20
|
|
31
|
+
|
|
32
|
+
# Process all available SVGs
|
|
33
|
+
test-svger --count=999
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Output:**
|
|
37
|
+
```
|
|
38
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
39
|
+
โ SVGER-CLI Test Utility โ
|
|
40
|
+
โ Quick Test with Sample SVGs โ
|
|
41
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
42
|
+
|
|
43
|
+
โ Found 500+ sample SVG files
|
|
44
|
+
|
|
45
|
+
Sample SVGs (showing first 10):
|
|
46
|
+
1. google.svg
|
|
47
|
+
2. facebook.svg
|
|
48
|
+
3. github.svg
|
|
49
|
+
4. home.svg
|
|
50
|
+
5. user.svg
|
|
51
|
+
... and 495+ more
|
|
52
|
+
|
|
53
|
+
Test Configuration:
|
|
54
|
+
Framework: react
|
|
55
|
+
Files to process: 10
|
|
56
|
+
TypeScript: No
|
|
57
|
+
Output directory: ./svger-test-output
|
|
58
|
+
|
|
59
|
+
Running command:
|
|
60
|
+
svger-cli --input assets/svges --output ./svger-test-output --framework react
|
|
61
|
+
|
|
62
|
+
โ Test completed successfully!
|
|
63
|
+
Duration: 234ms
|
|
64
|
+
Output: ./svger-test-output
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Method 2: Direct CLI Usage
|
|
68
|
+
|
|
69
|
+
Use the sample SVGs directly with svger-cli:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Find the assets directory in your node_modules
|
|
73
|
+
svger-cli --input ./node_modules/svger-cli/assets/svges --output ./my-components
|
|
74
|
+
|
|
75
|
+
# Or if installed globally (location varies by system)
|
|
76
|
+
svger-cli --input $(npm root -g)/svger-cli/assets/svges --output ./my-components
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Method 3: Online Interactive Demo (No Install Required)
|
|
80
|
+
|
|
81
|
+
Try the **Live Benchmarking Tool** in your browser:
|
|
82
|
+
|
|
83
|
+
๐ **[https://faezemohades.github.io/svger-cli/#live-benchmark](https://faezemohades.github.io/svger-cli/#live-benchmark)**
|
|
84
|
+
|
|
85
|
+
Features:
|
|
86
|
+
- โ
Test with 10 pre-loaded sample SVGs
|
|
87
|
+
- โ
Upload your own SVG files (drag & drop)
|
|
88
|
+
- โ
Switch between frameworks (React, Vue, Angular, Svelte)
|
|
89
|
+
- โ
Real-time performance metrics
|
|
90
|
+
- โ
Export results as JSON
|
|
91
|
+
- โ
See generated component code
|
|
92
|
+
- โ
No installation required!
|
|
93
|
+
|
|
94
|
+
## ๐ Test Utility Options
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
test-svger [options]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
| Option | Description | Default |
|
|
101
|
+
|--------|-------------|---------|
|
|
102
|
+
| `--framework=<name>` | Framework to use (react, vue, angular, svelte, solid, lit, preact, react-native, vanilla) | `react` |
|
|
103
|
+
| `--count=<number>` | Number of SVG files to process | `10` |
|
|
104
|
+
| `--typescript` | Generate TypeScript components | `false` |
|
|
105
|
+
| `--help, -h` | Show help message | - |
|
|
106
|
+
|
|
107
|
+
## ๐ฏ Use Cases
|
|
108
|
+
|
|
109
|
+
### 1. **Quick Evaluation**
|
|
110
|
+
```bash
|
|
111
|
+
# Test before committing to use svger-cli
|
|
112
|
+
test-svger --count=5
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 2. **Framework Comparison**
|
|
116
|
+
```bash
|
|
117
|
+
# Compare output across frameworks
|
|
118
|
+
test-svger --framework=react --count=10
|
|
119
|
+
test-svger --framework=vue --count=10
|
|
120
|
+
test-svger --framework=angular --count=10
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 3. **Performance Benchmarking**
|
|
124
|
+
```bash
|
|
125
|
+
# Test with large batches
|
|
126
|
+
time test-svger --count=100
|
|
127
|
+
time test-svger --count=500
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 4. **TypeScript Generation**
|
|
131
|
+
```bash
|
|
132
|
+
# Test TypeScript output quality
|
|
133
|
+
test-svger --framework=react --typescript --count=20
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 5. **Integration Testing**
|
|
137
|
+
```bash
|
|
138
|
+
# Use in CI/CD pipelines
|
|
139
|
+
test-svger --count=50 && echo "โ Integration test passed"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## ๐ Package Structure
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
svger-cli/
|
|
146
|
+
โโโ bin/
|
|
147
|
+
โ โโโ svg-tool.js # Main CLI
|
|
148
|
+
โ โโโ test-svger.js # Test utility (NEW!)
|
|
149
|
+
โโโ assets/
|
|
150
|
+
โ โโโ svges/ # 500+ sample SVGs (NEW!)
|
|
151
|
+
โ โโโ google.svg
|
|
152
|
+
โ โโโ facebook.svg
|
|
153
|
+
โ โโโ github.svg
|
|
154
|
+
โ โโโ ... 500+ more
|
|
155
|
+
โโโ dist/ # Compiled code
|
|
156
|
+
โโโ package.json
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## ๐ก Tips
|
|
160
|
+
|
|
161
|
+
### Finding Sample SVGs Location
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# If installed globally
|
|
165
|
+
npm root -g
|
|
166
|
+
|
|
167
|
+
# If installed locally
|
|
168
|
+
npm root
|
|
169
|
+
|
|
170
|
+
# Then navigate to svger-cli/assets/svges
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Using Specific SVGs
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Test with only brand logos
|
|
177
|
+
svger-cli --input ./node_modules/svger-cli/assets/svges --include="google|facebook|github" --output ./brands
|
|
178
|
+
|
|
179
|
+
# Test with specific file patterns
|
|
180
|
+
svger-cli --input ./node_modules/svger-cli/assets/svges --include=".*icon.*" --output ./icons
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Copying Sample SVGs
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Copy to your project for customization
|
|
187
|
+
cp -r ./node_modules/svger-cli/assets/svges ./my-test-svgs
|
|
188
|
+
svger-cli --input ./my-test-svgs --output ./components
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## ๐ Online Demo vs CLI Test
|
|
192
|
+
|
|
193
|
+
| Feature | Online Demo | CLI Test Utility |
|
|
194
|
+
|---------|-------------|------------------|
|
|
195
|
+
| **Installation** | None required | npm install needed |
|
|
196
|
+
| **Speed** | In-browser (slower) | Native (faster) |
|
|
197
|
+
| **File Count** | 10 samples or upload | 500+ included |
|
|
198
|
+
| **Frameworks** | 4 options | 9+ options |
|
|
199
|
+
| **Output** | View only | Real files |
|
|
200
|
+
| **Customization** | Limited | Full CLI options |
|
|
201
|
+
| **Use Case** | Quick preview | Development & testing |
|
|
202
|
+
|
|
203
|
+
**Recommendation:**
|
|
204
|
+
- ๐ Use **Online Demo** for quick evaluation
|
|
205
|
+
- ๐ป Use **CLI Test Utility** for serious testing
|
|
206
|
+
|
|
207
|
+
## ๐ Example Workflow
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# 1. Try online demo first
|
|
211
|
+
open https://faezemohades.github.io/svger-cli/#live-benchmark
|
|
212
|
+
|
|
213
|
+
# 2. Install if you like what you see
|
|
214
|
+
npm install -g svger-cli
|
|
215
|
+
|
|
216
|
+
# 3. Run quick test
|
|
217
|
+
test-svger
|
|
218
|
+
|
|
219
|
+
# 4. Check the output
|
|
220
|
+
cd svger-test-output
|
|
221
|
+
ls -la
|
|
222
|
+
|
|
223
|
+
# 5. Test with your framework
|
|
224
|
+
test-svger --framework=vue --typescript
|
|
225
|
+
|
|
226
|
+
# 6. Use with your real SVGs
|
|
227
|
+
svger-cli --input ./my-svgs --output ./components --framework=vue --typescript
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## ๐ Sample SVGs Categories
|
|
231
|
+
|
|
232
|
+
The included SVGs cover various categories:
|
|
233
|
+
|
|
234
|
+
- **Brands**: Google, Facebook, GitHub, Twitter, LinkedIn, etc. (200+)
|
|
235
|
+
- **UI Icons**: Home, User, Settings, Search, etc. (100+)
|
|
236
|
+
- **Shapes**: Circles, Squares, Triangles, etc. (50+)
|
|
237
|
+
- **Tech Logos**: React, Vue, Angular, Docker, AWS, etc. (100+)
|
|
238
|
+
- **Misc**: Flags, Emojis, Symbols, etc. (50+)
|
|
239
|
+
|
|
240
|
+
## ๐จ Important Notes
|
|
241
|
+
|
|
242
|
+
1. **Sample SVGs are for testing only** - They are publicly available icons and logos. Check licensing before using in production.
|
|
243
|
+
|
|
244
|
+
2. **Not all SVGs may work perfectly** - Some complex SVGs might need manual adjustment. This is intentional to provide realistic test cases.
|
|
245
|
+
|
|
246
|
+
3. **Output directory** - The test utility creates `svger-test-output` in your current directory. You can delete it after testing.
|
|
247
|
+
|
|
248
|
+
4. **Package size** - Including 500+ SVGs adds ~2-3MB to the package. This is acceptable for a testing utility but be aware if disk space is critical.
|
|
249
|
+
|
|
250
|
+
## ๐ค Contributing
|
|
251
|
+
|
|
252
|
+
Have interesting SVG test cases? Contribute them!
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Fork the repo
|
|
256
|
+
git clone https://github.com/faezemohades/svger-cli
|
|
257
|
+
cd svger-cli
|
|
258
|
+
|
|
259
|
+
# Add your SVG to assets/svges/
|
|
260
|
+
cp your-test.svg assets/svges/
|
|
261
|
+
|
|
262
|
+
# Submit PR
|
|
263
|
+
git add assets/svges/your-test.svg
|
|
264
|
+
git commit -m "Add your-test.svg for testing"
|
|
265
|
+
git push
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## ๐ More Information
|
|
269
|
+
|
|
270
|
+
- **Documentation**: [https://github.com/faezemohades/svger-cli](https://github.com/faezemohades/svger-cli)
|
|
271
|
+
- **Live Demo**: [https://faezemohades.github.io/svger-cli/#live-benchmark](https://faezemohades.github.io/svger-cli/#live-benchmark)
|
|
272
|
+
- **Issues**: [https://github.com/faezemohades/svger-cli/issues](https://github.com/faezemohades/svger-cli/issues)
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
**Happy Testing!** ๐
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svger-cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "Enterprise-grade SVG to component converter with advanced plugin system, visual diff testing, and official framework integrations. Supporting React, React Native, Vue, Angular, Svelte, Solid, Lit, Preact & Vanilla. Features TypeScript, HMR, optimization pipeline, and extensible architecture.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
"test:config": "tsc tests/config-options.test.ts --outDir dist-tests --module es2022 --target es2022 --moduleResolution bundler && node dist-tests/config-options.test.js",
|
|
95
95
|
"test:e2e": "tsc tests/e2e-complete.test.ts --outDir dist-tests --module es2022 --target es2022 --moduleResolution bundler && node dist-tests/e2e-complete.test.js",
|
|
96
96
|
"test:integrations": "node tests/integrations/verify-integrations.mjs",
|
|
97
|
-
"test:visual": "node test-visual-diff.js",
|
|
98
|
-
"test:visual:integration": "node test-visual-integration.js",
|
|
99
|
-
"test:visual:ci": "node test-visual-integration.js --strict",
|
|
100
|
-
"test:visual:update": "UPDATE_SNAPSHOTS=1 node test-visual-diff.js",
|
|
97
|
+
"test:visual": "node tests/dev/test-visual-diff.js",
|
|
98
|
+
"test:visual:integration": "node tests/dev/test-visual-integration.js",
|
|
99
|
+
"test:visual:ci": "node tests/dev/test-visual-integration.js --strict",
|
|
100
|
+
"test:visual:update": "UPDATE_SNAPSHOTS=1 node tests/dev/test-visual-diff.js",
|
|
101
101
|
"test:watch": "jest --watch",
|
|
102
102
|
"test:coverage": "jest --coverage",
|
|
103
103
|
"test:integration": "jest --testPathPattern=integration",
|