svger-cli 2.0.0 → 2.0.2

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.
Files changed (84) hide show
  1. package/dist/cli.js +0 -0
  2. package/dist/core/error-handler.d.ts +63 -0
  3. package/dist/core/error-handler.js +224 -0
  4. package/dist/core/framework-templates.d.ts +17 -0
  5. package/{src/core/framework-templates.ts → dist/core/framework-templates.js} +100 -137
  6. package/dist/core/logger.d.ts +22 -0
  7. package/dist/core/logger.js +85 -0
  8. package/dist/core/performance-engine.d.ts +67 -0
  9. package/dist/core/performance-engine.js +251 -0
  10. package/dist/core/plugin-manager.d.ts +56 -0
  11. package/dist/core/plugin-manager.js +189 -0
  12. package/dist/core/style-compiler.d.ts +88 -0
  13. package/dist/core/style-compiler.js +466 -0
  14. package/dist/core/template-manager.d.ts +64 -0
  15. package/{src/core/template-manager.ts → dist/core/template-manager.js} +172 -255
  16. package/dist/index.d.ts +151 -0
  17. package/{src/index.ts → dist/index.js} +30 -108
  18. package/dist/processors/svg-processor.d.ts +67 -0
  19. package/dist/processors/svg-processor.js +225 -0
  20. package/dist/services/config.d.ts +55 -0
  21. package/dist/services/config.js +209 -0
  22. package/dist/services/file-watcher.d.ts +54 -0
  23. package/dist/services/file-watcher.js +180 -0
  24. package/dist/services/svg-service.d.ts +81 -0
  25. package/dist/services/svg-service.js +383 -0
  26. package/dist/types/index.d.ts +140 -0
  27. package/dist/types/index.js +4 -0
  28. package/dist/utils/native.d.ts +74 -0
  29. package/dist/utils/native.js +305 -0
  30. package/package.json +9 -3
  31. package/.svgconfig.json +0 -3
  32. package/CODE_OF_CONDUCT.md +0 -79
  33. package/CONTRIBUTING.md +0 -146
  34. package/TESTING.md +0 -143
  35. package/cli-framework.test.js +0 -16
  36. package/cli-test-angular/Arrowbenddownleft.component.ts +0 -27
  37. package/cli-test-angular/Vite.component.ts +0 -27
  38. package/cli-test-angular/index.ts +0 -25
  39. package/cli-test-output/Arrowbenddownleft.vue +0 -33
  40. package/cli-test-output/Vite.vue +0 -33
  41. package/cli-test-output/index.ts +0 -25
  42. package/cli-test-react/Arrowbenddownleft.tsx +0 -39
  43. package/cli-test-react/Vite.tsx +0 -39
  44. package/cli-test-react/index.ts +0 -25
  45. package/cli-test-svelte/Arrowbenddownleft.svelte +0 -22
  46. package/cli-test-svelte/Vite.svelte +0 -22
  47. package/cli-test-svelte/index.ts +0 -25
  48. package/docs/ADR-SVG-INTRGRATION-METHODS-001.adr.md +0 -157
  49. package/docs/ADR-SVG-INTRGRATION-METHODS-002.adr.md +0 -550
  50. package/docs/FRAMEWORK-GUIDE.md +0 -768
  51. package/docs/IMPLEMENTATION-SUMMARY.md +0 -376
  52. package/docs/TDR-SVG-INTRGRATION-METHODS-001.tdr.md +0 -115
  53. package/frameworks.test.js +0 -170
  54. package/my-svgs/ArrowBendDownLeft.svg +0 -6
  55. package/my-svgs/vite.svg +0 -1
  56. package/src/builder.ts +0 -104
  57. package/src/clean.ts +0 -21
  58. package/src/cli.ts +0 -221
  59. package/src/config.ts +0 -81
  60. package/src/core/error-handler.ts +0 -303
  61. package/src/core/logger.ts +0 -104
  62. package/src/core/performance-engine.ts +0 -327
  63. package/src/core/plugin-manager.ts +0 -228
  64. package/src/core/style-compiler.ts +0 -605
  65. package/src/lock.ts +0 -74
  66. package/src/processors/svg-processor.ts +0 -288
  67. package/src/services/config.ts +0 -241
  68. package/src/services/file-watcher.ts +0 -218
  69. package/src/services/svg-service.ts +0 -468
  70. package/src/templates/ComponentTemplate.ts +0 -57
  71. package/src/types/index.ts +0 -169
  72. package/src/utils/native.ts +0 -352
  73. package/src/watch.ts +0 -88
  74. package/test-output-mulit/TestIcon-angular-module.component.ts +0 -26
  75. package/test-output-mulit/TestIcon-angular-standalone.component.ts +0 -27
  76. package/test-output-mulit/TestIcon-lit.ts +0 -35
  77. package/test-output-mulit/TestIcon-preact.tsx +0 -38
  78. package/test-output-mulit/TestIcon-react.tsx +0 -35
  79. package/test-output-mulit/TestIcon-solid.tsx +0 -27
  80. package/test-output-mulit/TestIcon-svelte.svelte +0 -22
  81. package/test-output-mulit/TestIcon-vanilla.ts +0 -37
  82. package/test-output-mulit/TestIcon-vue-composition.vue +0 -33
  83. package/test-output-mulit/TestIcon-vue-options.vue +0 -31
  84. package/tsconfig.json +0 -18
