create-template-html-css 1.4.3 → 1.6.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 (40) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/INSERT-QUICK-REFERENCE.md +147 -0
  3. package/README.md +33 -2
  4. package/RELEASE-NOTES-v1.6.1.md +129 -0
  5. package/RELEASE-STATUS.md +203 -0
  6. package/RELEASE-v1.6.2.md +169 -0
  7. package/SECURITY-AUDIT.md +157 -0
  8. package/TEST-REPORT.md +110 -0
  9. package/VERIFICATION-REPORT.md +162 -0
  10. package/bin/cli.js +416 -247
  11. package/demo/css/accordion-component.css +135 -0
  12. package/demo/css/button-component.css +110 -0
  13. package/demo/css/card-component.css +381 -0
  14. package/demo/index.html +169 -0
  15. package/demo/js/accordion-component.js +31 -0
  16. package/demo/js/button-component.js +17 -0
  17. package/demo/js/card-component.js +124 -0
  18. package/package.json +6 -3
  19. package/src/generator.js +165 -64
  20. package/src/index.js +1 -1
  21. package/src/inserter.js +352 -146
  22. package/templates/accordion/index.html +67 -0
  23. package/templates/accordion/script.js +29 -0
  24. package/templates/accordion/style.css +133 -0
  25. package/templates/counter/index.html +46 -0
  26. package/templates/counter/script.js +88 -0
  27. package/templates/counter/style.css +164 -0
  28. package/templates/tabs/index.html +83 -0
  29. package/templates/tabs/script.js +46 -0
  30. package/templates/tabs/style.css +173 -0
  31. package/templates/todo-list/index.html +45 -0
  32. package/templates/todo-list/script.js +69 -0
  33. package/templates/todo-list/style.css +138 -0
  34. package/v1.6.2-IMPROVEMENTS.md +185 -0
  35. package/CONTRIBUTING.md +0 -62
  36. package/INSERT-DEMO.md +0 -171
  37. package/QUICKSTART.md +0 -195
  38. package/SECURITY.md +0 -95
  39. package/SHOWCASE.html +0 -342
  40. package/test-insert.html +0 -54
