create-template-html-css 2.0.4 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +305 -0
- package/HTML-VS-REACT.md +289 -0
- package/QUICKSTART-REACT.md +293 -0
- package/REACT-SUPPORT-SUMMARY.md +235 -0
- package/README.md +193 -12
- package/bin/cli.js +98 -759
- package/bin/commands/create.js +272 -0
- package/bin/commands/gallery.js +42 -0
- package/bin/commands/insert.js +123 -0
- package/bin/commands/list.js +73 -0
- package/package.json +10 -3
- package/src/component-choices.js +7 -0
- package/src/components-registry.js +112 -0
- package/src/format-utils.js +49 -0
- package/src/generator.js +83 -594
- package/src/generators/color-schemes.js +78 -0
- package/src/generators/color-utils.js +108 -0
- package/src/generators/component-filters.js +151 -0
- package/src/generators/html-generators.js +180 -0
- package/src/generators/validation.js +43 -0
- package/src/index.js +2 -1
- package/src/inserter.js +55 -233
- package/src/inserters/backup-utils.js +20 -0
- package/src/inserters/component-loader.js +68 -0
- package/src/inserters/html-utils.js +31 -0
- package/src/inserters/indentation-utils.js +90 -0
- package/src/inserters/validation-utils.js +49 -0
- package/src/react-component-choices.js +45 -0
- package/src/react-file-operations.js +172 -0
- package/src/react-generator.js +208 -0
- package/src/react-templates.js +350 -0
- package/src/utils/file-utils.js +97 -0
- package/src/utils/path-utils.js +32 -0
- package/src/utils/string-utils.js +51 -0
- package/src/utils/template-loader.js +91 -0
- package/templates/_shared/PATTERNS.md +246 -0
- package/templates/_shared/README.md +74 -0
- package/templates/_shared/base.css +18 -0
- package/templates/blackjack/index.html +1 -1
- package/templates/breakout/index.html +1 -1
- package/templates/connect-four/index.html +1 -1
- package/templates/dice-game/index.html +1 -1
- package/templates/flappy-bird/index.html +1 -1
- package/templates/pong/index.html +1 -1
- package/templates/skeleton/index.html +4 -4
- package/templates/slot-machine/index.html +1 -1
- package/templates/tetris/index.html +1 -1
- package/templates-react/README.md +126 -0
- package/templates-react/button/Button.css +88 -0
- package/templates-react/button/Button.example.jsx +40 -0
- package/templates-react/button/Button.jsx +29 -0
- package/templates-react/card/Card.css +86 -0
- package/templates-react/card/Card.example.jsx +49 -0
- package/templates-react/card/Card.jsx +35 -0
- package/templates-react/counter/Counter.css +99 -0
- package/templates-react/counter/Counter.example.jsx +45 -0
- package/templates-react/counter/Counter.jsx +70 -0
- package/templates-react/form/Form.css +128 -0
- package/templates-react/form/Form.example.jsx +65 -0
- package/templates-react/form/Form.jsx +125 -0
- package/templates-react/modal/Modal.css +152 -0
- package/templates-react/modal/Modal.example.jsx +90 -0
- package/templates-react/modal/Modal.jsx +46 -0
- package/templates-react/todo-list/TodoList.css +236 -0
- package/templates-react/todo-list/TodoList.example.jsx +15 -0
- package/templates-react/todo-list/TodoList.jsx +84 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format utilities for HTML, CSS, and JavaScript files
|
|
3
|
+
* Uses Prettier if available, falls back to original content
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Formats HTML content with prettier (optional - falls back to original if not available)
|
|
8
|
+
* @param {string} htmlContent - The HTML content to format
|
|
9
|
+
* @returns {Promise<string>} Formatted HTML content
|
|
10
|
+
*/
|
|
11
|
+
export async function formatHtml(htmlContent) {
|
|
12
|
+
try {
|
|
13
|
+
const prettier = await import("prettier");
|
|
14
|
+
return await prettier.format(htmlContent, { parser: "html" });
|
|
15
|
+
} catch (error) {
|
|
16
|
+
// Prettier not installed or error formatting - return original content
|
|
17
|
+
return htmlContent;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Formats CSS content with prettier (optional - falls back to original if not available)
|
|
23
|
+
* @param {string} cssContent - The CSS content to format
|
|
24
|
+
* @returns {Promise<string>} Formatted CSS content
|
|
25
|
+
*/
|
|
26
|
+
export async function formatCss(cssContent) {
|
|
27
|
+
try {
|
|
28
|
+
const prettier = await import("prettier");
|
|
29
|
+
return await prettier.format(cssContent, { parser: "css" });
|
|
30
|
+
} catch (error) {
|
|
31
|
+
// Prettier not installed or error formatting - return original content
|
|
32
|
+
return cssContent;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Formats JavaScript content with prettier (optional - falls back to original if not available)
|
|
38
|
+
* @param {string} jsContent - The JavaScript content to format
|
|
39
|
+
* @returns {Promise<string>} Formatted JavaScript content
|
|
40
|
+
*/
|
|
41
|
+
export async function formatJs(jsContent) {
|
|
42
|
+
try {
|
|
43
|
+
const prettier = await import("prettier");
|
|
44
|
+
return await prettier.format(jsContent, { parser: "babel" });
|
|
45
|
+
} catch (error) {
|
|
46
|
+
// Prettier not installed or error formatting - return original content
|
|
47
|
+
return jsContent;
|
|
48
|
+
}
|
|
49
|
+
}
|