Skip to content

Commit 77e6bd4

Browse files
raphaelokonbmuenzenmeyer
authored andcommitted
Adding --silent flag to CLI. Removing unused file
1 parent 1c7a504 commit 77e6bd4

File tree

3 files changed

+8
-31
lines changed

3 files changed

+8
-31
lines changed

packages/patternlab-node-cli/bin/check-args.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

packages/patternlab-node-cli/bin/patternlab.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ log.on('patternlab.error', err => console.log(err)); // eslint-disable-line
1616
// Conditionally register verbose logging
1717
const verboseLogs = verbose => log.on('patternlab.debug', msg => console.log(msg)); // eslint-disable-line
1818

19+
// Conditionally unregister all logging
20+
const silenceLogs = () => {
21+
log.removeAllListeners('patternlab.debug');
22+
log.removeAllListeners('patternlab.error');
23+
};
24+
1925
/**
2026
* Hook up cli version, usage and options
2127
*/
@@ -25,6 +31,7 @@ cli
2531
.arguments('<cmd> [options]')
2632
.option('-c, --config <path>', 'Specify config file. Default looks up the project dir', val => val.trim(), './patternlab-config.json')
2733
.option('-v, --verbose', 'Show verbose console logs', verboseLogs)
34+
.option('--silent', 'Turn off console logs', silenceLogs);
2835

2936
/**
3037
* build

packages/patternlab-node-cli/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Usage: patternlab <cmd> [options]
2929
-V, --version output the version number
3030
-c, --config <path> Specify config file. Default looks up the project dir
3131
-v, --verbose Show verbose logging
32+
--silent Turn off console logs
3233
```
3334

3435
### Build/Compile PatternLab

0 commit comments

Comments
 (0)