package/INSERT-DEMO.md DELETED
@@ -1,171 +0,0 @@
1
- # Insert Feature Demo
2
-
3
- ## How to Use the Insert Command
4
-
5
- The `insert` command allows you to add pre-styled components to your existing HTML pages without creating new projects. Components are smartly integrated with proper indentation and ID attributes for easy customization.
6
-
7
- ## How It Works
8
-
9
- When inserting a component:
10
- 1. ✅ Detects existing indentation in your HTML file
11
- 2. ✅ Respects your code formatting style
12
- 3. ✅ Adds unique IDs to styles and scripts (e.g., `button-styles`, `button-script`)
13
- 4. ✅ Prevents duplicate insertions (warns if component already exists)
14
- 5. ✅ Validates HTML structure (checks for `<head>` and `<body>` tags)
15
-
16
- ## Example Usage
17
-
18
- ### 1. Basic Usage
19
-
20
- ```bash
21
- npm run insert
22
- ```
23
-
24
- Follow the interactive prompts:
25
- 1. **Enter path to your HTML file**: `index.html`
26
- 2. **Choose component**: Button, Card, Form, Navigation, Modal, Footer, or Hero
27
- 3. **CSS mode**: Inline, Separate file, or Skip
28
- 4. **JS mode**: Inline, Separate file, or Skip
29
-
30
- ### 2. Real Example
31
-
32
- Let's say you have this HTML file:
33
-
34
- **index.html (before):**
35
- ```html
36
- <!DOCTYPE html>
37
- <html lang="en">
38
- <head>
39
- <meta charset="UTF-8">
40
- <title>My Website</title>
41
- </head>
42
- <body>
43
- <h1>Welcome to My Site</h1>
44
- <p>This is my existing content.</p>
45
- </body>
46
- </html>
47
- ```
48
-
49
- Run the command:
50
- ```bash
51
- npm run insert
52
- # Path: index.html
53
- # Component: Button
54
- # CSS: Inline
55
- # JS: Inline
56
- ```
57
-
58
- **index.html (after):**
59
- ```html
60
- <!DOCTYPE html>
61
- <html lang="en">
62
- <head>
63
- <meta charset="UTF-8">
64
- <title>My Website</title>
65
- <style>
66
- /* BUTTON Component Styles */
67
- .btn {
68
- padding: 12px 30px;
69
- /* ... full button styles ... */
70
- }
71
- </style>
72
- </head>
73
- <body>
74
- <h1>Welcome to My Site</h1>
75
- <p>This is my existing content.</p>
76
-
77
- <!-- BUTTON Component -->
78
- <div class="container">
79
- <button class="btn btn-primary">Click Here</button>
80
- <!-- ... all button variations ... -->
81
- </div>
82
-
83
- <script>
84
- // BUTTON Component Script
85
- document.querySelectorAll('.btn').forEach(button => {
86
- // ... button functionality ...
87
- });
88
- </script>
89
- </body>
90
- </html>
91
- ```
92
-
93
- ### 3. Separate Files Example
94
-
95
- If you choose "Separate file" for CSS and JS:
96
-
97
- ```bash
98
- npm run insert
99
- # Path: products.html
100
- # Component: Card
101
- # CSS: Separate file
102
- # JS: Separate file
103
- ```
104
-
105
- **Result:**
106
- - `products.html` - Updated with card HTML and links
107
- - `card-component.css` - Created with all card styles
108
- - `card-component.js` - Created with card functionality
109
-
110
- **products.html:**
111
- ```html
112
- <head>
113
- <!-- ... existing head content ... -->
114
- <link rel="stylesheet" href="card-component.css">
115
- </head>
116
- <body>
117
- <!-- ... existing content ... -->
118
-
119
- <!-- CARD Component -->
120
- <div class="cards-grid">
121
- <!-- ... card HTML ... -->
122
- </div>
123
-
124
- <script src="card-component.js"></script>
125
- </body>
126
- ```
127
-
128
- ## Benefits
129
-
130
- ✅ **No manual copy-paste** - Components are automatically inserted
131
- ✅ **Flexible integration** - Choose inline or separate files
132
- ✅ **Safe insertion** - HTML structure is preserved
133
- ✅ **Clean organization** - Components are clearly marked
134
- ✅ **Quick prototyping** - Add components in seconds
135
-
136
- ## Tips
137
-
138
- 1. **Inline mode** - Best for quick prototyping or single-use components
139
- 2. **Separate files** - Best for reusable styles across multiple pages
140
- 3. **Skip mode** - Use when you already have custom CSS/JS
141
-
142
- ## Available Components
143
-
144
- All 19 templates are available for insertion:
145
-
146
- ### Basic Components
147
- - Button - Styled button variations
148
- - Card - Product/content cards
149
- - Form - Contact/input forms
150
- - Navigation - Responsive navbar
151
- - Modal - Dialog popups
152
- - Footer - Page footer
153
- - Hero - Hero sections with CTA
154
- - Slider - Image carousel
155
- - Table - Data tables with features
156
-
157
- ### Animation Templates
158
- - Spinner - Loading animations
159
- - Animated Card - Interactive card effects
160
- - Typing Effect - Text animations
161
- - Fade Gallery - Image gallery with effects
162
-
163
- ### Grid Layouts (CSS Grid)
164
- - Grid Layout - CSS Grid examples
165
- - Masonry Grid - Pinterest-style layout
166
- - Dashboard Grid - Admin dashboard
167
-
168
- ### Flexbox Layouts
169
- - Flex Layout - Flexbox patterns
170
- - Flex Cards - Equal-height cards
171
- - Flex Dashboard - Admin dashboard with Flexbox
package/QUICKSTART.md DELETED
@@ -1,195 +0,0 @@
1
- # Quick Start Guide 🚀
2
-
3
- ## Quick Installation
4
-
5
- ```bash
6
- # Clone the repository
7
- git clone https://github.com/benshabbat/create-template-html-css.git
8
- cd create-template-html-css
9
-
10
- # Install dependencies
11
- npm install
12
-
13
- # Link globally (optional)
14
- npm link
15
- ```
16
-
17
- ## Usage Examples
18
-
19
- ### Mode 1: Create New Project
20
-
21
- Create a standalone project with HTML, CSS, and JavaScript files.
22
-
23
- #### 1. Create Styled Button
24
-
25
- ```bash
26
- create-template create
27
- # or
28
- npm run create
29
- # Choose: Button
30
- # Name: my-awesome-button
31
- # JavaScript: Yes
32
- ```
33
-
34
- **Result:**
35
- ```
36
- my-awesome-button/
37
- ├── index.html
38
- ├── style.css
39
- └── script.js
40
- ```
41
-
42
- #### 2. Create Product Card
43
-
44
- ```bash
45
- npm run create
46
- # Choose: Card
47
- # Name: product-card
48
- # JavaScript: No
49
- ```
50
-
51
- #### 3. Create Contact Form
52
-
53
- ```bash
54
- npm run create
55
- # Choose: Form
56
- # Name: contact-form
57
- # JavaScript: Yes
58
- ```
59
-
60
- ### Mode 2: Insert into Existing Page
61
-
62
- Add components to your existing HTML files without creating new projects.
63
-
64
- #### 1. Add Button to Existing Page
65
-
66
- ```bash
67
- create-template insert
68
- # or
69
- npm run insert
70
- # Enter path: index.html
71
- # Choose: Button
72
- # CSS: Inline (inside <style> tag)
73
- # JS: Inline (inside <script> tag)
74
- ```
75
-
76
- **What happens:**
77
- - Button HTML is inserted before `</body>`
78
- - CSS is added in a `<style>` tag in the `<head>`
79
- - JavaScript is added in a `<script>` tag before `</body>`
80
-
81
- #### 2. Add Card with Separate Files
82
-
83
- ```bash
84
- npm run insert
85
- # Enter path: products.html
86
- # Choose: Card
87
- # CSS: Separate file
88
- # JS: Separate file
89
- ```
90
-
91
- **Result:**
92
- - Card HTML inserted into products.html
93
- - card-component.css created and linked
94
- - card-component.js created and linked
95
-
96
- #### 3. Add Navigation (Skip JS)
97
-
98
- ```bash
99
- npm run insert
100
- # Enter path: about.html
101
- # Choose: Navigation
102
- # CSS: Inline
103
- # JS: Skip (I'll add it manually)
104
- ```
105
-
106
- **Result:**
107
- - Navigation HTML inserted
108
- - CSS added inline
109
- - No JavaScript added (you can add later)
110
-
111
- ### More Examples
112
-
113
- #### 4. Create Navigation Bar
114
-
115
- ```bash
116
- create-template create
117
- # Choose: Navigation
118
- # Name: main-nav
119
- # JavaScript: Yes
120
- ```
121
-
122
- #### 5. Create Modal Dialog
123
-
124
- ```bash
125
- create-template create
126
- # Choose: Modal
127
- # Name: popup-modal
128
- # JavaScript: Yes
129
- ```
130
-
131
- #### 6. Create Footer
132
-
133
- ```bash
134
- create-template create
135
- # בחר: Footer
136
- # שם: site-footer
137
- # JavaScript: Yes
138
- ```
139
-
140
- ### 7. צור Hero Section
141
-
142
- ```bash
143
- create-template create
144
- # בחר: Hero
145
- # שם: landing-hero
146
- # JavaScript: Yes
147
- ```
148
-
149
- ## טיפים
150
-
151
- ### פתח בדפדפן
152
- ```bash
153
- cd my-awesome-button
154
- start index.html # Windows
155
- open index.html # Mac
156
- xdg-open index.html # Linux
157
- ```
158
-
159
- ### התאמה אישית
160
- פשוט ערוך את הקבצים שנוצרו:
161
- - `index.html` - שנה את התוכן
162
- - `style.css` - שנה את העיצוב
163
- - `script.js` - שנה את הפונקציונליות
164
-
165
- ### שלב בפרויקט קיים
166
- העתק את הקבצים שנוצרו לפרויקט שלך:
167
- ```bash
168
- cp -r my-awesome-button/* ../my-project/
169
- ```
170
-
171
- ## פקודות CLI
172
-
173
- ```bash
174
- # צור טמפלייט חדש
175
- create-template create
176
-
177
- # הצג רשימת טמפלייטים
178
- create-template list
179
-
180
- # עזרה
181
- create-template --help
182
-
183
- # גרסה
184
- create-template --version
185
- ```
186
-
187
- ## צריך עזרה?
188
-
189
- - 📖 קרא את [README.md](README.md)
190
- - 🐛 פתח [Issue](https://github.com/benshabbat/create-template-html-css/issues)
191
- - 💬 שאל שאלות ב-GitHub Discussions
192
-
193
- ---
194
-
195
- **Happy Coding!** 🎨✨
package/SECURITY.md DELETED
@@ -1,95 +0,0 @@
1
- # Security Policy
2
-
3
- ## Reporting Security Issues
4
-
5
- If you discover a security vulnerability in this project, please send an email to [your-email@example.com]. All security vulnerabilities will be promptly addressed.
6
-
7
- Please do **not** report security vulnerabilities through public GitHub issues.
8
-
9
- ## Security Measures
10
-
11
- ### Input Validation
12
- - **Component Names**: Validated against a whitelist of allowed components
13
- - **Filename Sanitization**: Removes path traversators (../, ..\\), path separators, and dangerous characters
14
- - **Alphanumeric Validation**: Ensures filenames contain at least one alphanumeric character
15
- - **Length Validation**: Enforces maximum name length of 100 characters via CLI validation
16
-
17
- ### Path Traversal Protection
18
- The generator implements multiple layers of protection:
19
- 1. Component names are validated against a strict whitelist
20
- 2. User-provided names are sanitized to remove:
21
- - Path separators (`/`, `\\`)
22
- - Parent directory references (`..`)
23
- - Dangerous characters (`<>:"|?*`)
24
- 3. Empty or invalid names are rejected
25
-
26
- ### Dependencies
27
- All dependencies are regularly audited using `npm audit`. Current status:
28
- - ✅ No known vulnerabilities
29
- - All dependencies use stable, maintained versions
30
-
31
- ## Dependency Versions
32
- - commander: ^11.1.0
33
- - inquirer: ^9.2.12
34
- - chalk: ^4.1.2
35
-
36
- ## Safe Usage
37
-
38
- ### Creating Templates
39
- ```bash
40
- # Safe usage
41
- create-template create
42
- # Follow the prompts and provide valid names
43
-
44
- # Avoid
45
- - Using path separators in names (/, \\)
46
- - Using parent directory references (..)
47
- - Using empty names
48
- ```
49
-
50
- ### Security Best Practices
51
- 1. Always use the latest version of this tool
52
- 2. Run `npm audit` regularly
53
- 3. Review generated files before deploying
54
- 4. Don't expose the CLI to untrusted users
55
- 5. Use this tool in trusted environments only
56
-
57
- ## Vulnerability Response
58
-
59
- ### Severity Levels
60
- - **Critical**: Immediate fix and patch release
61
- - **High**: Fix within 7 days
62
- - **Medium**: Fix within 30 days
63
- - **Low**: Fix in next planned release
64
-
65
- ### Security Updates
66
- Security updates will be released as patch versions and clearly marked in the CHANGELOG.
67
-
68
- ## Supported Versions
69
-
70
- | Version | Supported |
71
- | ------- | ------------------ |
72
- | 1.x.x | :white_check_mark: |
73
-
74
- ## Code Security Features
75
-
76
- ### Generator (src/generator.js)
77
- - Whitelist validation for component names
78
- - Filename sanitization function
79
- - Input validation before file system operations
80
- - Safe path joining using Node.js path module
81
-
82
- ### CLI (bin/cli.js)
83
- - Interactive prompts with validation
84
- - Input length limits
85
- - Character validation (no path separators)
86
- - Error handling and user feedback
87
-
88
- ## Responsible Disclosure
89
-
90
- We encourage responsible disclosure of security vulnerabilities. We commit to:
91
- - Acknowledge your email within 48 hours
92
- - Provide regular updates about our progress
93
- - Credit you in the security advisory (unless you prefer to remain anonymous)
94
-
95
- Thank you for helping keep this project and its users safe!