@@ -0,0 +1,305 @@
1
+ import fs from 'fs';
2
+ import { promisify } from 'util';
3
+ /**
4
+ * Native Node.js utilities to replace external dependencies
5
+ */
6
+ /**
7
+ * Convert string to PascalCase (replaces change-case package)
8
+ */
9
+ export function toPascalCase(str) {
10
+ return str
11
+ .replace(/[^a-zA-Z0-9]/g, ' ')
12
+ .split(' ')
13
+ .filter(Boolean)
14
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
15
+ .join('');
16
+ }
17
+ /**
18
+ * Native file system utilities (replaces fs-extra package)
19
+ */
20
+ export class FileSystem {
21
+ static _readFile = promisify(fs.readFile);
22
+ static _writeFile = promisify(fs.writeFile);
23
+ static _readdir = promisify(fs.readdir);
24
+ static _stat = promisify(fs.stat);
25
+ static _mkdir = promisify(fs.mkdir);
26
+ static _rmdir = promisify(fs.rmdir);
27
+ static _unlink = promisify(fs.unlink);
28
+ static async exists(path) {
29
+ try {
30
+ await this._stat(path);
31
+ return true;
32
+ }
33
+ catch {
34
+ return false;
35
+ }
36
+ }
37
+ static async readFile(path, encoding = 'utf8') {
38
+ return this._readFile(path, encoding);
39
+ }
40
+ static async writeFile(path, content, encoding = 'utf8') {
41
+ return this._writeFile(path, content, encoding);
42
+ }
43
+ static async readDir(path) {
44
+ return this._readdir(path);
45
+ }
46
+ static async ensureDir(dirPath) {
47
+ try {
48
+ await this._mkdir(dirPath, { recursive: true });
49
+ }
50
+ catch (error) {
51
+ if (error.code !== 'EEXIST') {
52
+ throw error;
53
+ }
54
+ }
55
+ }
56
+ static async removeDir(dirPath) {
57
+ try {
58
+ const files = await this._readdir(dirPath);
59
+ for (const file of files) {
60
+ const filePath = `${dirPath}/${file}`;
61
+ const stats = await this._stat(filePath);
62
+ if (stats.isDirectory()) {
63
+ await this.removeDir(filePath);
64
+ }
65
+ else {
66
+ await this._unlink(filePath);
67
+ }
68
+ }
69
+ await this._rmdir(dirPath);
70
+ }
71
+ catch (error) {
72
+ if (error.code !== 'ENOENT') {
73
+ throw error;
74
+ }
75
+ }
76
+ }
77
+ static async emptyDir(dirPath) {
78
+ if (!(await this.exists(dirPath))) {
79
+ return;
80
+ }
81
+ const files = await this._readdir(dirPath);
82
+ for (const file of files) {
83
+ const filePath = `${dirPath}/${file}`;
84
+ const stats = await this._stat(filePath);
85
+ if (stats.isDirectory()) {
86
+ await this.removeDir(filePath);
87
+ }
88
+ else {
89
+ await this._unlink(filePath);
90
+ }
91
+ }
92
+ }
93
+ static async unlink(filePath) {
94
+ return this._unlink(filePath);
95
+ }
96
+ static readJSONSync(path) {
97
+ try {
98
+ const content = fs.readFileSync(path, 'utf8');
99
+ return JSON.parse(content);
100
+ }
101
+ catch {
102
+ return {};
103
+ }
104
+ }
105
+ static writeJSONSync(path, data, options) {
106
+ const content = JSON.stringify(data, null, options?.spaces || 0);
107
+ fs.writeFileSync(path, content, 'utf8');
108
+ }
109
+ static existsSync(path) {
110
+ try {
111
+ fs.statSync(path);
112
+ return true;
113
+ }
114
+ catch {
115
+ return false;
116
+ }
117
+ }
118
+ static ensureDirSync(dirPath) {
119
+ try {
120
+ fs.mkdirSync(dirPath, { recursive: true });
121
+ }
122
+ catch (error) {
123
+ if (error.code !== 'EEXIST') {
124
+ throw error;
125
+ }
126
+ }
127
+ }
128
+ }
129
+ /**
130
+ * Simple CLI argument parser (replaces commander package)
131
+ */
132
+ export class CLI {
133
+ commands = new Map();
134
+ programName = '';
135
+ programDescription = '';
136
+ programVersion = '';
137
+ name(name) {
138
+ this.programName = name;
139
+ return this;
140
+ }
141
+ description(desc) {
142
+ this.programDescription = desc;
143
+ return this;
144
+ }
145
+ version(version) {
146
+ this.programVersion = version;
147
+ return this;
148
+ }
149
+ command(signature) {
150
+ return new CommandBuilder(signature, this);
151
+ }
152
+ addCommand(signature, description, action, options) {
153
+ const [command] = signature.split(' ');
154
+ this.commands.set(command, {
155
+ description,
156
+ action: action,
157
+ options
158
+ });
159
+ }
160
+ async parse() {
161
+ const args = process.argv.slice(2);
162
+ if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
163
+ this.showHelp();
164
+ return;
165
+ }
166
+ if (args[0] === '--version' || args[0] === '-v') {
167
+ console.log(this.programVersion);
168
+ return;
169
+ }
170
+ const [commandName, ...remainingArgs] = args;
171
+ const command = this.commands.get(commandName);
172
+ if (!command) {
173
+ console.error(`Unknown command: ${commandName}`);
174
+ this.showHelp();
175
+ process.exit(1);
176
+ }
177
+ const { parsedArgs, options } = this.parseArgs(remainingArgs, command.options);
178
+ try {
179
+ await command.action(parsedArgs, options);
180
+ }
181
+ catch (error) {
182
+ console.error('Command failed:', error);
183
+ process.exit(1);
184
+ }
185
+ }
186
+ parseArgs(args, commandOptions) {
187
+ const parsedArgs = [];
188
+ const options = {};
189
+ let i = 0;
190
+ while (i < args.length) {
191
+ const arg = args[i];
192
+ if (arg.startsWith('--')) {
193
+ const optionName = arg.slice(2);
194
+ const optionConfig = commandOptions.get(optionName);
195
+ if (optionConfig) {
196
+ if (optionConfig.hasValue) {
197
+ options[optionName] = args[i + 1];
198
+ i += 2;
199
+ }
200
+ else {
201
+ options[optionName] = true;
202
+ i++;
203
+ }
204
+ }
205
+ else {
206
+ // Handle key=value format
207
+ if (arg.includes('=')) {
208
+ const [key, value] = arg.slice(2).split('=');
209
+ options[key] = value;
210
+ i++;
211
+ }
212
+ else {
213
+ i++;
214
+ }
215
+ }
216
+ }
217
+ else {
218
+ parsedArgs.push(arg);
219
+ i++;
220
+ }
221
+ }
222
+ return { parsedArgs, options };
223
+ }
224
+ showHelp() {
225
+ console.log(`${this.programName} - ${this.programDescription}`);
226
+ console.log(`Version: ${this.programVersion}\n`);
227
+ console.log('Commands:');
228
+ for (const [name, cmd] of this.commands) {
229
+ console.log(` ${name.padEnd(15)} ${cmd.description}`);
230
+ }
231
+ console.log('\nOptions:');
232
+ console.log(' --help, -h Show help');
233
+ console.log(' --version, -v Show version');
234
+ }
235
+ }
236
+ class CommandBuilder {
237
+ signature;
238
+ desc = '';
239
+ cli;
240
+ options = new Map();
241
+ constructor(signature, cli) {
242
+ this.signature = signature;
243
+ this.cli = cli;
244
+ }
245
+ description(desc) {
246
+ this.desc = desc;
247
+ return this;
248
+ }
249
+ option(flag, description) {
250
+ const hasValue = flag.includes('<') || flag.includes('[');
251
+ const optionName = flag.split(' ')[0].replace(/^--/, '');
252
+ this.options.set(optionName, { description, hasValue });
253
+ return this;
254
+ }
255
+ action(fn) {
256
+ this.cli.addCommand(this.signature, this.desc, fn, this.options);
257
+ }
258
+ }
259
+ /**
260
+ * File watcher using native fs.watch (replaces chokidar)
261
+ */
262
+ export class FileWatcher {
263
+ watchers = [];
264
+ callbacks = new Map();
265
+ watch(path, options) {
266
+ try {
267
+ const watcher = fs.watch(path, {
268
+ recursive: options?.recursive || false,
269
+ persistent: true
270
+ }, (eventType, filename) => {
271
+ if (filename) {
272
+ this.emit(eventType, `${path}/${filename}`);
273
+ }
274
+ });
275
+ this.watchers.push(watcher);
276
+ }
277
+ catch (error) {
278
+ console.error(`Failed to watch ${path}:`, error);
279
+ }
280
+ return this;
281
+ }
282
+ on(event, callback) {
283
+ if (!this.callbacks.has(event)) {
284
+ this.callbacks.set(event, []);
285
+ }
286
+ this.callbacks.get(event).push(callback);
287
+ return this;
288
+ }
289
+ emit(event, ...args) {
290
+ const callbacks = this.callbacks.get(event) || [];
291
+ callbacks.forEach(callback => {
292
+ try {
293
+ callback(...args);
294
+ }
295
+ catch (error) {
296
+ console.error('Watcher callback error:', error);
297
+ }
298
+ });
299
+ }
300
+ close() {
301
+ this.watchers.forEach(watcher => watcher.close());
302
+ this.watchers = [];
303
+ this.callbacks.clear();
304
+ }
305
+ }
package/package.json CHANGED
@@ -1,14 +1,21 @@
1
1
  {
2
2
  "name": "svger-cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "CLI and runtime for converting SVGs to React components with watch support",
5
- "main": "dist/cli.js",
5
+ "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "bin": {
8
8
  "svger-cli": "./bin/svg-tool.js"
9
9
  },
10
+ "files": [
11
+ "dist",
12
+ "bin",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
10
16
  "scripts": {
11
17
  "build": "tsc -p tsconfig.json",
18
+ "prepublishOnly": "npm run build",
12
19
  "dev": "ts-node src/cli.ts"
13
20
  },
14
21
  "keywords": [
@@ -18,7 +25,6 @@
18
25
  "components"
19
26
  ],
20
27
  "author": "faeze mohades",
21
- "repository": "https://github.com/faezemohades/svger-cli",
22
28
  "license": "MIT",
23
29
  "dependencies": {},
24
30
  "devDependencies": {
package/.svgconfig.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "defaultHeight": 32
3
- }
@@ -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.