svger-cli 2.0.1 → 2.0.3
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 +38 -0
- package/CHANGELOG.md +64 -0
- package/DEVELOPMENT.md +353 -0
- package/README.md +24 -5
- 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 +11 -11
- package/dist/core/error-handler.d.ts +63 -0
- package/dist/core/error-handler.js +227 -0
- package/dist/core/framework-templates.d.ts +17 -0
- package/{src/core/framework-templates.ts → dist/core/framework-templates.js} +104 -139
- package/dist/core/logger.d.ts +22 -0
- package/dist/core/logger.js +85 -0
- package/dist/core/performance-engine.d.ts +67 -0
- package/dist/core/performance-engine.js +252 -0
- package/dist/core/plugin-manager.d.ts +56 -0
- package/dist/core/plugin-manager.js +191 -0
- package/dist/core/style-compiler.d.ts +88 -0
- package/dist/core/style-compiler.js +468 -0
- package/dist/core/template-manager.d.ts +64 -0
- package/{src/core/template-manager.ts → dist/core/template-manager.js} +172 -255
- package/dist/index.d.ts +153 -0
- package/{src/index.ts → dist/index.js} +32 -110
- package/dist/lock.js +7 -7
- package/dist/processors/svg-processor.d.ts +73 -0
- package/dist/processors/svg-processor.js +261 -0
- package/dist/services/config.d.ts +55 -0
- package/dist/services/config.js +211 -0
- package/dist/services/file-watcher.d.ts +54 -0
- package/dist/services/file-watcher.js +180 -0
- package/dist/services/svg-service.d.ts +81 -0
- package/dist/services/svg-service.js +395 -0
- package/dist/templates/ComponentTemplate.js +25 -25
- package/dist/types/index.d.ts +146 -0
- package/dist/types/index.js +4 -0
- package/dist/utils/native.d.ts +104 -0
- package/dist/utils/native.js +340 -0
- package/dist/watch.d.ts +1 -1
- package/dist/watch.js +14 -14
- package/package.json +154 -14
- package/.svgconfig.json +0 -3
- package/CODE_OF_CONDUCT.md +0 -79
- package/CONTRIBUTING.md +0 -146
- package/TESTING.md +0 -143
- package/cli-framework.test.js +0 -16
- package/cli-test-angular/Arrowbenddownleft.component.ts +0 -27
- package/cli-test-angular/Vite.component.ts +0 -27
- package/cli-test-angular/index.ts +0 -25
- package/cli-test-output/Arrowbenddownleft.vue +0 -33
- package/cli-test-output/Vite.vue +0 -33
- package/cli-test-output/index.ts +0 -25
- package/cli-test-react/Arrowbenddownleft.tsx +0 -39
- package/cli-test-react/Vite.tsx +0 -39
- package/cli-test-react/index.ts +0 -25
- package/cli-test-svelte/Arrowbenddownleft.svelte +0 -22
- package/cli-test-svelte/Vite.svelte +0 -22
- package/cli-test-svelte/index.ts +0 -25
- package/frameworks.test.js +0 -170
- package/my-svgs/ArrowBendDownLeft.svg +0 -6
- package/my-svgs/vite.svg +0 -1
- package/src/builder.ts +0 -104
- package/src/clean.ts +0 -21
- package/src/cli.ts +0 -221
- package/src/config.ts +0 -81
- package/src/core/error-handler.ts +0 -303
- package/src/core/logger.ts +0 -104
- package/src/core/performance-engine.ts +0 -327
- package/src/core/plugin-manager.ts +0 -228
- package/src/core/style-compiler.ts +0 -605
- package/src/lock.ts +0 -74
- package/src/processors/svg-processor.ts +0 -288
- package/src/services/config.ts +0 -241
- package/src/services/file-watcher.ts +0 -218
- package/src/services/svg-service.ts +0 -468
- package/src/templates/ComponentTemplate.ts +0 -57
- package/src/types/index.ts +0 -169
- package/src/utils/native.ts +0 -352
- package/src/watch.ts +0 -88
- package/test-output-mulit/TestIcon-angular-module.component.ts +0 -26
- package/test-output-mulit/TestIcon-angular-standalone.component.ts +0 -27
- package/test-output-mulit/TestIcon-lit.ts +0 -35
- package/test-output-mulit/TestIcon-preact.tsx +0 -38
- package/test-output-mulit/TestIcon-react.tsx +0 -35
- package/test-output-mulit/TestIcon-solid.tsx +0 -27
- package/test-output-mulit/TestIcon-svelte.svelte +0 -22
- package/test-output-mulit/TestIcon-vanilla.ts +0 -37
- package/test-output-mulit/TestIcon-vue-composition.vue +0 -33
- package/test-output-mulit/TestIcon-vue-options.vue +0 -31
- package/tsconfig.json +0 -18
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg
|
|
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"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
v-bind="$attrs"
|
|
12
|
-
>
|
|
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>
|
|
14
|
-
</svg>
|
|
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>
|
package/cli-test-output/Vite.vue
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg
|
|
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"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
v-bind="$attrs"
|
|
12
|
-
>
|
|
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>
|
|
14
|
-
</svg>
|
|
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>
|
package/cli-test-output/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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,39 +0,0 @@
|
|
|
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;
|
package/cli-test-react/Vite.tsx
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
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;
|
package/cli-test-react/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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,22 +0,0 @@
|
|
|
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>
|
|
@@ -1,22 +0,0 @@
|
|
|
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>
|
package/cli-test-svelte/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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/frameworks.test.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Framework Testing Script for SVGER-CLI
|
|
5
|
-
* Tests all 8 supported frameworks: React, Vue, Svelte, Angular, Solid, Preact, Lit, Vanilla
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { frameworkTemplateEngine } from './dist/index.js';
|
|
9
|
-
import fs from 'fs';
|
|
10
|
-
import path from 'path';
|
|
11
|
-
|
|
12
|
-
const testSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="currentColor">
|
|
13
|
-
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
|
14
|
-
</svg>`;
|
|
15
|
-
|
|
16
|
-
const frameworks = [
|
|
17
|
-
{ name: 'react', typescript: true, options: {} },
|
|
18
|
-
{ name: 'vue', typescript: true, options: { scriptSetup: true } },
|
|
19
|
-
{ name: 'vue', typescript: true, options: { scriptSetup: false } },
|
|
20
|
-
{ name: 'svelte', typescript: true, options: {} },
|
|
21
|
-
{ name: 'angular', typescript: true, options: { standalone: true } },
|
|
22
|
-
{ name: 'angular', typescript: true, options: { standalone: false } },
|
|
23
|
-
{ name: 'solid', typescript: true, options: {} },
|
|
24
|
-
{ name: 'preact', typescript: true, options: {} },
|
|
25
|
-
{ name: 'lit', typescript: true, options: {} },
|
|
26
|
-
{ name: 'vanilla', typescript: true, options: {} }
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
console.log('🚀 SVGER-CLI Framework Testing Suite\n');
|
|
30
|
-
console.log('=' .repeat(80));
|
|
31
|
-
|
|
32
|
-
const testOutputDir = path.join(process.cwd(), 'test-output');
|
|
33
|
-
if (!fs.existsSync(testOutputDir)) {
|
|
34
|
-
fs.mkdirSync(testOutputDir, { recursive: true });
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let passed = 0;
|
|
38
|
-
let failed = 0;
|
|
39
|
-
|
|
40
|
-
frameworks.forEach((config, index) => {
|
|
41
|
-
const { name, typescript, options } = config;
|
|
42
|
-
const variant = options.scriptSetup !== undefined
|
|
43
|
-
? (options.scriptSetup ? '-composition' : '-options')
|
|
44
|
-
: options.standalone !== undefined
|
|
45
|
-
? (options.standalone ? '-standalone' : '-module')
|
|
46
|
-
: '';
|
|
47
|
-
|
|
48
|
-
const testName = `${name}${variant}`;
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
console.log(`\n[${index + 1}/${frameworks.length}] Testing: ${testName.toUpperCase()}`);
|
|
52
|
-
console.log('-'.repeat(80));
|
|
53
|
-
|
|
54
|
-
const componentOptions = {
|
|
55
|
-
framework: name,
|
|
56
|
-
componentName: 'TestIcon',
|
|
57
|
-
svgContent: testSVG,
|
|
58
|
-
typescript,
|
|
59
|
-
frameworkOptions: options
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// Generate component
|
|
63
|
-
const component = frameworkTemplateEngine.generateComponent(componentOptions);
|
|
64
|
-
|
|
65
|
-
// Validate component
|
|
66
|
-
if (!component || component.length === 0) {
|
|
67
|
-
throw new Error('Generated component is empty');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Get file extension
|
|
71
|
-
const extension = frameworkTemplateEngine.getFileExtension(name, typescript);
|
|
72
|
-
|
|
73
|
-
// Save to file
|
|
74
|
-
const fileName = `TestIcon-${testName}.${extension}`;
|
|
75
|
-
const filePath = path.join(testOutputDir, fileName);
|
|
76
|
-
fs.writeFileSync(filePath, component, 'utf8');
|
|
77
|
-
|
|
78
|
-
// Framework-specific validation
|
|
79
|
-
switch (name) {
|
|
80
|
-
case 'react':
|
|
81
|
-
case 'preact':
|
|
82
|
-
case 'solid':
|
|
83
|
-
if (!component.includes('export default')) {
|
|
84
|
-
throw new Error('Missing default export');
|
|
85
|
-
}
|
|
86
|
-
if (!component.includes('interface')) {
|
|
87
|
-
throw new Error('Missing TypeScript interface');
|
|
88
|
-
}
|
|
89
|
-
break;
|
|
90
|
-
|
|
91
|
-
case 'vue':
|
|
92
|
-
if (!component.includes('<template>')) {
|
|
93
|
-
throw new Error('Missing Vue template section');
|
|
94
|
-
}
|
|
95
|
-
if (!component.includes('<script')) {
|
|
96
|
-
throw new Error('Missing Vue script section');
|
|
97
|
-
}
|
|
98
|
-
if (options.scriptSetup && !component.includes('setup')) {
|
|
99
|
-
throw new Error('Missing composition API setup');
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
|
|
103
|
-
case 'svelte':
|
|
104
|
-
if (!component.includes('<script')) {
|
|
105
|
-
throw new Error('Missing Svelte script section');
|
|
106
|
-
}
|
|
107
|
-
if (!component.includes('export let')) {
|
|
108
|
-
throw new Error('Missing Svelte props');
|
|
109
|
-
}
|
|
110
|
-
break;
|
|
111
|
-
|
|
112
|
-
case 'angular':
|
|
113
|
-
if (!component.includes('@Component')) {
|
|
114
|
-
throw new Error('Missing Angular decorator');
|
|
115
|
-
}
|
|
116
|
-
if (!component.includes('selector:')) {
|
|
117
|
-
throw new Error('Missing component selector');
|
|
118
|
-
}
|
|
119
|
-
if (options.standalone && !component.includes('standalone: true')) {
|
|
120
|
-
throw new Error('Missing standalone flag');
|
|
121
|
-
}
|
|
122
|
-
break;
|
|
123
|
-
|
|
124
|
-
case 'lit':
|
|
125
|
-
if (!component.includes('@customElement')) {
|
|
126
|
-
throw new Error('Missing Lit decorator');
|
|
127
|
-
}
|
|
128
|
-
if (!component.includes('extends LitElement')) {
|
|
129
|
-
throw new Error('Not extending LitElement');
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
|
|
133
|
-
case 'vanilla':
|
|
134
|
-
if (!component.includes('export function')) {
|
|
135
|
-
throw new Error('Missing function export');
|
|
136
|
-
}
|
|
137
|
-
if (!component.includes('document.createElementNS')) {
|
|
138
|
-
throw new Error('Missing DOM manipulation');
|
|
139
|
-
}
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
console.log(`✅ SUCCESS: Generated valid ${name.toUpperCase()} component`);
|
|
144
|
-
console.log(` 📄 File: ${fileName}`);
|
|
145
|
-
console.log(` 📏 Size: ${component.length} characters`);
|
|
146
|
-
console.log(` 📝 Extension: .${extension}`);
|
|
147
|
-
|
|
148
|
-
passed++;
|
|
149
|
-
|
|
150
|
-
} catch (error) {
|
|
151
|
-
console.log(`❌ FAILED: ${testName.toUpperCase()}`);
|
|
152
|
-
console.log(` Error: ${error.message}`);
|
|
153
|
-
failed++;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
console.log('\n' + '='.repeat(80));
|
|
158
|
-
console.log('\n📊 Test Results Summary\n');
|
|
159
|
-
console.log(` Total Tests: ${frameworks.length}`);
|
|
160
|
-
console.log(` ✅ Passed: ${passed}`);
|
|
161
|
-
console.log(` ❌ Failed: ${failed}`);
|
|
162
|
-
console.log(` 📂 Output: ${testOutputDir}\n`);
|
|
163
|
-
|
|
164
|
-
if (failed === 0) {
|
|
165
|
-
console.log('🎉 All framework tests passed successfully!\n');
|
|
166
|
-
process.exit(0);
|
|
167
|
-
} else {
|
|
168
|
-
console.log('⚠️ Some tests failed. Please review the errors above.\n');
|
|
169
|
-
process.exit(1);
|
|
170
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
|
|
3
|
-
<g id="surface1">
|
|
4
|
-
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,48.235294%,82.352942%);fill-opacity:1;" 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 "/>
|
|
5
|
-
</g>
|
|
6
|
-
</svg>
|
package/my-svgs/vite.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><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></svg>
|
package/src/builder.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { toPascalCase, FileSystem } from "./utils/native.js";
|
|
3
|
-
import { isLocked } from "./lock.js";
|
|
4
|
-
import { readConfig } from "./config.js";
|
|
5
|
-
import { reactTemplate } from "./templates/ComponentTemplate.js";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Converts all SVG files from a source directory into React components and writes them to an output directory.
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} config - Configuration object.
|
|
11
|
-
* @param {string} config.src - Path to the source folder containing SVG files.
|
|
12
|
-
* @param {string} config.out - Path to the output folder where React components will be generated.
|
|
13
|
-
* @returns {Promise<void>} Resolves when all SVGs have been processed.
|
|
14
|
-
*/
|
|
15
|
-
export async function buildAll(config: { src: string; out: string }) {
|
|
16
|
-
const svgConfig = readConfig();
|
|
17
|
-
const srcDir = path.resolve(config.src);
|
|
18
|
-
const outDir = path.resolve(config.out);
|
|
19
|
-
|
|
20
|
-
if (!(await FileSystem.exists(srcDir))) {
|
|
21
|
-
console.error("❌ Source folder not found:", srcDir);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
await FileSystem.ensureDir(outDir);
|
|
26
|
-
const files = (await FileSystem.readDir(srcDir)).filter((f: string) => f.endsWith(".svg"));
|
|
27
|
-
|
|
28
|
-
if (!files.length) {
|
|
29
|
-
console.log("⚠️ No SVG files found in", srcDir);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
for (const file of files) {
|
|
34
|
-
const svgPath = path.join(srcDir, file);
|
|
35
|
-
|
|
36
|
-
if (isLocked(svgPath)) {
|
|
37
|
-
console.log(`⚠️ Skipped locked file: ${file}`);
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const svgContent = await FileSystem.readFile(svgPath, "utf-8");
|
|
42
|
-
const componentName = toPascalCase(file.replace(".svg", ""));
|
|
43
|
-
const componentCode = reactTemplate({
|
|
44
|
-
componentName,
|
|
45
|
-
svgContent,
|
|
46
|
-
defaultWidth: svgConfig.defaultWidth,
|
|
47
|
-
defaultHeight: svgConfig.defaultHeight,
|
|
48
|
-
defaultFill: svgConfig.defaultFill,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const outFile = path.join(outDir, `${componentName}.tsx`);
|
|
52
|
-
await FileSystem.writeFile(outFile, componentCode, "utf-8");
|
|
53
|
-
console.log(`✅ Generated: ${componentName}.tsx`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
console.log("🎉 All SVGs have been converted successfully!");
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Generates a single React component from an SVG file.
|
|
61
|
-
*
|
|
62
|
-
* @param {Object} params - Parameters object.
|
|
63
|
-
* @param {string} params.svgFile - Path to the SVG file to be converted.
|
|
64
|
-
* @param {string} params.outDir - Path to the output folder for the generated component.
|
|
65
|
-
* @returns {Promise<void>} Resolves when the SVG has been converted.
|
|
66
|
-
*/
|
|
67
|
-
export async function generateSVG({
|
|
68
|
-
svgFile,
|
|
69
|
-
outDir,
|
|
70
|
-
}: {
|
|
71
|
-
svgFile: string;
|
|
72
|
-
outDir: string;
|
|
73
|
-
}) {
|
|
74
|
-
const svgConfig = readConfig();
|
|
75
|
-
const filePath = path.resolve(svgFile);
|
|
76
|
-
|
|
77
|
-
if (isLocked(filePath)) {
|
|
78
|
-
console.log(`⚠️ Skipped locked file: ${path.basename(svgFile)}`);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (!(await FileSystem.exists(filePath))) {
|
|
83
|
-
console.error("❌ SVG file not found:", filePath);
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const svgContent = await FileSystem.readFile(filePath, "utf-8");
|
|
88
|
-
const componentName = toPascalCase(path.basename(svgFile, ".svg"));
|
|
89
|
-
const componentCode = reactTemplate({
|
|
90
|
-
componentName,
|
|
91
|
-
svgContent,
|
|
92
|
-
defaultWidth: svgConfig.defaultWidth,
|
|
93
|
-
defaultHeight: svgConfig.defaultHeight,
|
|
94
|
-
defaultFill: svgConfig.defaultFill,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const outputFolder = path.resolve(outDir);
|
|
98
|
-
await FileSystem.ensureDir(outputFolder);
|
|
99
|
-
|
|
100
|
-
const outFile = path.join(outputFolder, `${componentName}.tsx`);
|
|
101
|
-
await FileSystem.writeFile(outFile, componentCode, "utf-8");
|
|
102
|
-
|
|
103
|
-
console.log(`✅ Generated: ${componentName}.tsx`);
|
|
104
|
-
}
|
package/src/clean.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { FileSystem } from "./utils/native.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Cleans the specified output directory by removing all files and folders inside it.
|
|
6
|
-
* Typically used to clear previously generated SVG React components before a new build.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} outDir - Path to the output directory to be cleaned.
|
|
9
|
-
* @returns {Promise<void>} Resolves when the directory has been emptied.
|
|
10
|
-
*/
|
|
11
|
-
export async function clean(outDir: string) {
|
|
12
|
-
const targetDir = path.resolve(outDir);
|
|
13
|
-
|
|
14
|
-
if (!(await FileSystem.exists(targetDir))) {
|
|
15
|
-
console.log(`⚠️ Directory not found: ${targetDir}`);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
await FileSystem.emptyDir(targetDir);
|
|
20
|
-
console.log(`🧹 Cleaned all generated SVG components in: ${targetDir}`);
|
|
21
|
-
}
|