Skip to content

Commit 8320d67

Browse files
committed
Add “quiet” option
1 parent a65ae75 commit 8320d67

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Once the build finishes, a child process is spawned firing both a python and nod
7979
* `dev`: switch for development environments. This causes scripts to execute once. Useful for running HMR on webpack-dev-server or webpack watch mode. **Default: true**
8080
* `safe`: switches script execution process from spawn to exec. If running into problems with spawn, turn this setting on. **Default: false**
8181
* `verbose`: **DEPRECATED** enable for verbose output. **Default: false**
82+
* `quiet`: disables output for internal messages. **Default: false**
8283

8384
### Developing
8485

src/webpack-shell-plugin.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const defaultOptions = {
88
onBuildExit: [],
99
dev: true,
1010
verbose: false,
11-
safe: false
11+
safe: false,
12+
quiet: false
1213
};
1314

1415
export default class WebpackShellPlugin {
@@ -72,11 +73,15 @@ export default class WebpackShellPlugin {
7273

7374
compiler.plugin('compilation', (compilation) => {
7475
if (this.options.verbose) {
75-
console.log(`Report compilation: ${compilation}`);
76-
console.warn(`WebpackShellPlugin [${new Date()}]: Verbose is being deprecated, please remove.`);
76+
if (!this.options.quiet) {
77+
console.log(`Report compilation: ${compilation}`);
78+
console.warn(`WebpackShellPlugin [${new Date()}]: Verbose is being deprecated, please remove.`);
79+
}
7780
}
7881
if (this.options.onBuildStart.length) {
79-
console.log('Executing pre-build scripts');
82+
if (!this.options.quiet) {
83+
console.log('Executing pre-build scripts');
84+
}
8085
for (let i = 0; i < this.options.onBuildStart.length; i++) {
8186
this.handleScript(this.options.onBuildStart[i]);
8287
}
@@ -88,7 +93,9 @@ export default class WebpackShellPlugin {
8893

8994
compiler.plugin('after-emit', (compilation, callback) => {
9095
if (this.options.onBuildEnd.length) {
91-
console.log('Executing post-build scripts');
96+
if (!this.options.quiet) {
97+
console.log('Executing post-build scripts');
98+
}
9299
for (let i = 0; i < this.options.onBuildEnd.length; i++) {
93100
this.handleScript(this.options.onBuildEnd[i]);
94101
}
@@ -101,7 +108,9 @@ export default class WebpackShellPlugin {
101108

102109
compiler.plugin('done', () => {
103110
if (this.options.onBuildExit.length) {
104-
console.log('Executing additional scripts before exit');
111+
if (!this.options.quiet) {
112+
console.log('Executing additional scripts before exit');
113+
}
105114
for (let i = 0; i < this.options.onBuildExit.length; i++) {
106115
this.handleScript(this.options.onBuildExit[i]);
107116
}

0 commit comments

Comments
 (0)