@wc-toolkit/cem-generator-cli 0.1.7 → 0.1.9
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/README.md +10 -10
- package/dist/cli.js +15 -16
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -70,16 +70,16 @@ In an interactive terminal, use the arrow keys to move through lists, Space to
|
|
|
70
70
|
toggle checkbox selections, and Enter to confirm. Non-interactive input falls
|
|
71
71
|
back to comma-separated selection numbers.
|
|
72
72
|
|
|
73
|
-
| Option
|
|
74
|
-
|
|
75
|
-
| `--tsconfig <path>`
|
|
76
|
-
| `-c, --config <path>`
|
|
77
|
-
| `-o, --output <path>`
|
|
78
|
-
| `--include <patterns...>`
|
|
79
|
-
| `--exclude <patterns...>`
|
|
80
|
-
| `--no-inheritance`
|
|
81
|
-
| `--plugin <paths...>`
|
|
82
|
-
| `--conflict-policy <policy>` | Detector conflict policy: `throw` \| `last-wins` | `last-wins`
|
|
73
|
+
| Option | Description | Default |
|
|
74
|
+
| ---------------------------- | ------------------------------------------------ | --------------------------------------------------- |
|
|
75
|
+
| `--tsconfig <path>` | Path to tsconfig.json | `./tsconfig.json` |
|
|
76
|
+
| `-c, --config <path>` | Path to the generator config file | auto-detected |
|
|
77
|
+
| `-o, --output <path>` | Output file path | `./custom-elements.json` |
|
|
78
|
+
| `--include <patterns...>` | Glob patterns to include | `src/**/*.{ts,tsx,js,jsx}` when `src/` exists |
|
|
79
|
+
| `--exclude <patterns...>` | Glob patterns to exclude | Tests, specs, stories, `dist/`, and `node_modules/` |
|
|
80
|
+
| `--no-inheritance` | Disable inheritance materialization | - |
|
|
81
|
+
| `--plugin <paths...>` | Additional plugin paths to load | - |
|
|
82
|
+
| `--conflict-policy <policy>` | Detector conflict policy: `throw` \| `last-wins` | `last-wins` |
|
|
83
83
|
|
|
84
84
|
The config file may set `filePath` for the manifest path. The `--output` flag
|
|
85
85
|
takes precedence over `filePath`.
|
package/dist/cli.js
CHANGED
|
@@ -60,10 +60,7 @@ const DEFAULT_SOURCE_EXCLUDE = [
|
|
|
60
60
|
"**/node_modules/**",
|
|
61
61
|
];
|
|
62
62
|
const program = new Command();
|
|
63
|
-
program
|
|
64
|
-
.name("cem")
|
|
65
|
-
.description("Custom Elements Manifest Generator")
|
|
66
|
-
.version("0.1.0");
|
|
63
|
+
program.name("cem").description("Custom Elements Manifest Generator").version("0.1.0");
|
|
67
64
|
program
|
|
68
65
|
.command("generate")
|
|
69
66
|
.description("Generate a Custom Elements Manifest")
|
|
@@ -106,7 +103,7 @@ program
|
|
|
106
103
|
throw new Error("--validation-invariants must be one of: off, warning, error");
|
|
107
104
|
}
|
|
108
105
|
cliOptions.validation = {
|
|
109
|
-
...
|
|
106
|
+
...cliOptions.validation,
|
|
110
107
|
invariants: options.validationInvariants,
|
|
111
108
|
};
|
|
112
109
|
}
|
|
@@ -184,9 +181,7 @@ program
|
|
|
184
181
|
}
|
|
185
182
|
const selectedPlugins = PLUGIN_CHOICES.filter((plugin) => selectedNames.includes(plugin.name));
|
|
186
183
|
const selectedIntegrations = INTEGRATION_CHOICES.filter((integration) => selectedIntegrationNames.includes(integration.name));
|
|
187
|
-
const generatorPackage = mode === "cli"
|
|
188
|
-
? "@wc-toolkit/cem-generator-cli"
|
|
189
|
-
: "@wc-toolkit/cem-generator";
|
|
184
|
+
const generatorPackage = mode === "cli" ? "@wc-toolkit/cem-generator-cli" : "@wc-toolkit/cem-generator";
|
|
190
185
|
const packagesToInstall = [
|
|
191
186
|
generatorPackage,
|
|
192
187
|
...(mode === "code" ? ["tsx"] : []),
|
|
@@ -200,13 +195,11 @@ program
|
|
|
200
195
|
if (existingPath && !options.force) {
|
|
201
196
|
throw new Error(`Output file already exists: ${existingPath}. Use --force to overwrite it.`);
|
|
202
197
|
}
|
|
203
|
-
const shouldInstall = options.install ?? (!options.yes && !options.mode
|
|
204
|
-
? await promptForInstall()
|
|
205
|
-
: false);
|
|
198
|
+
const shouldInstall = options.install ?? (!options.yes && !options.mode ? await promptForInstall() : false);
|
|
206
199
|
if (shouldInstall) {
|
|
207
200
|
installPluginDependencies(packagesToInstall);
|
|
208
201
|
}
|
|
209
|
-
const addManifestToPackageJson = !options.yes && await promptForPackageManifest(cwd);
|
|
202
|
+
const addManifestToPackageJson = !options.yes && (await promptForPackageManifest(cwd));
|
|
210
203
|
fs.writeFileSync(configPath, createConfigSource(selectedPlugins, selectedIntegrations, getDefaultInclude(cwd), DEFAULT_SOURCE_EXCLUDE), "utf-8");
|
|
211
204
|
console.log(`Created config file at ${configPath}`);
|
|
212
205
|
if (mode === "code") {
|
|
@@ -258,7 +251,11 @@ async function promptForModeAndPlugins(pluginNames) {
|
|
|
258
251
|
const modeLine = await lines.next();
|
|
259
252
|
if (modeLine.done)
|
|
260
253
|
throw new Error("No mode selected.");
|
|
261
|
-
const mode = validateInitMode(modeLine.value.trim() === "1"
|
|
254
|
+
const mode = validateInitMode(modeLine.value.trim() === "1"
|
|
255
|
+
? "cli"
|
|
256
|
+
: modeLine.value.trim() === "2"
|
|
257
|
+
? "code"
|
|
258
|
+
: modeLine.value.trim());
|
|
262
259
|
console.log("What library are you using to author your web components?");
|
|
263
260
|
LIBRARY_CHOICES.forEach((plugin, index) => console.log(` ${index + 1}. ${plugin.name}`));
|
|
264
261
|
console.log("Enter a number, or press Enter for nothing.");
|
|
@@ -332,7 +329,7 @@ async function promptForPackageManifest(cwd) {
|
|
|
332
329
|
const { addManifest } = await inquirer.prompt({
|
|
333
330
|
type: "confirm",
|
|
334
331
|
name: "addManifest",
|
|
335
|
-
message: `Add
|
|
332
|
+
message: `Add "customElements": "${DEFAULT_MANIFEST_PATH.slice(2)}" to package.json?`,
|
|
336
333
|
default: false,
|
|
337
334
|
});
|
|
338
335
|
return addManifest;
|
|
@@ -389,7 +386,7 @@ function printPackageScript(command, packageManager) {
|
|
|
389
386
|
? "bun run cem"
|
|
390
387
|
: "pnpm run cem";
|
|
391
388
|
console.log(" Add this script to package.json:");
|
|
392
|
-
console.log(`
|
|
389
|
+
console.log(` "cem": "${command}"`);
|
|
393
390
|
console.log(` Run it with: ${runCommand}`);
|
|
394
391
|
}
|
|
395
392
|
function toCommandPath(filePath) {
|
|
@@ -534,7 +531,9 @@ function createConfigSource(plugins, integrations = [], include, exclude = DEFAU
|
|
|
534
531
|
...(factories.length ? [" plugins: [", ...factories, " ],"] : []),
|
|
535
532
|
"};",
|
|
536
533
|
"",
|
|
537
|
-
]
|
|
534
|
+
]
|
|
535
|
+
.filter((line) => line !== undefined)
|
|
536
|
+
.join("\n");
|
|
538
537
|
}
|
|
539
538
|
function getPluginOptionsSource(plugin) {
|
|
540
539
|
if (!("options" in plugin) || !plugin.options)
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wc-toolkit/cem-generator-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "CLI for generating Custom Elements Manifests.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"custom-elements",
|
|
8
|
+
"custom-elements-manifest",
|
|
9
|
+
"web-components"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://cem-generator.wc-toolkit.com/guide/cli/",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/wc-toolkit/cem-generator/issues"
|
|
14
|
+
},
|
|
5
15
|
"license": "MIT",
|
|
6
16
|
"repository": {
|
|
7
17
|
"type": "git",
|
|
8
18
|
"url": "git+https://github.com/wc-toolkit/cem-generator.git",
|
|
9
19
|
"directory": "packages/cli"
|
|
10
20
|
},
|
|
11
|
-
"bugs": {
|
|
12
|
-
"url": "https://github.com/wc-toolkit/cem-generator/issues"
|
|
13
|
-
},
|
|
14
|
-
"homepage": "https://wc-toolkit.github.io/cem-generator/guide/cli/",
|
|
15
|
-
"keywords": [
|
|
16
|
-
"custom-elements",
|
|
17
|
-
"custom-elements-manifest",
|
|
18
|
-
"web-components",
|
|
19
|
-
"cli"
|
|
20
|
-
],
|
|
21
|
-
"type": "module",
|
|
22
21
|
"bin": {
|
|
23
22
|
"cem": "./dist/cli.js"
|
|
24
23
|
},
|
|
25
|
-
"main": "./dist/cli.js",
|
|
26
|
-
"types": "./dist/cli.d.ts",
|
|
27
24
|
"files": [
|
|
28
25
|
"dist"
|
|
29
26
|
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "./dist/cli.js",
|
|
29
|
+
"types": "./dist/cli.d.ts",
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public",
|
|
32
32
|
"provenance": true
|
|
@@ -35,8 +35,8 @@
|
|
|
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.
|
|
39
|
-
"@wc-toolkit/cem-generator-utils": "0.1.
|
|
38
|
+
"@wc-toolkit/cem-generator": "0.1.8",
|
|
39
|
+
"@wc-toolkit/cem-generator-utils": "0.1.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^26.4.1",
|