create-template-html-css 1.5.0 ā 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.
- package/CHANGELOG.md +76 -0
- package/INSERT-QUICK-REFERENCE.md +147 -0
- package/README.md +31 -1
- package/RELEASE-NOTES-v1.6.1.md +129 -0
- package/RELEASE-STATUS.md +203 -0
- package/RELEASE-v1.6.2.md +169 -0
- package/SECURITY-AUDIT.md +157 -0
- package/TEST-REPORT.md +110 -0
- package/VERIFICATION-REPORT.md +162 -0
- package/bin/cli.js +416 -260
- package/demo/css/accordion-component.css +135 -0
- package/demo/css/button-component.css +110 -0
- package/demo/css/card-component.css +381 -0
- package/demo/index.html +169 -0
- package/demo/js/accordion-component.js +31 -0
- package/demo/js/button-component.js +17 -0
- package/demo/js/card-component.js +124 -0
- package/package.json +6 -3
- package/src/generator.js +165 -74
- package/src/index.js +1 -1
- package/src/inserter.js +352 -146
- package/v1.6.2-IMPROVEMENTS.md +185 -0
- package/CONTRIBUTING.md +0 -62
- package/INSERT-DEMO.md +0 -171
- package/QUICKSTART.md +0 -195
- package/SECURITY.md +0 -95
- package/SHOWCASE.html +0 -342
- package/test-insert.html +0 -54
package/bin/cli.js
CHANGED
|
@@ -1,260 +1,416 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const { program } = require(
|
|
4
|
-
const inquirer = require(
|
|
5
|
-
const path = require(
|
|
6
|
-
const fs = require(
|
|
7
|
-
const { generateTemplate } = require(
|
|
8
|
-
const { insertComponent } = require(
|
|
9
|
-
const chalk = require(
|
|
10
|
-
|
|
11
|
-
program
|
|
12
|
-
.name(
|
|
13
|
-
.description(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log(
|
|
21
|
-
console.log(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
{ name:
|
|
140
|
-
|
|
141
|
-
{ name:
|
|
142
|
-
{ name:
|
|
143
|
-
{ name:
|
|
144
|
-
{ name:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
answers.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
console.log(
|
|
187
|
-
|
|
188
|
-
console.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
.
|
|
202
|
-
.
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { program } = require("commander");
|
|
4
|
+
const inquirer = require("inquirer").default || require("inquirer");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const fs = require("fs").promises;
|
|
7
|
+
const { generateTemplate } = require("../src/generator");
|
|
8
|
+
const { insertComponent } = require("../src/inserter");
|
|
9
|
+
const chalk = require("chalk");
|
|
10
|
+
|
|
11
|
+
program
|
|
12
|
+
.name("create-template")
|
|
13
|
+
.description(
|
|
14
|
+
chalk.cyan("šØ Create HTML/CSS UI component templates in seconds"),
|
|
15
|
+
)
|
|
16
|
+
.version("1.6.2");
|
|
17
|
+
|
|
18
|
+
// Add intro message
|
|
19
|
+
program.on("--help", () => {
|
|
20
|
+
console.log("\n" + chalk.cyan("Examples:"));
|
|
21
|
+
console.log(
|
|
22
|
+
" $ create-template create # Interactive mode",
|
|
23
|
+
);
|
|
24
|
+
console.log(" $ create-template create -c button -n my-btn # With flags");
|
|
25
|
+
console.log(
|
|
26
|
+
" $ create-template insert # Interactive mode",
|
|
27
|
+
);
|
|
28
|
+
console.log(
|
|
29
|
+
" $ create-template insert -f index.html -c card -s separate # With flags",
|
|
30
|
+
);
|
|
31
|
+
console.log(
|
|
32
|
+
" $ create-template insert -f page.html -c button --backup # With backup",
|
|
33
|
+
);
|
|
34
|
+
console.log(
|
|
35
|
+
" $ create-template list # List all templates",
|
|
36
|
+
);
|
|
37
|
+
console.log("");
|
|
38
|
+
console.log(chalk.yellow("Create Command Flags:"));
|
|
39
|
+
console.log(
|
|
40
|
+
" -c, --component <type> Component type (button, card, form, etc.)",
|
|
41
|
+
);
|
|
42
|
+
console.log(" -n, --name <name> Project/component name");
|
|
43
|
+
console.log(
|
|
44
|
+
" --include-js Include JavaScript file (default: true)",
|
|
45
|
+
);
|
|
46
|
+
console.log(" --no-include-js Exclude JavaScript file");
|
|
47
|
+
console.log(" -v, --verbose Show detailed output");
|
|
48
|
+
console.log("");
|
|
49
|
+
console.log(chalk.yellow("Insert Command Flags:"));
|
|
50
|
+
console.log(" -f, --file <path> Path to HTML file");
|
|
51
|
+
console.log(" -c, --component <type> Component type to insert");
|
|
52
|
+
console.log(
|
|
53
|
+
" -s, --script <mode> Script mode (inline, separate, skip)",
|
|
54
|
+
);
|
|
55
|
+
console.log(
|
|
56
|
+
" --style <mode> Style mode (inline, separate, skip)",
|
|
57
|
+
);
|
|
58
|
+
console.log(" -b, --backup Create backup before insertion");
|
|
59
|
+
console.log(" -v, --verbose Show detailed output");
|
|
60
|
+
console.log("");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
program
|
|
64
|
+
.command("create")
|
|
65
|
+
.description(chalk.green("Create a new HTML/CSS template component"))
|
|
66
|
+
.option("-c, --component <type>", "Component type (button, card, form, etc.)")
|
|
67
|
+
.option("-n, --name <name>", "Component name/project name")
|
|
68
|
+
.option("--include-js", "Include JavaScript file", true)
|
|
69
|
+
.option("--no-include-js", "Exclude JavaScript file")
|
|
70
|
+
.option("-v, --verbose", "Verbose output")
|
|
71
|
+
.action(async (options) => {
|
|
72
|
+
try {
|
|
73
|
+
if (options.verbose) {
|
|
74
|
+
console.log(chalk.gray("[DEBUG] Options:"), options);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// If flags are provided, use them directly
|
|
78
|
+
if (options.component && options.name) {
|
|
79
|
+
if (options.verbose) {
|
|
80
|
+
console.log(chalk.gray("[INFO] Using provided options..."));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const createOptions = {
|
|
84
|
+
component: options.component,
|
|
85
|
+
name: options.name,
|
|
86
|
+
includeJs: options.includeJs,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
await generateTemplate(createOptions);
|
|
90
|
+
|
|
91
|
+
console.log("\n" + chalk.green("ā Template created successfully!"));
|
|
92
|
+
console.log(chalk.gray(` Location: ./${options.name}/`));
|
|
93
|
+
console.log(chalk.gray(` Structure:`));
|
|
94
|
+
console.log(chalk.gray(` index.html`));
|
|
95
|
+
console.log(chalk.gray(` css/`));
|
|
96
|
+
console.log(chalk.gray(` āāā style.css`));
|
|
97
|
+
if (options.includeJs) {
|
|
98
|
+
console.log(chalk.gray(` js/`));
|
|
99
|
+
console.log(chalk.gray(` āāā script.js`));
|
|
100
|
+
}
|
|
101
|
+
console.log("");
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Otherwise, use interactive mode
|
|
106
|
+
console.log(chalk.cyan("\n⨠Creating a new template component...\n"));
|
|
107
|
+
|
|
108
|
+
const answers = await inquirer.prompt([
|
|
109
|
+
{
|
|
110
|
+
type: "list",
|
|
111
|
+
name: "component",
|
|
112
|
+
message: "What component would you like to create?",
|
|
113
|
+
choices: [
|
|
114
|
+
new inquirer.Separator(chalk.gray("ā Basic Components")),
|
|
115
|
+
{ name: "Button", value: "button" },
|
|
116
|
+
{ name: "Card", value: "card" },
|
|
117
|
+
{ name: "Form", value: "form" },
|
|
118
|
+
{ name: "Navigation", value: "navigation" },
|
|
119
|
+
{ name: "Modal", value: "modal" },
|
|
120
|
+
{ name: "Footer", value: "footer" },
|
|
121
|
+
{ name: "Hero Section", value: "hero" },
|
|
122
|
+
{ name: "Slider", value: "slider" },
|
|
123
|
+
{ name: "Table", value: "table" },
|
|
124
|
+
new inquirer.Separator(chalk.gray("ā Animation Templates")),
|
|
125
|
+
{ name: "Spinner (Loading Animations)", value: "spinner" },
|
|
126
|
+
{
|
|
127
|
+
name: "Animated Card (Interactive Cards)",
|
|
128
|
+
value: "animated-card",
|
|
129
|
+
},
|
|
130
|
+
{ name: "Typing Effect (Text Animations)", value: "typing-effect" },
|
|
131
|
+
{ name: "Fade Gallery (Image Gallery)", value: "fade-gallery" },
|
|
132
|
+
new inquirer.Separator(chalk.gray("ā Grid Layouts (CSS Grid)")),
|
|
133
|
+
{ name: "Grid Layout", value: "grid-layout" },
|
|
134
|
+
{ name: "Masonry Grid (Pinterest-style)", value: "masonry-grid" },
|
|
135
|
+
{ name: "Dashboard Grid (Admin Panel)", value: "dashboard-grid" },
|
|
136
|
+
new inquirer.Separator(chalk.gray("ā Flexbox Layouts")),
|
|
137
|
+
{ name: "Flex Layout (Flexbox Patterns)", value: "flex-layout" },
|
|
138
|
+
{ name: "Flex Cards (Equal-height cards)", value: "flex-cards" },
|
|
139
|
+
{ name: "Flex Dashboard (Flexbox Admin)", value: "flex-dashboard" },
|
|
140
|
+
new inquirer.Separator(chalk.gray("ā DOM Manipulation Examples")),
|
|
141
|
+
{ name: "Todo List (Add/Remove Items)", value: "todo-list" },
|
|
142
|
+
{ name: "Counter (Click Handlers)", value: "counter" },
|
|
143
|
+
{ name: "Accordion (Toggle Content)", value: "accordion" },
|
|
144
|
+
{ name: "Tabs (Switch Sections)", value: "tabs" },
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: "input",
|
|
149
|
+
name: "name",
|
|
150
|
+
message: "Enter a name for your component:",
|
|
151
|
+
default: (answers) => answers.component,
|
|
152
|
+
validate: (input) => {
|
|
153
|
+
if (!input || input.trim().length === 0) {
|
|
154
|
+
return "Please enter a valid name";
|
|
155
|
+
}
|
|
156
|
+
if (
|
|
157
|
+
input.includes("..") ||
|
|
158
|
+
input.includes("/") ||
|
|
159
|
+
input.includes("\\")
|
|
160
|
+
) {
|
|
161
|
+
return "Name cannot contain path separators or parent directory references";
|
|
162
|
+
}
|
|
163
|
+
if (input.length > 100) {
|
|
164
|
+
return "Name is too long (max 100 characters)";
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
]);
|
|
170
|
+
|
|
171
|
+
// Always include JavaScript file
|
|
172
|
+
answers.includeJs = true;
|
|
173
|
+
|
|
174
|
+
await generateTemplate(answers);
|
|
175
|
+
|
|
176
|
+
console.log("\n" + chalk.green("ā Template created successfully!"));
|
|
177
|
+
console.log(chalk.gray(` Location: ./${answers.name}/`));
|
|
178
|
+
console.log(chalk.gray(` Structure:`));
|
|
179
|
+
console.log(chalk.gray(` index.html`));
|
|
180
|
+
console.log(chalk.gray(` css/`));
|
|
181
|
+
console.log(chalk.gray(` āāā style.css`));
|
|
182
|
+
if (answers.includeJs) {
|
|
183
|
+
console.log(chalk.gray(` js/`));
|
|
184
|
+
console.log(chalk.gray(` āāā script.js`));
|
|
185
|
+
}
|
|
186
|
+
console.log("");
|
|
187
|
+
} catch (error) {
|
|
188
|
+
console.error(chalk.red("ā Error:"), error.message);
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
program
|
|
194
|
+
.command("insert")
|
|
195
|
+
.description(chalk.green("Insert a component into an existing HTML page"))
|
|
196
|
+
.option("-f, --file <path>", "Path to the HTML file")
|
|
197
|
+
.option("-c, --component <type>", "Component type to insert")
|
|
198
|
+
.option("-s, --script <mode>", "Script mode (inline, separate, skip)")
|
|
199
|
+
.option("--style <mode>", "Style mode (inline, separate, skip)")
|
|
200
|
+
.option("-b, --backup", "Create backup of original file")
|
|
201
|
+
.option("-v, --verbose", "Verbose output")
|
|
202
|
+
.action(async (options) => {
|
|
203
|
+
try {
|
|
204
|
+
if (options.verbose) {
|
|
205
|
+
console.log(chalk.gray("[DEBUG] Options:"), options);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// If flags are provided, use them directly
|
|
209
|
+
if (options.file && options.component) {
|
|
210
|
+
if (options.verbose) {
|
|
211
|
+
console.log(chalk.gray("[INFO] Using provided options..."));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const insertOptions = {
|
|
215
|
+
targetFile: options.file,
|
|
216
|
+
component: options.component,
|
|
217
|
+
scriptMode: options.script || "separate",
|
|
218
|
+
styleMode: "separate",
|
|
219
|
+
createBackup: options.backup || false,
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const result = await insertComponent(insertOptions);
|
|
223
|
+
|
|
224
|
+
console.log("\n" + chalk.green("ā Component inserted successfully!"));
|
|
225
|
+
console.log(chalk.cyan(" Summary:"));
|
|
226
|
+
console.log(
|
|
227
|
+
chalk.gray(
|
|
228
|
+
` File: ${path.relative(process.cwd(), result.targetFile)}`,
|
|
229
|
+
),
|
|
230
|
+
);
|
|
231
|
+
console.log(
|
|
232
|
+
chalk.gray(` Component: ${chalk.bold(result.component)}`),
|
|
233
|
+
);
|
|
234
|
+
console.log(chalk.gray(` CSS: ${chalk.yellow("external file")}`));
|
|
235
|
+
console.log(chalk.gray(` JS: ${chalk.yellow(result.scriptMode)}`));
|
|
236
|
+
console.log(
|
|
237
|
+
chalk.gray(
|
|
238
|
+
`\n Component IDs: ${result.component}-styles, ${result.component}-script`,
|
|
239
|
+
),
|
|
240
|
+
);
|
|
241
|
+
if (result.backupPath) {
|
|
242
|
+
console.log(
|
|
243
|
+
chalk.gray(
|
|
244
|
+
` Backup: ${chalk.yellow(path.relative(process.cwd(), result.backupPath))}`,
|
|
245
|
+
),
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
console.log("");
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Otherwise, use interactive mode
|
|
253
|
+
console.log(chalk.cyan("\nš Inserting component into HTML file...\n"));
|
|
254
|
+
|
|
255
|
+
const answers = await inquirer.prompt([
|
|
256
|
+
{
|
|
257
|
+
type: "input",
|
|
258
|
+
name: "targetFile",
|
|
259
|
+
message: "Enter the path to your HTML file:",
|
|
260
|
+
default: "index.html",
|
|
261
|
+
validate: async (input) => {
|
|
262
|
+
if (!input || input.trim().length === 0) {
|
|
263
|
+
return "Please enter a file path";
|
|
264
|
+
}
|
|
265
|
+
if (!input.toLowerCase().endsWith(".html")) {
|
|
266
|
+
return "File must be an HTML file (.html)";
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Check if file exists
|
|
270
|
+
try {
|
|
271
|
+
await fs.access(path.resolve(process.cwd(), input));
|
|
272
|
+
return true;
|
|
273
|
+
} catch {
|
|
274
|
+
return `File not found: ${input}`;
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
type: "list",
|
|
280
|
+
name: "component",
|
|
281
|
+
message: "Which component would you like to insert?",
|
|
282
|
+
choices: [
|
|
283
|
+
new inquirer.Separator(chalk.gray("ā Basic Components")),
|
|
284
|
+
{ name: "Button", value: "button" },
|
|
285
|
+
{ name: "Card", value: "card" },
|
|
286
|
+
{ name: "Form", value: "form" },
|
|
287
|
+
{ name: "Navigation", value: "navigation" },
|
|
288
|
+
{ name: "Modal", value: "modal" },
|
|
289
|
+
{ name: "Footer", value: "footer" },
|
|
290
|
+
{ name: "Hero Section", value: "hero" },
|
|
291
|
+
{ name: "Slider", value: "slider" },
|
|
292
|
+
{ name: "Table", value: "table" },
|
|
293
|
+
new inquirer.Separator(chalk.gray("ā Animation Templates")),
|
|
294
|
+
{ name: "Spinner", value: "spinner" },
|
|
295
|
+
{ name: "Animated Card", value: "animated-card" },
|
|
296
|
+
{ name: "Typing Effect", value: "typing-effect" },
|
|
297
|
+
{ name: "Fade Gallery", value: "fade-gallery" },
|
|
298
|
+
new inquirer.Separator(chalk.gray("ā Grid Layouts")),
|
|
299
|
+
{ name: "Grid Layout", value: "grid-layout" },
|
|
300
|
+
{ name: "Masonry Grid", value: "masonry-grid" },
|
|
301
|
+
{ name: "Dashboard Grid", value: "dashboard-grid" },
|
|
302
|
+
new inquirer.Separator(chalk.gray("ā Flexbox Layouts")),
|
|
303
|
+
{ name: "Flex Layout", value: "flex-layout" },
|
|
304
|
+
{ name: "Flex Cards", value: "flex-cards" },
|
|
305
|
+
{ name: "Flex Dashboard", value: "flex-dashboard" },
|
|
306
|
+
new inquirer.Separator(chalk.gray("ā DOM Manipulation")),
|
|
307
|
+
{ name: "Todo List", value: "todo-list" },
|
|
308
|
+
{ name: "Counter", value: "counter" },
|
|
309
|
+
{ name: "Accordion", value: "accordion" },
|
|
310
|
+
{ name: "Tabs", value: "tabs" },
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
type: "list",
|
|
315
|
+
name: "scriptMode",
|
|
316
|
+
message: "How should the JavaScript be added?",
|
|
317
|
+
choices: [
|
|
318
|
+
{ name: "Separate file (recommended)", value: "separate" },
|
|
319
|
+
{ name: "Inline (inside <script> tag)", value: "inline" },
|
|
320
|
+
{ name: "Skip (I'll add it manually)", value: "skip" },
|
|
321
|
+
],
|
|
322
|
+
default: "separate",
|
|
323
|
+
},
|
|
324
|
+
]);
|
|
325
|
+
|
|
326
|
+
// CSS is always separate (external)
|
|
327
|
+
answers.styleMode = "separate";
|
|
328
|
+
|
|
329
|
+
const result = await insertComponent(answers);
|
|
330
|
+
|
|
331
|
+
console.log("\n" + chalk.green("ā Component inserted successfully!"));
|
|
332
|
+
console.log(chalk.cyan(" Summary:"));
|
|
333
|
+
console.log(
|
|
334
|
+
chalk.gray(
|
|
335
|
+
` File: ${path.relative(process.cwd(), result.targetFile)}`,
|
|
336
|
+
),
|
|
337
|
+
);
|
|
338
|
+
console.log(chalk.gray(` Component: ${chalk.bold(result.component)}`));
|
|
339
|
+
console.log(chalk.gray(` CSS: ${chalk.yellow("external file")}`));
|
|
340
|
+
console.log(chalk.gray(` JS: ${chalk.yellow(result.scriptMode)}`));
|
|
341
|
+
console.log(
|
|
342
|
+
chalk.gray(
|
|
343
|
+
`\n Component IDs: ${result.component}-styles, ${result.component}-script`,
|
|
344
|
+
),
|
|
345
|
+
);
|
|
346
|
+
console.log("");
|
|
347
|
+
} catch (error) {
|
|
348
|
+
console.error("\n" + chalk.red("ā Error:"), error.message);
|
|
349
|
+
process.exit(1);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
program
|
|
354
|
+
.command("list")
|
|
355
|
+
.description(chalk.green("List all available templates"))
|
|
356
|
+
.action(() => {
|
|
357
|
+
console.log("\n" + chalk.blue("š¦ Available Components (23 total)\n"));
|
|
358
|
+
|
|
359
|
+
console.log(chalk.yellow("ā Basic Components (9)"));
|
|
360
|
+
console.log(" button Styled button component");
|
|
361
|
+
console.log(" card Card component with image and content");
|
|
362
|
+
console.log(" form Form with input fields and validation");
|
|
363
|
+
console.log(" navigation Responsive navigation bar");
|
|
364
|
+
console.log(" modal Modal dialog component");
|
|
365
|
+
console.log(" footer Footer section");
|
|
366
|
+
console.log(" hero Hero section with CTA button");
|
|
367
|
+
console.log(" slider Image carousel with navigation");
|
|
368
|
+
console.log(" table Data table with search and filtering");
|
|
369
|
+
|
|
370
|
+
console.log("\n" + chalk.magenta("ā Animation Templates (4)"));
|
|
371
|
+
console.log(" spinner 5 loading spinner variations");
|
|
372
|
+
console.log(" animated-card 6 interactive card animations");
|
|
373
|
+
console.log(" typing-effect Text typing animations");
|
|
374
|
+
console.log(" fade-gallery Image gallery with fade effects");
|
|
375
|
+
|
|
376
|
+
console.log("\n" + chalk.cyan("ā Grid Layouts (3)"));
|
|
377
|
+
console.log(" grid-layout CSS Grid patterns and examples");
|
|
378
|
+
console.log(" masonry-grid Pinterest-style masonry layout");
|
|
379
|
+
console.log(" dashboard-grid Complete admin dashboard (Grid)");
|
|
380
|
+
|
|
381
|
+
console.log("\n" + chalk.green("ā Flexbox Layouts (3)"));
|
|
382
|
+
console.log(" flex-layout Flexbox patterns and examples");
|
|
383
|
+
console.log(" flex-cards Equal-height card layouts");
|
|
384
|
+
console.log(" flex-dashboard Complete admin dashboard (Flexbox)");
|
|
385
|
+
|
|
386
|
+
console.log("\n" + chalk.red("ā DOM Manipulation Examples (4)"));
|
|
387
|
+
console.log(" todo-list Interactive todo list with add/remove");
|
|
388
|
+
console.log(" counter Click counter with history tracking");
|
|
389
|
+
console.log(" accordion Collapsible accordion component");
|
|
390
|
+
console.log(" tabs Tabbed content switcher");
|
|
391
|
+
|
|
392
|
+
console.log("\n" + chalk.gray("Usage:"));
|
|
393
|
+
console.log(" create-template create Create a new component");
|
|
394
|
+
console.log(" create-template insert Insert into HTML file");
|
|
395
|
+
console.log("");
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
program.parse(process.argv);
|
|
399
|
+
|
|
400
|
+
if (!process.argv.slice(2).length) {
|
|
401
|
+
console.log("\n" + chalk.cyan("šØ Create HTML/CSS UI Templates\n"));
|
|
402
|
+
console.log(chalk.white("Usage: create-template [command] [options]") + "\n");
|
|
403
|
+
console.log(chalk.yellow("Commands:"));
|
|
404
|
+
console.log(" create Create a new template component");
|
|
405
|
+
console.log(" insert Insert component into existing HTML file");
|
|
406
|
+
console.log(" list Show all available templates");
|
|
407
|
+
console.log(" help Display help information\n");
|
|
408
|
+
console.log(chalk.gray("Interactive Examples:"));
|
|
409
|
+
console.log(" $ create-template create # Create with prompts");
|
|
410
|
+
console.log(" $ create-template insert # Insert with prompts");
|
|
411
|
+
console.log(" $ create-template list # View all 23 templates\n");
|
|
412
|
+
console.log(chalk.gray("Flag Examples (Non-interactive):"));
|
|
413
|
+
console.log(" $ create-template create -c button -n my-btn");
|
|
414
|
+
console.log(" $ create-template insert -f index.html -c card -s separate");
|
|
415
|
+
console.log(" $ create-template --help # Show full help\n");
|
|
416
|
+
}
|