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.
Files changed (66) hide show
  1. package/CHANGELOG.md +305 -0
  2. package/HTML-VS-REACT.md +289 -0
  3. package/QUICKSTART-REACT.md +293 -0
  4. package/REACT-SUPPORT-SUMMARY.md +235 -0
  5. package/README.md +193 -12
  6. package/bin/cli.js +98 -759
  7. package/bin/commands/create.js +272 -0
  8. package/bin/commands/gallery.js +42 -0
  9. package/bin/commands/insert.js +123 -0
  10. package/bin/commands/list.js +73 -0
  11. package/package.json +10 -3
  12. package/src/component-choices.js +7 -0
  13. package/src/components-registry.js +112 -0
  14. package/src/format-utils.js +49 -0
  15. package/src/generator.js +83 -594
  16. package/src/generators/color-schemes.js +78 -0
  17. package/src/generators/color-utils.js +108 -0
  18. package/src/generators/component-filters.js +151 -0
  19. package/src/generators/html-generators.js +180 -0
  20. package/src/generators/validation.js +43 -0
  21. package/src/index.js +2 -1
  22. package/src/inserter.js +55 -233
  23. package/src/inserters/backup-utils.js +20 -0
  24. package/src/inserters/component-loader.js +68 -0
  25. package/src/inserters/html-utils.js +31 -0
  26. package/src/inserters/indentation-utils.js +90 -0
  27. package/src/inserters/validation-utils.js +49 -0
  28. package/src/react-component-choices.js +45 -0
  29. package/src/react-file-operations.js +172 -0
  30. package/src/react-generator.js +208 -0
  31. package/src/react-templates.js +350 -0
  32. package/src/utils/file-utils.js +97 -0
  33. package/src/utils/path-utils.js +32 -0
  34. package/src/utils/string-utils.js +51 -0
  35. package/src/utils/template-loader.js +91 -0
  36. package/templates/_shared/PATTERNS.md +246 -0
  37. package/templates/_shared/README.md +74 -0
  38. package/templates/_shared/base.css +18 -0
  39. package/templates/blackjack/index.html +1 -1
  40. package/templates/breakout/index.html +1 -1
  41. package/templates/connect-four/index.html +1 -1
  42. package/templates/dice-game/index.html +1 -1
  43. package/templates/flappy-bird/index.html +1 -1
  44. package/templates/pong/index.html +1 -1
  45. package/templates/skeleton/index.html +4 -4
  46. package/templates/slot-machine/index.html +1 -1
  47. package/templates/tetris/index.html +1 -1
  48. package/templates-react/README.md +126 -0
  49. package/templates-react/button/Button.css +88 -0
  50. package/templates-react/button/Button.example.jsx +40 -0
  51. package/templates-react/button/Button.jsx +29 -0
  52. package/templates-react/card/Card.css +86 -0
  53. package/templates-react/card/Card.example.jsx +49 -0
  54. package/templates-react/card/Card.jsx +35 -0
  55. package/templates-react/counter/Counter.css +99 -0
  56. package/templates-react/counter/Counter.example.jsx +45 -0
  57. package/templates-react/counter/Counter.jsx +70 -0
  58. package/templates-react/form/Form.css +128 -0
  59. package/templates-react/form/Form.example.jsx +65 -0
  60. package/templates-react/form/Form.jsx +125 -0
  61. package/templates-react/modal/Modal.css +152 -0
  62. package/templates-react/modal/Modal.example.jsx +90 -0
  63. package/templates-react/modal/Modal.jsx +46 -0
  64. package/templates-react/todo-list/TodoList.css +236 -0
  65. package/templates-react/todo-list/TodoList.example.jsx +15 -0
  66. 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
+ }