svger-cli 1.0.6 → 1.0.8
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/CODE_OF_CONDUCT.md +79 -0
- package/CONTRIBUTING.md +146 -0
- package/LICENSE +21 -0
- package/README.md +1862 -73
- package/TESTING.md +143 -0
- package/cli-framework.test.js +16 -0
- package/cli-test-angular/Arrowbenddownleft.component.ts +27 -0
- package/cli-test-angular/Vite.component.ts +27 -0
- package/cli-test-angular/index.ts +25 -0
- package/{my-icons/ArrowBendDownLeft.tsx → cli-test-output/Arrowbenddownleft.vue} +28 -12
- package/{my-icons/Vite.tsx → cli-test-output/Vite.vue} +28 -12
- package/cli-test-output/index.ts +25 -0
- package/cli-test-react/Arrowbenddownleft.tsx +39 -0
- package/cli-test-react/Vite.tsx +39 -0
- package/cli-test-react/index.ts +25 -0
- package/cli-test-svelte/Arrowbenddownleft.svelte +22 -0
- package/cli-test-svelte/Vite.svelte +22 -0
- package/cli-test-svelte/index.ts +25 -0
- package/dist/builder.js +12 -13
- package/dist/clean.js +3 -3
- package/dist/cli.js +139 -61
- package/dist/config.d.ts +1 -1
- package/dist/config.js +5 -7
- package/dist/lock.js +1 -1
- package/dist/templates/ComponentTemplate.d.ts +15 -0
- package/dist/templates/ComponentTemplate.js +15 -0
- package/dist/watch.d.ts +2 -1
- package/dist/watch.js +30 -33
- 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/frameworks.test.js +170 -0
- package/package.json +8 -10
- package/src/builder.ts +12 -13
- package/src/clean.ts +3 -3
- package/src/cli.ts +148 -59
- package/src/config.ts +5 -6
- package/src/core/error-handler.ts +303 -0
- package/src/core/framework-templates.ts +428 -0
- package/src/core/logger.ts +104 -0
- package/src/core/performance-engine.ts +327 -0
- package/src/core/plugin-manager.ts +228 -0
- package/src/core/style-compiler.ts +605 -0
- package/src/core/template-manager.ts +619 -0
- package/src/index.ts +235 -0
- package/src/lock.ts +1 -1
- package/src/processors/svg-processor.ts +288 -0
- package/src/services/config.ts +241 -0
- package/src/services/file-watcher.ts +218 -0
- package/src/services/svg-service.ts +468 -0
- package/src/types/index.ts +169 -0
- package/src/utils/native.ts +352 -0
- package/src/watch.ts +36 -36
- package/test-output-mulit/TestIcon-angular-module.component.ts +26 -0
- package/test-output-mulit/TestIcon-angular-standalone.component.ts +27 -0
- package/test-output-mulit/TestIcon-lit.ts +35 -0
- package/test-output-mulit/TestIcon-preact.tsx +38 -0
- package/test-output-mulit/TestIcon-react.tsx +35 -0
- package/test-output-mulit/TestIcon-solid.tsx +27 -0
- package/test-output-mulit/TestIcon-svelte.svelte +22 -0
- package/test-output-mulit/TestIcon-vanilla.ts +37 -0
- package/test-output-mulit/TestIcon-vue-composition.vue +33 -0
- package/test-output-mulit/TestIcon-vue-options.vue +31 -0
- package/tsconfig.json +11 -9
package/TESTING.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# SVGER-CLI Testing Guide
|
|
2
|
+
|
|
3
|
+
## Automated Framework Tests
|
|
4
|
+
|
|
5
|
+
The project includes comprehensive testing for all 8 supported frameworks.
|
|
6
|
+
|
|
7
|
+
### Run All Framework Tests
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
node test-frameworks.js
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This test suite validates:
|
|
14
|
+
- ✅ Component generation for React, Vue, Svelte, Angular, Solid, Preact, Lit, Vanilla
|
|
15
|
+
- ✅ TypeScript type correctness
|
|
16
|
+
- ✅ Framework-specific patterns and best practices
|
|
17
|
+
- ✅ Correct file extensions per framework
|
|
18
|
+
- ✅ Code syntax validity
|
|
19
|
+
|
|
20
|
+
### Test Output
|
|
21
|
+
|
|
22
|
+
All generated test components are saved to `test-output/` directory for manual inspection.
|
|
23
|
+
|
|
24
|
+
## Manual CLI Testing
|
|
25
|
+
|
|
26
|
+
### Test React (Default)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
svger-cli build my-svgs test-react
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Expected: `.tsx` files with React.forwardRef components
|
|
33
|
+
|
|
34
|
+
### Test Vue Composition API
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
svger-cli build my-svgs test-vue --framework vue --composition
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Expected: `.vue` files with `<script setup lang="ts">`
|
|
41
|
+
|
|
42
|
+
### Test Vue Options API
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
svger-cli build my-svgs test-vue-options --framework vue
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Expected: `.vue` files with `defineComponent`
|
|
49
|
+
|
|
50
|
+
### Test Svelte
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
svger-cli build my-svgs test-svelte --framework svelte
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Expected: `.svelte` files with TypeScript props
|
|
57
|
+
|
|
58
|
+
### Test Angular Standalone
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
svger-cli build my-svgs test-angular --framework angular --standalone
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Expected: `.component.ts` files with `standalone: true`
|
|
65
|
+
|
|
66
|
+
### Test Angular Module
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
svger-cli build my-svgs test-angular-module --framework angular
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Expected: `.component.ts` files without standalone flag
|
|
73
|
+
|
|
74
|
+
### Test Solid
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
svger-cli build my-svgs test-solid --framework solid
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Expected: `.tsx` files with Solid Component types
|
|
81
|
+
|
|
82
|
+
### Test Preact
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
svger-cli build my-svgs test-preact --framework preact
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Expected: `.tsx` files with Preact FunctionComponent
|
|
89
|
+
|
|
90
|
+
### Test Lit
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
svger-cli build my-svgs test-lit --framework lit
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Expected: `.ts` files with @customElement decorator
|
|
97
|
+
|
|
98
|
+
### Test Vanilla JS
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
svger-cli build my-svgs test-vanilla --framework vanilla
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Expected: `.ts` files with factory functions
|
|
105
|
+
|
|
106
|
+
## Build Verification
|
|
107
|
+
|
|
108
|
+
After making changes:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Clean build
|
|
112
|
+
npm run build
|
|
113
|
+
|
|
114
|
+
# Run automated tests
|
|
115
|
+
node test-frameworks.js
|
|
116
|
+
|
|
117
|
+
# Manual CLI test
|
|
118
|
+
svger-cli build my-svgs test-output --framework vue
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Test Results
|
|
122
|
+
|
|
123
|
+
Latest test run (2025-11-07):
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
Total Tests: 10
|
|
127
|
+
✅ Passed: 10
|
|
128
|
+
❌ Failed: 0
|
|
129
|
+
|
|
130
|
+
Frameworks Tested:
|
|
131
|
+
- React ✅
|
|
132
|
+
- Vue (Composition) ✅
|
|
133
|
+
- Vue (Options) ✅
|
|
134
|
+
- Svelte ✅
|
|
135
|
+
- Angular (Standalone) ✅
|
|
136
|
+
- Angular (Module) ✅
|
|
137
|
+
- Solid ✅
|
|
138
|
+
- Preact ✅
|
|
139
|
+
- Lit ✅
|
|
140
|
+
- Vanilla ✅
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
All frameworks generate valid, idiomatic components that follow framework best practices.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { svgProcessor } from './dist/processors/svg-processor.js';
|
|
4
|
+
import { frameworkTemplateEngine } from './dist/index.js';
|
|
5
|
+
|
|
6
|
+
// Test file extension generation
|
|
7
|
+
console.log('\n📋 Testing File Extension Generation:\n');
|
|
8
|
+
|
|
9
|
+
const frameworks = ['react', 'vue', 'svelte', 'angular', 'solid', 'preact', 'lit', 'vanilla'];
|
|
10
|
+
|
|
11
|
+
frameworks.forEach(fw => {
|
|
12
|
+
const ext = frameworkTemplateEngine.getFileExtension(fw, true);
|
|
13
|
+
console.log(` ${fw.padEnd(10)} => .${ext}`);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
console.log('\n✅ Framework file extensions working correctly!\n');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'arrowbenddownleft',
|
|
5
|
+
standalone: true,
|
|
6
|
+
template: `
|
|
7
|
+
<svg
|
|
8
|
+
[attr.class]="className"
|
|
9
|
+
[attr.width]="width"
|
|
10
|
+
[attr.height]="height"
|
|
11
|
+
[attr.fill]="fill"
|
|
12
|
+
[attr.stroke]="stroke"
|
|
13
|
+
viewBox="0 0 24 24"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
>
|
|
16
|
+
<g id="surface1"><path d="M 2.25 5.25 C 2.253906 7.835938 3.28125 10.3125 5.109375 12.140625 C 6.9375 13.96875 9.414062 14.996094 12 15 L 19.1875 15 L 15.96875 18.21875 C 15.828125 18.359375 15.75 18.550781 15.75 18.75 C 15.75 18.949219 15.828125 19.140625 15.96875 19.28125 C 16.109375 19.421875 16.300781 19.5 16.5 19.5 C 16.699219 19.5 16.890625 19.421875 17.03125 19.28125 L 21.53125 14.78125 C 21.601562 14.710938 21.65625 14.628906 21.691406 14.539062 C 21.730469 14.445312 21.75 14.347656 21.75 14.25 C 21.75 14.152344 21.730469 14.054688 21.691406 13.960938 C 21.65625 13.871094 21.601562 13.789062 21.53125 13.71875 L 17.03125 9.21875 C 16.890625 9.078125 16.699219 9 16.5 9 C 16.300781 9 16.109375 9.078125 15.96875 9.21875 C 15.828125 9.359375 15.75 9.550781 15.75 9.75 C 15.75 9.949219 15.828125 10.140625 15.96875 10.28125 L 19.1875 13.5 L 12 13.5 C 9.8125 13.496094 7.714844 12.628906 6.167969 11.082031 C 4.621094 9.535156 3.75 7.4375 3.75 5.25 C 3.75 5.050781 3.671875 4.859375 3.53125 4.71875 C 3.390625 4.578125 3.199219 4.5 3 4.5 C 2.800781 4.5 2.609375 4.578125 2.46875 4.71875 C 2.328125 4.859375 2.25 5.050781 2.25 5.25 Z M 2.25 5.25 "/></g>
|
|
17
|
+
</svg>
|
|
18
|
+
`,
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
20
|
+
})
|
|
21
|
+
export class ArrowbenddownleftComponent {
|
|
22
|
+
@Input() className: string = '';
|
|
23
|
+
@Input() width: string | number = 24;
|
|
24
|
+
@Input() height: string | number = 24;
|
|
25
|
+
@Input() fill: string = 'currentColor';
|
|
26
|
+
@Input() stroke: string = '';
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'vite',
|
|
5
|
+
standalone: true,
|
|
6
|
+
template: `
|
|
7
|
+
<svg
|
|
8
|
+
[attr.class]="className"
|
|
9
|
+
[attr.width]="width"
|
|
10
|
+
[attr.height]="height"
|
|
11
|
+
[attr.fill]="fill"
|
|
12
|
+
[attr.stroke]="stroke"
|
|
13
|
+
viewBox="0 0 24 24"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
>
|
|
16
|
+
<defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path>
|
|
17
|
+
</svg>
|
|
18
|
+
`,
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
20
|
+
})
|
|
21
|
+
export class ViteComponent {
|
|
22
|
+
@Input() className: string = '';
|
|
23
|
+
@Input() width: string | number = 24;
|
|
24
|
+
@Input() height: string | number = 24;
|
|
25
|
+
@Input() fill: string = 'currentColor';
|
|
26
|
+
@Input() stroke: string = '';
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG Components Index
|
|
3
|
+
* Generated by svger-cli
|
|
4
|
+
*
|
|
5
|
+
* Import individual components:
|
|
6
|
+
* import { Arrowbenddownleft } from './components';
|
|
7
|
+
*
|
|
8
|
+
* Import all components:
|
|
9
|
+
* import * as Icons from './components';
|
|
10
|
+
* import Icons from './components'; // default export
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { default as Arrowbenddownleft } from './Arrowbenddownleft';
|
|
14
|
+
export { default as Vite } from './Vite';
|
|
15
|
+
// Export all components
|
|
16
|
+
export {
|
|
17
|
+
Arrowbenddownleft,
|
|
18
|
+
Vite,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Re-export for convenience
|
|
22
|
+
export default {
|
|
23
|
+
Arrowbenddownleft,
|
|
24
|
+
Vite,
|
|
25
|
+
};
|
|
@@ -1,17 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
const SvgArrowBendDownLeft = (props: SVGProps<SVGSVGElement>) => (
|
|
1
|
+
<template>
|
|
3
2
|
<svg
|
|
4
|
-
|
|
3
|
+
:class="className"
|
|
4
|
+
:style="style"
|
|
5
|
+
:width="width || 24"
|
|
6
|
+
:height="height || 24"
|
|
7
|
+
:fill="fill || 'currentColor'"
|
|
8
|
+
:stroke="stroke"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
5
10
|
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
-
|
|
7
|
-
width={props.width || 24}
|
|
8
|
-
height={props.height || 32}
|
|
9
|
-
fill={props.fill || "currentColor"}
|
|
10
|
-
stroke={props.stroke || "none"}
|
|
11
|
-
className={props.className}
|
|
12
|
-
{...props}
|
|
11
|
+
v-bind="$attrs"
|
|
13
12
|
>
|
|
14
13
|
<g id="surface1"><path d="M 2.25 5.25 C 2.253906 7.835938 3.28125 10.3125 5.109375 12.140625 C 6.9375 13.96875 9.414062 14.996094 12 15 L 19.1875 15 L 15.96875 18.21875 C 15.828125 18.359375 15.75 18.550781 15.75 18.75 C 15.75 18.949219 15.828125 19.140625 15.96875 19.28125 C 16.109375 19.421875 16.300781 19.5 16.5 19.5 C 16.699219 19.5 16.890625 19.421875 17.03125 19.28125 L 21.53125 14.78125 C 21.601562 14.710938 21.65625 14.628906 21.691406 14.539062 C 21.730469 14.445312 21.75 14.347656 21.75 14.25 C 21.75 14.152344 21.730469 14.054688 21.691406 13.960938 C 21.65625 13.871094 21.601562 13.789062 21.53125 13.71875 L 17.03125 9.21875 C 16.890625 9.078125 16.699219 9 16.5 9 C 16.300781 9 16.109375 9.078125 15.96875 9.21875 C 15.828125 9.359375 15.75 9.550781 15.75 9.75 C 15.75 9.949219 15.828125 10.140625 15.96875 10.28125 L 19.1875 13.5 L 12 13.5 C 9.8125 13.496094 7.714844 12.628906 6.167969 11.082031 C 4.621094 9.535156 3.75 7.4375 3.75 5.25 C 3.75 5.050781 3.671875 4.859375 3.53125 4.71875 C 3.390625 4.578125 3.199219 4.5 3 4.5 C 2.800781 4.5 2.609375 4.578125 2.46875 4.71875 C 2.328125 4.859375 2.25 5.050781 2.25 5.25 Z M 2.25 5.25 "/></g>
|
|
15
14
|
</svg>
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
interface Props {
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: string | Record<string, any>;
|
|
21
|
+
width?: string | number;
|
|
22
|
+
height?: string | number;
|
|
23
|
+
fill?: string;
|
|
24
|
+
stroke?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
withDefaults(defineProps<Props>(), {
|
|
28
|
+
className: '',
|
|
29
|
+
fill: 'currentColor',
|
|
30
|
+
width: 24,
|
|
31
|
+
height: 24
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
@@ -1,17 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
const SvgVite = (props: SVGProps<SVGSVGElement>) => (
|
|
1
|
+
<template>
|
|
3
2
|
<svg
|
|
4
|
-
|
|
3
|
+
:class="className"
|
|
4
|
+
:style="style"
|
|
5
|
+
:width="width || 24"
|
|
6
|
+
:height="height || 24"
|
|
7
|
+
:fill="fill || 'currentColor'"
|
|
8
|
+
:stroke="stroke"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
5
10
|
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
-
|
|
7
|
-
width={props.width || 24}
|
|
8
|
-
height={props.height || 32}
|
|
9
|
-
fill={props.fill || "currentColor"}
|
|
10
|
-
stroke={props.stroke || "none"}
|
|
11
|
-
className={props.className}
|
|
12
|
-
{...props}
|
|
11
|
+
v-bind="$attrs"
|
|
13
12
|
>
|
|
14
13
|
<defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path>
|
|
15
14
|
</svg>
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
interface Props {
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: string | Record<string, any>;
|
|
21
|
+
width?: string | number;
|
|
22
|
+
height?: string | number;
|
|
23
|
+
fill?: string;
|
|
24
|
+
stroke?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
withDefaults(defineProps<Props>(), {
|
|
28
|
+
className: '',
|
|
29
|
+
fill: 'currentColor',
|
|
30
|
+
width: 24,
|
|
31
|
+
height: 24
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG Components Index
|
|
3
|
+
* Generated by svger-cli
|
|
4
|
+
*
|
|
5
|
+
* Import individual components:
|
|
6
|
+
* import { Arrowbenddownleft } from './components';
|
|
7
|
+
*
|
|
8
|
+
* Import all components:
|
|
9
|
+
* import * as Icons from './components';
|
|
10
|
+
* import Icons from './components'; // default export
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { default as Arrowbenddownleft } from './Arrowbenddownleft';
|
|
14
|
+
export { default as Vite } from './Vite';
|
|
15
|
+
// Export all components
|
|
16
|
+
export {
|
|
17
|
+
Arrowbenddownleft,
|
|
18
|
+
Vite,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Re-export for convenience
|
|
22
|
+
export default {
|
|
23
|
+
Arrowbenddownleft,
|
|
24
|
+
Vite,
|
|
25
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SVGProps } from "react";
|
|
3
|
+
|
|
4
|
+
export interface ArrowbenddownleftProps extends SVGProps<SVGSVGElement> {
|
|
5
|
+
size?: number | string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Arrowbenddownleft SVG Component
|
|
10
|
+
* Generated by svger-cli
|
|
11
|
+
*/
|
|
12
|
+
const Arrowbenddownleft = React.forwardRef<SVGSVGElement, ArrowbenddownleftProps>(
|
|
13
|
+
({ size, className, style, ...props }, ref) => {
|
|
14
|
+
const dimensions = size ? { width: size, height: size } : {
|
|
15
|
+
width: props.width || 24,
|
|
16
|
+
height: props.height || 32
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<svg
|
|
21
|
+
ref={ref}
|
|
22
|
+
viewBox="0 0 24 32"
|
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
+
width={dimensions.width}
|
|
25
|
+
height={dimensions.height}
|
|
26
|
+
fill={props.fill || "currentColor"}
|
|
27
|
+
className={className}
|
|
28
|
+
style={style}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
<g id="surface1"><path d="M 2.25 5.25 C 2.253906 7.835938 3.28125 10.3125 5.109375 12.140625 C 6.9375 13.96875 9.414062 14.996094 12 15 L 19.1875 15 L 15.96875 18.21875 C 15.828125 18.359375 15.75 18.550781 15.75 18.75 C 15.75 18.949219 15.828125 19.140625 15.96875 19.28125 C 16.109375 19.421875 16.300781 19.5 16.5 19.5 C 16.699219 19.5 16.890625 19.421875 17.03125 19.28125 L 21.53125 14.78125 C 21.601562 14.710938 21.65625 14.628906 21.691406 14.539062 C 21.730469 14.445312 21.75 14.347656 21.75 14.25 C 21.75 14.152344 21.730469 14.054688 21.691406 13.960938 C 21.65625 13.871094 21.601562 13.789062 21.53125 13.71875 L 17.03125 9.21875 C 16.890625 9.078125 16.699219 9 16.5 9 C 16.300781 9 16.109375 9.078125 15.96875 9.21875 C 15.828125 9.359375 15.75 9.550781 15.75 9.75 C 15.75 9.949219 15.828125 10.140625 15.96875 10.28125 L 19.1875 13.5 L 12 13.5 C 9.8125 13.496094 7.714844 12.628906 6.167969 11.082031 C 4.621094 9.535156 3.75 7.4375 3.75 5.25 C 3.75 5.050781 3.671875 4.859375 3.53125 4.71875 C 3.390625 4.578125 3.199219 4.5 3 4.5 C 2.800781 4.5 2.609375 4.578125 2.46875 4.71875 C 2.328125 4.859375 2.25 5.050781 2.25 5.25 Z M 2.25 5.25 "/></g>
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
Arrowbenddownleft.displayName = "Arrowbenddownleft";
|
|
38
|
+
|
|
39
|
+
export default Arrowbenddownleft;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SVGProps } from "react";
|
|
3
|
+
|
|
4
|
+
export interface ViteProps extends SVGProps<SVGSVGElement> {
|
|
5
|
+
size?: number | string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Vite SVG Component
|
|
10
|
+
* Generated by svger-cli
|
|
11
|
+
*/
|
|
12
|
+
const Vite = React.forwardRef<SVGSVGElement, ViteProps>(
|
|
13
|
+
({ size, className, style, ...props }, ref) => {
|
|
14
|
+
const dimensions = size ? { width: size, height: size } : {
|
|
15
|
+
width: props.width || 24,
|
|
16
|
+
height: props.height || 32
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<svg
|
|
21
|
+
ref={ref}
|
|
22
|
+
viewBox="0 0 24 32"
|
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
+
width={dimensions.width}
|
|
25
|
+
height={dimensions.height}
|
|
26
|
+
fill={props.fill || "currentColor"}
|
|
27
|
+
className={className}
|
|
28
|
+
style={style}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
<defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path>
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
Vite.displayName = "Vite";
|
|
38
|
+
|
|
39
|
+
export default Vite;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG Components Index
|
|
3
|
+
* Generated by svger-cli
|
|
4
|
+
*
|
|
5
|
+
* Import individual components:
|
|
6
|
+
* import { Arrowbenddownleft } from './components';
|
|
7
|
+
*
|
|
8
|
+
* Import all components:
|
|
9
|
+
* import * as Icons from './components';
|
|
10
|
+
* import Icons from './components'; // default export
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { default as Arrowbenddownleft } from './Arrowbenddownleft';
|
|
14
|
+
export { default as Vite } from './Vite';
|
|
15
|
+
// Export all components
|
|
16
|
+
export {
|
|
17
|
+
Arrowbenddownleft,
|
|
18
|
+
Vite,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Re-export for convenience
|
|
22
|
+
export default {
|
|
23
|
+
Arrowbenddownleft,
|
|
24
|
+
Vite,
|
|
25
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export let className: string = '';
|
|
3
|
+
export let style: string = '';
|
|
4
|
+
export let width: string | number = 24;
|
|
5
|
+
export let height: string | number = 24;
|
|
6
|
+
export let fill: string = 'currentColor';
|
|
7
|
+
export let stroke: string = '';
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<svg
|
|
11
|
+
class={className}
|
|
12
|
+
{style}
|
|
13
|
+
{width}
|
|
14
|
+
{height}
|
|
15
|
+
{fill}
|
|
16
|
+
{stroke}
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
+
{...$$restProps}
|
|
20
|
+
>
|
|
21
|
+
<g id="surface1"><path d="M 2.25 5.25 C 2.253906 7.835938 3.28125 10.3125 5.109375 12.140625 C 6.9375 13.96875 9.414062 14.996094 12 15 L 19.1875 15 L 15.96875 18.21875 C 15.828125 18.359375 15.75 18.550781 15.75 18.75 C 15.75 18.949219 15.828125 19.140625 15.96875 19.28125 C 16.109375 19.421875 16.300781 19.5 16.5 19.5 C 16.699219 19.5 16.890625 19.421875 17.03125 19.28125 L 21.53125 14.78125 C 21.601562 14.710938 21.65625 14.628906 21.691406 14.539062 C 21.730469 14.445312 21.75 14.347656 21.75 14.25 C 21.75 14.152344 21.730469 14.054688 21.691406 13.960938 C 21.65625 13.871094 21.601562 13.789062 21.53125 13.71875 L 17.03125 9.21875 C 16.890625 9.078125 16.699219 9 16.5 9 C 16.300781 9 16.109375 9.078125 15.96875 9.21875 C 15.828125 9.359375 15.75 9.550781 15.75 9.75 C 15.75 9.949219 15.828125 10.140625 15.96875 10.28125 L 19.1875 13.5 L 12 13.5 C 9.8125 13.496094 7.714844 12.628906 6.167969 11.082031 C 4.621094 9.535156 3.75 7.4375 3.75 5.25 C 3.75 5.050781 3.671875 4.859375 3.53125 4.71875 C 3.390625 4.578125 3.199219 4.5 3 4.5 C 2.800781 4.5 2.609375 4.578125 2.46875 4.71875 C 2.328125 4.859375 2.25 5.050781 2.25 5.25 Z M 2.25 5.25 "/></g>
|
|
22
|
+
</svg>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export let className: string = '';
|
|
3
|
+
export let style: string = '';
|
|
4
|
+
export let width: string | number = 24;
|
|
5
|
+
export let height: string | number = 24;
|
|
6
|
+
export let fill: string = 'currentColor';
|
|
7
|
+
export let stroke: string = '';
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<svg
|
|
11
|
+
class={className}
|
|
12
|
+
{style}
|
|
13
|
+
{width}
|
|
14
|
+
{height}
|
|
15
|
+
{fill}
|
|
16
|
+
{stroke}
|
|
17
|
+
viewBox="0 0 24 24"
|
|
18
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
+
{...$$restProps}
|
|
20
|
+
>
|
|
21
|
+
<defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path>
|
|
22
|
+
</svg>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SVG Components Index
|
|
3
|
+
* Generated by svger-cli
|
|
4
|
+
*
|
|
5
|
+
* Import individual components:
|
|
6
|
+
* import { Arrowbenddownleft } from './components';
|
|
7
|
+
*
|
|
8
|
+
* Import all components:
|
|
9
|
+
* import * as Icons from './components';
|
|
10
|
+
* import Icons from './components'; // default export
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { default as Arrowbenddownleft } from './Arrowbenddownleft';
|
|
14
|
+
export { default as Vite } from './Vite';
|
|
15
|
+
// Export all components
|
|
16
|
+
export {
|
|
17
|
+
Arrowbenddownleft,
|
|
18
|
+
Vite,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Re-export for convenience
|
|
22
|
+
export default {
|
|
23
|
+
Arrowbenddownleft,
|
|
24
|
+
Vite,
|
|
25
|
+
};
|
package/dist/builder.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import fs from "fs-extra";
|
|
2
1
|
import path from "path";
|
|
3
|
-
import {
|
|
2
|
+
import { toPascalCase, FileSystem } from "./utils/native.js";
|
|
4
3
|
import { isLocked } from "./lock.js";
|
|
5
4
|
import { readConfig } from "./config.js";
|
|
6
5
|
import { reactTemplate } from "./templates/ComponentTemplate.js";
|
|
@@ -16,12 +15,12 @@ export async function buildAll(config) {
|
|
|
16
15
|
const svgConfig = readConfig();
|
|
17
16
|
const srcDir = path.resolve(config.src);
|
|
18
17
|
const outDir = path.resolve(config.out);
|
|
19
|
-
if (!
|
|
18
|
+
if (!(await FileSystem.exists(srcDir))) {
|
|
20
19
|
console.error("❌ Source folder not found:", srcDir);
|
|
21
20
|
process.exit(1);
|
|
22
21
|
}
|
|
23
|
-
await
|
|
24
|
-
const files = (await
|
|
22
|
+
await FileSystem.ensureDir(outDir);
|
|
23
|
+
const files = (await FileSystem.readDir(srcDir)).filter((f) => f.endsWith(".svg"));
|
|
25
24
|
if (!files.length) {
|
|
26
25
|
console.log("⚠️ No SVG files found in", srcDir);
|
|
27
26
|
return;
|
|
@@ -32,8 +31,8 @@ export async function buildAll(config) {
|
|
|
32
31
|
console.log(`⚠️ Skipped locked file: ${file}`);
|
|
33
32
|
continue;
|
|
34
33
|
}
|
|
35
|
-
const svgContent = await
|
|
36
|
-
const componentName =
|
|
34
|
+
const svgContent = await FileSystem.readFile(svgPath, "utf-8");
|
|
35
|
+
const componentName = toPascalCase(file.replace(".svg", ""));
|
|
37
36
|
const componentCode = reactTemplate({
|
|
38
37
|
componentName,
|
|
39
38
|
svgContent,
|
|
@@ -42,7 +41,7 @@ export async function buildAll(config) {
|
|
|
42
41
|
defaultFill: svgConfig.defaultFill,
|
|
43
42
|
});
|
|
44
43
|
const outFile = path.join(outDir, `${componentName}.tsx`);
|
|
45
|
-
await
|
|
44
|
+
await FileSystem.writeFile(outFile, componentCode, "utf-8");
|
|
46
45
|
console.log(`✅ Generated: ${componentName}.tsx`);
|
|
47
46
|
}
|
|
48
47
|
console.log("🎉 All SVGs have been converted successfully!");
|
|
@@ -62,12 +61,12 @@ export async function generateSVG({ svgFile, outDir, }) {
|
|
|
62
61
|
console.log(`⚠️ Skipped locked file: ${path.basename(svgFile)}`);
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
65
|
-
if (!
|
|
64
|
+
if (!(await FileSystem.exists(filePath))) {
|
|
66
65
|
console.error("❌ SVG file not found:", filePath);
|
|
67
66
|
process.exit(1);
|
|
68
67
|
}
|
|
69
|
-
const svgContent = await
|
|
70
|
-
const componentName =
|
|
68
|
+
const svgContent = await FileSystem.readFile(filePath, "utf-8");
|
|
69
|
+
const componentName = toPascalCase(path.basename(svgFile, ".svg"));
|
|
71
70
|
const componentCode = reactTemplate({
|
|
72
71
|
componentName,
|
|
73
72
|
svgContent,
|
|
@@ -76,8 +75,8 @@ export async function generateSVG({ svgFile, outDir, }) {
|
|
|
76
75
|
defaultFill: svgConfig.defaultFill,
|
|
77
76
|
});
|
|
78
77
|
const outputFolder = path.resolve(outDir);
|
|
79
|
-
await
|
|
78
|
+
await FileSystem.ensureDir(outputFolder);
|
|
80
79
|
const outFile = path.join(outputFolder, `${componentName}.tsx`);
|
|
81
|
-
await
|
|
80
|
+
await FileSystem.writeFile(outFile, componentCode, "utf-8");
|
|
82
81
|
console.log(`✅ Generated: ${componentName}.tsx`);
|
|
83
82
|
}
|
package/dist/clean.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import fs from "fs-extra";
|
|
2
1
|
import path from "path";
|
|
2
|
+
import { FileSystem } from "./utils/native.js";
|
|
3
3
|
/**
|
|
4
4
|
* Cleans the specified output directory by removing all files and folders inside it.
|
|
5
5
|
* Typically used to clear previously generated SVG React components before a new build.
|
|
@@ -9,10 +9,10 @@ import path from "path";
|
|
|
9
9
|
*/
|
|
10
10
|
export async function clean(outDir) {
|
|
11
11
|
const targetDir = path.resolve(outDir);
|
|
12
|
-
if (!
|
|
12
|
+
if (!(await FileSystem.exists(targetDir))) {
|
|
13
13
|
console.log(`⚠️ Directory not found: ${targetDir}`);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
await
|
|
16
|
+
await FileSystem.emptyDir(targetDir);
|
|
17
17
|
console.log(`🧹 Cleaned all generated SVG components in: ${targetDir}`);
|
|
18
18
|
}
|