Skip to content

Commit cfb49ad

Browse files
authored
Merge pull request #37 from open-wc/feat/outdir
feat: add outdir option to cli
2 parents 3119c63 + d72be15 commit cfb49ad

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

packages/analyzer/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ cem analyze
3939
| analyze | | Analyze your components | |
4040
| --globs | string[] | Globs to analyze | `--globs "foo.js"` |
4141
| --exclude | string[] | Globs to exclude | `--exclude "foo.js"` |
42+
| --outdir | string | Directory to output the Manifest to | `--outdir dist` |
4243
| --watch | boolean | Enables watch mode, generates a new manifest on file change | `--watch` |
4344
| --dev | boolean | Enables extra logging for debugging | `--dev` |
4445
| --litelement | boolean | Enable special handling for LitElement syntax | `--litelement` |
@@ -356,6 +357,7 @@ import myAwesomePlugin from 'awesome-plugin';
356357
export default {
357358
globs: ['src/**/*.js'],
358359
exclude: ['src/foo.js'],
360+
outdir: 'dist',
359361
dev: true,
360362
watch: true,
361363
plugins: [
@@ -378,6 +380,7 @@ Config types:
378380
interface userConfigOptions {
379381
globs: string[],
380382
exclude: string[],
383+
outdir: string,
381384
dev: boolean,
382385
watch: boolean,
383386
plugins: Array<() => Plugin>,

packages/analyzer/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ import {
7575
dev: mergedOptions.dev
7676
});
7777

78-
fs.writeFileSync(`${process.cwd()}${path.sep}custom-elements.json`, `${JSON.stringify(customElementsManifest, null, 2)}\n`);
78+
const outdir = path.join(process.cwd(), mergedOptions.outdir);
79+
fs.writeFileSync(path.join(outdir, 'custom-elements.json'), `${JSON.stringify(customElementsManifest, null, 2)}\n`);
7980
if(mergedOptions.dev) {
8081
console.log(JSON.stringify(customElementsManifest, null, 2));
8182
}

packages/analyzer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@custom-elements-manifest/analyzer",
3-
"version": "0.3.2",
3+
"version": "0.3.3",
44
"description": "",
55
"license": "MIT",
66
"type": "module",

packages/analyzer/src/utils/cli.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export function getCliConfig(argv) {
4949
const optionDefinitions = [
5050
{ name: 'globs', type: String, multiple: true, defaultValue: ['**/*.{js,ts}'] },
5151
{ name: 'exclude', type: String, multiple: true },
52+
{ name: 'outdir', type: String, defaultValue: '' },
5253
{ name: 'dev', type: Boolean, defaultValue: false },
5354
{ name: 'watch', type: Boolean, defaultValue: false },
5455
{ name: 'litelement', type: Boolean, defaultValue: false },

0 commit comments

Comments
 (0)