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
package/package.json
CHANGED
|
@@ -1,39 +1,179 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svger-cli",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "dist/
|
|
3
|
+
"version": "2.0.3",
|
|
4
|
+
"description": "Enterprise-grade, zero-dependency SVG to component converter supporting React, Vue, Angular, Svelte, Solid, Lit, Preact & Vanilla. Features auto-generated TypeScript exports, responsive design, themes, performance optimization & 85% faster processing than SVGR.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"bin": {
|
|
8
|
-
"svger-cli": "./bin/svg-tool.js"
|
|
9
|
+
"svger-cli": "./bin/svg-tool.js",
|
|
10
|
+
"svger": "./bin/svg-tool.js"
|
|
9
11
|
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/**/*.js",
|
|
22
|
+
"dist/**/*.d.ts",
|
|
23
|
+
"bin/svg-tool.js",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"CHANGELOG.md",
|
|
27
|
+
"SECURITY.md",
|
|
28
|
+
"DEVELOPMENT.md",
|
|
29
|
+
"docs/**/*.md",
|
|
30
|
+
".svgerconfig.example.json"
|
|
31
|
+
],
|
|
10
32
|
"scripts": {
|
|
11
|
-
"build": "tsc -p tsconfig.json",
|
|
12
|
-
"
|
|
33
|
+
"build": "npm run clean && tsc -p tsconfig.json",
|
|
34
|
+
"build:watch": "tsc -p tsconfig.json --watch",
|
|
35
|
+
"clean": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\"",
|
|
36
|
+
"dev": "ts-node --esm src/cli.ts",
|
|
37
|
+
"test": "npm run test:frameworks && npm run test:config && npm run test:e2e",
|
|
38
|
+
"test:frameworks": "node frameworks.test.js",
|
|
39
|
+
"test:config": "tsc tests/config-options.test.ts --outDir dist-tests --module es2022 --target es2022 --moduleResolution bundler && node dist-tests/config-options.test.js",
|
|
40
|
+
"test:e2e": "tsc tests/e2e-complete.test.ts --outDir dist-tests --module es2022 --target es2022 --moduleResolution bundler && node dist-tests/e2e-complete.test.js",
|
|
41
|
+
"test:watch": "jest --watch",
|
|
42
|
+
"test:coverage": "jest --coverage",
|
|
43
|
+
"test:integration": "jest --testPathPattern=integration",
|
|
44
|
+
"test:all": "npm run test:frameworks && npm run test:config && npm run test:e2e",
|
|
45
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
46
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
49
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
50
|
+
"prepublishOnly": "npm run build && npm run test",
|
|
51
|
+
"prepack": "npm run build",
|
|
52
|
+
"release": "npm version patch && npm publish",
|
|
53
|
+
"release:minor": "npm version minor && npm publish",
|
|
54
|
+
"release:major": "npm version major && npm publish",
|
|
55
|
+
"docs:generate": "typedoc --out docs/api src/index.ts",
|
|
56
|
+
"benchmark": "node --loader ts-node/esm scripts/benchmark.ts",
|
|
57
|
+
"validate": "npm run typecheck && npm run lint && npm run test"
|
|
13
58
|
},
|
|
14
59
|
"keywords": [
|
|
15
60
|
"svg",
|
|
16
61
|
"react",
|
|
62
|
+
"vue",
|
|
63
|
+
"angular",
|
|
64
|
+
"svelte",
|
|
65
|
+
"solid",
|
|
66
|
+
"preact",
|
|
67
|
+
"lit",
|
|
17
68
|
"cli",
|
|
18
|
-
"components"
|
|
69
|
+
"components",
|
|
70
|
+
"typescript",
|
|
71
|
+
"zero-dependency",
|
|
72
|
+
"performance",
|
|
73
|
+
"design-system",
|
|
74
|
+
"responsive",
|
|
75
|
+
"enterprise",
|
|
76
|
+
"batch-processing",
|
|
77
|
+
"icon-generation",
|
|
78
|
+
"frontend-tooling",
|
|
79
|
+
"web-components",
|
|
80
|
+
"component-library",
|
|
81
|
+
"svg-optimization",
|
|
82
|
+
"framework-agnostic",
|
|
83
|
+
"developer-tools",
|
|
84
|
+
"build-tools"
|
|
19
85
|
],
|
|
20
|
-
|
|
86
|
+
"author": {
|
|
87
|
+
"name": "Faeze Mohades",
|
|
88
|
+
"email": "faezemohades@gmail.com",
|
|
89
|
+
"url": "https://github.com/faezemohades"
|
|
90
|
+
},
|
|
91
|
+
"contributors": [
|
|
21
92
|
{
|
|
22
93
|
"name": "Navid Rezadoost",
|
|
23
94
|
"email": "navidrezadoost07@gmail.com",
|
|
24
|
-
"url": "https://
|
|
95
|
+
"url": "https://www.linkedin.com/in/navid-rezadoost-5526b9173/",
|
|
96
|
+
"role": "Core Developer & Technical Lead"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "Ehsan Jafari",
|
|
100
|
+
"role": "Technical Requirements & Architecture"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"maintainers": [
|
|
104
|
+
{
|
|
105
|
+
"name": "Faeze Mohades",
|
|
106
|
+
"email": "faezemohades@gmail.com"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "Navid Rezadoost",
|
|
110
|
+
"email": "navidrezadoost07@gmail.com"
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"repository": {
|
|
114
|
+
"type": "git",
|
|
115
|
+
"url": "git+https://github.com/faezemohades/svger-cli.git",
|
|
116
|
+
"directory": "."
|
|
117
|
+
},
|
|
118
|
+
"homepage": "https://github.com/faezemohades/svger-cli#readme",
|
|
119
|
+
"bugs": {
|
|
120
|
+
"url": "https://github.com/faezemohades/svger-cli/issues",
|
|
121
|
+
"email": "faezemohades@gmail.com"
|
|
122
|
+
},
|
|
123
|
+
"funding": [
|
|
124
|
+
{
|
|
125
|
+
"type": "github",
|
|
126
|
+
"url": "https://github.com/sponsors/faezemohades"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"type": "buymeacoffee",
|
|
130
|
+
"url": "https://buymeacoffee.com/faezemohades"
|
|
25
131
|
}
|
|
26
132
|
],
|
|
27
|
-
"author": "faeze mohades",
|
|
28
|
-
"repository": "https://github.com/faezemohades/svger-cli",
|
|
29
133
|
"license": "MIT",
|
|
30
134
|
"dependencies": {},
|
|
31
135
|
"devDependencies": {
|
|
136
|
+
"@types/jest": "^29.5.12",
|
|
32
137
|
"@types/node": "^24.9.2",
|
|
138
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
139
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
140
|
+
"eslint": "^8.57.1",
|
|
141
|
+
"eslint-config-prettier": "^9.1.0",
|
|
142
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
143
|
+
"jest": "^29.7.0",
|
|
144
|
+
"prettier": "^3.3.3",
|
|
145
|
+
"ts-jest": "^29.2.5",
|
|
33
146
|
"ts-node": "^10.9.2",
|
|
34
|
-
"
|
|
147
|
+
"typedoc": "^0.28.14",
|
|
148
|
+
"typescript": "^5.6.3"
|
|
149
|
+
},
|
|
150
|
+
"peerDependencies": {
|
|
151
|
+
"node": ">=18.17.0"
|
|
35
152
|
},
|
|
36
153
|
"engines": {
|
|
37
|
-
"node": ">=18.17"
|
|
154
|
+
"node": ">=18.17.0",
|
|
155
|
+
"npm": ">=9.0.0"
|
|
156
|
+
},
|
|
157
|
+
"os": [
|
|
158
|
+
"darwin",
|
|
159
|
+
"linux",
|
|
160
|
+
"win32"
|
|
161
|
+
],
|
|
162
|
+
"cpu": [
|
|
163
|
+
"x64",
|
|
164
|
+
"arm64"
|
|
165
|
+
],
|
|
166
|
+
"packageManager": "npm@10.8.2",
|
|
167
|
+
"preferGlobal": true,
|
|
168
|
+
"config": {
|
|
169
|
+
"commitizen": {
|
|
170
|
+
"path": "cz-conventional-changelog"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"browserslist": [
|
|
174
|
+
"node >= 18.17.0"
|
|
175
|
+
],
|
|
176
|
+
"volta": {
|
|
177
|
+
"node": "18.20.4"
|
|
38
178
|
}
|
|
39
|
-
}
|
|
179
|
+
}
|
package/.svgconfig.json
DELETED
package/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
# Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
-
|
|
7
|
-
We value open and honest communication, inspired by the Linux kernel community's emphasis on technical excellence and direct feedback, while maintaining respect and professionalism.
|
|
8
|
-
|
|
9
|
-
## Our Standards
|
|
10
|
-
|
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
-
|
|
13
|
-
* Demonstrating empathy and kindness toward other people
|
|
14
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
-
* Giving and gracefully accepting constructive feedback
|
|
16
|
-
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
-
* Focusing on what is best not only for us as individuals, but for the overall community
|
|
18
|
-
* Using inclusive language and avoiding assumptions about others' backgrounds or abilities
|
|
19
|
-
|
|
20
|
-
Examples of unacceptable behavior include:
|
|
21
|
-
|
|
22
|
-
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
23
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
-
* Public or private harassment
|
|
25
|
-
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
26
|
-
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
27
|
-
|
|
28
|
-
## Enforcement Responsibilities
|
|
29
|
-
|
|
30
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
31
|
-
|
|
32
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
33
|
-
|
|
34
|
-
## Scope
|
|
35
|
-
|
|
36
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
37
|
-
|
|
38
|
-
## Enforcement
|
|
39
|
-
|
|
40
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement. All complaints will be reviewed and investigated promptly and fairly.
|
|
41
|
-
|
|
42
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
43
|
-
|
|
44
|
-
## Enforcement Guidelines
|
|
45
|
-
|
|
46
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
47
|
-
|
|
48
|
-
### 1. Correction
|
|
49
|
-
|
|
50
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
51
|
-
|
|
52
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
53
|
-
|
|
54
|
-
### 2. Warning
|
|
55
|
-
|
|
56
|
-
**Community Impact**: A violation through a single incident or series of actions.
|
|
57
|
-
|
|
58
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
59
|
-
|
|
60
|
-
### 3. Temporary Ban
|
|
61
|
-
|
|
62
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
63
|
-
|
|
64
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
65
|
-
|
|
66
|
-
### 4. Permanent Ban
|
|
67
|
-
|
|
68
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
69
|
-
|
|
70
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
71
|
-
|
|
72
|
-
## Attribution
|
|
73
|
-
|
|
74
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
75
|
-
|
|
76
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
77
|
-
|
|
78
|
-
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
79
|
-
[Mozilla CoC]: https://github.com/mozilla/diversity
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
# Contributing to svger-cli
|
|
2
|
-
|
|
3
|
-
Thank you for your interest in contributing to svger-cli! We welcome contributions from the community to help improve and grow this zero-dependency enterprise SVG processing framework. This document outlines the guidelines and processes for contributing.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
- [Code of Conduct](#code-of-conduct)
|
|
8
|
-
- [How to Contribute](#how-to-contribute)
|
|
9
|
-
- [Development Setup](#development-setup)
|
|
10
|
-
- [Reporting Issues](#reporting-issues)
|
|
11
|
-
- [Submitting Pull Requests](#submitting-pull-requests)
|
|
12
|
-
- [Code Style and Standards](#code-style-and-standards)
|
|
13
|
-
- [Testing](#testing)
|
|
14
|
-
- [Commit Guidelines](#commit-guidelines)
|
|
15
|
-
- [License](#license)
|
|
16
|
-
|
|
17
|
-
## Code of Conduct
|
|
18
|
-
|
|
19
|
-
This project adheres to a [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to the maintainers.
|
|
20
|
-
|
|
21
|
-
## How to Contribute
|
|
22
|
-
|
|
23
|
-
There are many ways to contribute to svger-cli:
|
|
24
|
-
|
|
25
|
-
- **Report bugs** and request features via GitHub Issues
|
|
26
|
-
- **Improve documentation** by fixing typos or adding examples
|
|
27
|
-
- **Write code** by submitting pull requests
|
|
28
|
-
- **Review pull requests** from other contributors
|
|
29
|
-
- **Help others** in discussions and issue threads
|
|
30
|
-
- **Add framework support** for new UI libraries
|
|
31
|
-
- **Optimize performance** and reduce bundle size
|
|
32
|
-
|
|
33
|
-
## Development Setup
|
|
34
|
-
|
|
35
|
-
1. **Fork and Clone**: Fork the repository on GitHub and clone your fork locally.
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
git clone https://github.com/your-username/svger-cli.git
|
|
39
|
-
cd svger-cli
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
2. **Install Dev Dependencies**: Install TypeScript and development tools.
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
npm install
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
3. **Build the Project**: Compile TypeScript to JavaScript.
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npm run build
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
4. **Test the CLI**: Run the built CLI to ensure it works.
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
node dist/cli.js --help
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Reporting Issues
|
|
61
|
-
|
|
62
|
-
When reporting issues, please include:
|
|
63
|
-
|
|
64
|
-
- A clear and descriptive title
|
|
65
|
-
- Steps to reproduce the issue
|
|
66
|
-
- Expected behavior
|
|
67
|
-
- Actual behavior
|
|
68
|
-
- Environment details (OS, Node.js version, etc.)
|
|
69
|
-
- Any relevant SVG files or error messages
|
|
70
|
-
- Framework you're targeting (React, Vue, etc.)
|
|
71
|
-
|
|
72
|
-
Use GitHub Issues for bug reports and feature requests.
|
|
73
|
-
|
|
74
|
-
## Submitting Pull Requests
|
|
75
|
-
|
|
76
|
-
1. **Create a Branch**: Create a feature branch from `main`.
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
git checkout -b feature/your-feature-name
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
2. **Make Changes**: Implement your changes, following the code style guidelines.
|
|
83
|
-
|
|
84
|
-
3. **Test Manually**: Since automated tests are not yet implemented, thoroughly test your changes manually.
|
|
85
|
-
|
|
86
|
-
4. **Update Documentation**: Update README.md or other docs if necessary.
|
|
87
|
-
|
|
88
|
-
5. **Commit Changes**: Use clear commit messages (see [Commit Guidelines](#commit-guidelines)).
|
|
89
|
-
|
|
90
|
-
6. **Push and Create PR**: Push your branch and create a pull request on GitHub.
|
|
91
|
-
|
|
92
|
-
- Provide a clear description of the changes
|
|
93
|
-
- Reference any related issues
|
|
94
|
-
- Include before/after screenshots for UI changes
|
|
95
|
-
- Test with multiple frameworks if applicable
|
|
96
|
-
|
|
97
|
-
## Code Style and Standards
|
|
98
|
-
|
|
99
|
-
- **Language**: TypeScript is the primary language
|
|
100
|
-
- **Zero Dependencies**: Maintain zero runtime dependencies - use only native Node.js APIs
|
|
101
|
-
- **Modular Architecture**: Follow the service-oriented architecture in `src/`
|
|
102
|
-
- **Naming**: Use descriptive names for variables, functions, and classes
|
|
103
|
-
- **Comments**: Add JSDoc comments for public APIs
|
|
104
|
-
- **Error Handling**: Use the centralized error handler for consistent error management
|
|
105
|
-
- **Performance**: Optimize for speed and memory usage
|
|
106
|
-
|
|
107
|
-
Build and test your changes:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
npm run build
|
|
111
|
-
node dist/cli.js [your-test-command]
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Testing
|
|
115
|
-
|
|
116
|
-
Currently, the project relies on manual testing. Future contributions that add automated testing infrastructure are highly encouraged.
|
|
117
|
-
|
|
118
|
-
When testing:
|
|
119
|
-
|
|
120
|
-
- Test with various SVG files (simple and complex)
|
|
121
|
-
- Test all supported frameworks
|
|
122
|
-
- Test edge cases like malformed SVGs
|
|
123
|
-
- Verify performance doesn't regress
|
|
124
|
-
|
|
125
|
-
## Commit Guidelines
|
|
126
|
-
|
|
127
|
-
- Use the imperative mood in commit messages (e.g., "Add feature" not "Added feature")
|
|
128
|
-
- Keep the first line under 50 characters
|
|
129
|
-
- Provide a detailed description in the body if needed
|
|
130
|
-
- Reference issue numbers when applicable (e.g., "Fix #123")
|
|
131
|
-
|
|
132
|
-
Example:
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
Add Vue.js framework support
|
|
136
|
-
|
|
137
|
-
- Implement Vue composition API template
|
|
138
|
-
- Add Vue-specific prop handling
|
|
139
|
-
- Update framework detection logic
|
|
140
|
-
|
|
141
|
-
Closes #456
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## License
|
|
145
|
-
|
|
146
|
-
By contributing to this project, you agree that your contributions will be licensed under the [MIT License](LICENSE).
|
package/TESTING.md
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
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.
|
package/cli-framework.test.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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');
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -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
|
-
};
|