@wc-toolkit/cem-generator-cli 0.1.3 → 0.1.5
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/dist/cli.js +26 -21
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -19,27 +19,32 @@ const PLUGIN_CHOICES = [
|
|
|
19
19
|
{ name: "solid", packageName: "@wc-toolkit/cem-generator-solid", factory: "solidPlugin" },
|
|
20
20
|
{ name: "svelte", packageName: "@wc-toolkit/cem-generator-svelte", factory: "sveltePlugin" },
|
|
21
21
|
];
|
|
22
|
+
const LIBRARY_CHOICES = [{ name: "nothing" }, ...PLUGIN_CHOICES];
|
|
22
23
|
const INTEGRATION_CHOICES = [
|
|
23
24
|
{
|
|
24
25
|
name: "react-wrappers",
|
|
26
|
+
label: "React wrappers - react v18 and below",
|
|
25
27
|
packageName: "@wc-toolkit/react-wrappers",
|
|
26
28
|
factory: "reactWrapperGeneratorPlugin",
|
|
27
29
|
options: { stronglyTypedEvents: true },
|
|
28
30
|
},
|
|
29
31
|
{
|
|
30
32
|
name: "jsx-types",
|
|
33
|
+
label: "JSX Types - react 19+, SolidJS, Preact, etc.",
|
|
31
34
|
packageName: "@wc-toolkit/jsx-types",
|
|
32
35
|
factory: "jsxTypesGeneratorPlugin",
|
|
33
36
|
options: { outdir: "./types", stronglyTypedEvents: true },
|
|
34
37
|
},
|
|
35
38
|
{
|
|
36
39
|
name: "vuejs-types",
|
|
40
|
+
label: "Vue.js Types",
|
|
37
41
|
packageName: "@wc-toolkit/vuejs-types",
|
|
38
42
|
factory: "vuejsTypesGeneratorPlugin",
|
|
39
43
|
options: { outdir: "./types", stronglyTypedEvents: true },
|
|
40
44
|
},
|
|
41
45
|
{
|
|
42
46
|
name: "svelte-types",
|
|
47
|
+
label: "Svelte Types",
|
|
43
48
|
packageName: "@wc-toolkit/svelte-types",
|
|
44
49
|
factory: "svelteTypesGeneratorPlugin",
|
|
45
50
|
options: { outdir: "./types", stronglyTypedEvents: true },
|
|
@@ -254,16 +259,16 @@ async function promptForModeAndPlugins(pluginNames) {
|
|
|
254
259
|
if (modeLine.done)
|
|
255
260
|
throw new Error("No mode selected.");
|
|
256
261
|
const mode = validateInitMode(modeLine.value.trim() === "1" ? "cli" : modeLine.value.trim() === "2" ? "code" : modeLine.value.trim());
|
|
257
|
-
console.log("
|
|
258
|
-
|
|
259
|
-
console.log("Enter
|
|
260
|
-
output.write("
|
|
262
|
+
console.log("What library are you using to author your web components?");
|
|
263
|
+
LIBRARY_CHOICES.forEach((plugin, index) => console.log(` ${index + 1}. ${plugin.name}`));
|
|
264
|
+
console.log("Enter a number, or press Enter for nothing.");
|
|
265
|
+
output.write("Library: ");
|
|
261
266
|
const pluginsLine = await lines.next();
|
|
262
267
|
if (pluginsLine.done)
|
|
263
268
|
throw new Error("No plugin selection provided.");
|
|
264
269
|
const selectedNames = parsePluginSelection(pluginsLine.value);
|
|
265
|
-
console.log("Which
|
|
266
|
-
INTEGRATION_CHOICES.forEach((integration, index) => console.log(` ${index + 1}. ${integration.
|
|
270
|
+
console.log("Which integrations would you like to include? (multi-select)");
|
|
271
|
+
INTEGRATION_CHOICES.forEach((integration, index) => console.log(` ${index + 1}. ${integration.label}`));
|
|
267
272
|
console.log("Enter numbers separated by commas, or press Enter for no integrations.");
|
|
268
273
|
output.write("Integrations: ");
|
|
269
274
|
const integrationsLine = await lines.next();
|
|
@@ -423,15 +428,15 @@ async function promptForPluginsAndIntegrations() {
|
|
|
423
428
|
{
|
|
424
429
|
type: "select",
|
|
425
430
|
name: "plugin",
|
|
426
|
-
message: "
|
|
427
|
-
choices:
|
|
431
|
+
message: "What library are you using to author your web components?",
|
|
432
|
+
choices: LIBRARY_CHOICES.map((plugin) => ({ name: plugin.name, value: plugin.name })),
|
|
428
433
|
},
|
|
429
434
|
{
|
|
430
435
|
type: "checkbox",
|
|
431
436
|
name: "integrations",
|
|
432
|
-
message: "Which
|
|
437
|
+
message: "Which integrations would you like to include?",
|
|
433
438
|
choices: INTEGRATION_CHOICES.map((integration) => ({
|
|
434
|
-
name: integration.
|
|
439
|
+
name: integration.label,
|
|
435
440
|
value: integration.name,
|
|
436
441
|
})),
|
|
437
442
|
},
|
|
@@ -441,15 +446,15 @@ async function promptForPluginsAndIntegrations() {
|
|
|
441
446
|
const prompt = readline.createInterface({ input, output });
|
|
442
447
|
const lines = prompt[Symbol.asyncIterator]();
|
|
443
448
|
try {
|
|
444
|
-
console.log("
|
|
445
|
-
|
|
446
|
-
console.log("Enter
|
|
447
|
-
output.write("
|
|
449
|
+
console.log("What library are you using to author your web components?");
|
|
450
|
+
LIBRARY_CHOICES.forEach((plugin, index) => console.log(` ${index + 1}. ${plugin.name}`));
|
|
451
|
+
console.log("Enter a number, or press Enter for nothing.");
|
|
452
|
+
output.write("Library: ");
|
|
448
453
|
const pluginsLine = await lines.next();
|
|
449
454
|
if (pluginsLine.done)
|
|
450
455
|
throw new Error("No plugin selection provided.");
|
|
451
|
-
console.log("Which
|
|
452
|
-
INTEGRATION_CHOICES.forEach((integration, index) => console.log(` ${index + 1}. ${integration.
|
|
456
|
+
console.log("Which integrations would you like to include? (multi-select)");
|
|
457
|
+
INTEGRATION_CHOICES.forEach((integration, index) => console.log(` ${index + 1}. ${integration.label}`));
|
|
453
458
|
console.log("Enter numbers separated by commas, or press Enter for no integrations.");
|
|
454
459
|
output.write("Integrations: ");
|
|
455
460
|
const integrationsLine = await lines.next();
|
|
@@ -478,15 +483,15 @@ async function promptForInteractiveSelections() {
|
|
|
478
483
|
{
|
|
479
484
|
type: "select",
|
|
480
485
|
name: "plugin",
|
|
481
|
-
message: "
|
|
482
|
-
choices:
|
|
486
|
+
message: "What library are you using to author your web components?",
|
|
487
|
+
choices: LIBRARY_CHOICES.map((plugin) => ({ name: plugin.name, value: plugin.name })),
|
|
483
488
|
},
|
|
484
489
|
{
|
|
485
490
|
type: "checkbox",
|
|
486
491
|
name: "integrations",
|
|
487
|
-
message: "Which
|
|
492
|
+
message: "Which integrations would you like to include?",
|
|
488
493
|
choices: INTEGRATION_CHOICES.map((integration) => ({
|
|
489
|
-
name: integration.
|
|
494
|
+
name: integration.label,
|
|
490
495
|
value: integration.name,
|
|
491
496
|
})),
|
|
492
497
|
},
|
|
@@ -497,7 +502,7 @@ function isInteractiveTerminal() {
|
|
|
497
502
|
return Boolean(input.isTTY && output.isTTY);
|
|
498
503
|
}
|
|
499
504
|
function parsePluginSelection(answer) {
|
|
500
|
-
return parseSelection(answer,
|
|
505
|
+
return parseSelection(answer, LIBRARY_CHOICES, "library").filter((name) => name !== "nothing");
|
|
501
506
|
}
|
|
502
507
|
function parseIntegrationSelection(answer) {
|
|
503
508
|
return validateIntegrationNames(parseSelection(answer, INTEGRATION_CHOICES, "integration"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wc-toolkit/cem-generator-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "CLI for generating Custom Elements Manifests.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"commander": "^12.1.0",
|
|
36
36
|
"custom-elements-manifest": "^2.1.0",
|
|
37
37
|
"inquirer": "^14.2.2",
|
|
38
|
-
"@wc-toolkit/cem-generator": "0.1.
|
|
38
|
+
"@wc-toolkit/cem-generator": "0.1.4",
|
|
39
39
|
"@wc-toolkit/cem-generator-utils": "0.1.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|