Skip to content

Commit 0a7b363

Browse files
committed
fix: move progress option to client.progress
1 parent d23c4ee commit 0a7b363

File tree

9 files changed

+28
-43
lines changed

9 files changed

+28
-43
lines changed

bin/cli-flags.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ module.exports = {
2121
negative: true,
2222
},
2323
{
24-
name: 'progress',
24+
name: 'client-progress',
2525
type: Boolean,
26-
describe: 'Print compilation progress in percentage',
26+
describe: 'Print compilation progress in percentage in the browser',
2727
group: BASIC_GROUP,
28+
processor(opts) {
29+
opts.client = opts.client || {};
30+
opts.client.progress = opts.clientProgress;
31+
delete opts.clientProgress;
32+
},
2833
},
2934
{
3035
name: 'hot-only',

examples/cli/progress/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { setup } = require('../../util');
77
module.exports = setup({
88
context: __dirname,
99
entry: './app.js',
10-
devServer: {
10+
client: {
1111
progress: true,
1212
},
1313
});

lib/Server.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Server {
5858
this.options
5959
);
6060

61-
if (this.options.progress) {
61+
if (this.options.client.progress) {
6262
this.setupProgressPlugin();
6363
}
6464
this.setupHooks();
@@ -83,7 +83,6 @@ class Server {
8383
}
8484

8585
setupProgressPlugin() {
86-
// for browser console output
8786
new webpack.ProgressPlugin((percent, msg, addInfo) => {
8887
percent = Math.floor(percent * 100);
8988

@@ -564,8 +563,8 @@ class Server {
564563
this.sockWrite([connection], 'liveReload');
565564
}
566565

567-
if (this.options.progress) {
568-
this.sockWrite([connection], 'progress', this.options.progress);
566+
if (this.options.client.progress) {
567+
this.sockWrite([connection], 'progress', this.options.client.progress);
569568
}
570569

571570
if (this.options.clientOverlay) {

lib/options.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
},
8484
"logging": {
8585
"enum": ["none", "error", "warn", "info", "log", "verbose"]
86+
},
87+
"progress": {
88+
"type": "boolean"
8689
}
8790
},
8891
"additionalProperties": false
@@ -292,9 +295,6 @@
292295
}
293296
]
294297
},
295-
"progress": {
296-
"type": "boolean"
297-
},
298298
"proxy": {
299299
"anyOf": [
300300
{
@@ -405,7 +405,6 @@
405405
"openPage": "should be {String|Array} (https://webpack.js.org/configuration/dev-server/#devserveropenpage)",
406406
"overlay": "should be {Boolean|Object} (https://webpack.js.org/configuration/dev-server/#devserveroverlay)",
407407
"port": "should be {Number|String|Null} (https://webpack.js.org/configuration/dev-server/#devserverport)",
408-
"progress": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverprogress---cli-only)",
409408
"proxy": "should be {Object|Array} (https://webpack.js.org/configuration/dev-server/#devserverproxy)",
410409
"public": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserverpublic)",
411410
"setupExitSignals": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserversetupexitsignals)",

test/__snapshots__/Validation.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ exports[`Validation validation should fail validation for invalid \`static\` con
3939
exports[`Validation validation should fail validation for no additional properties 1`] = `
4040
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
4141
- configuration has an unknown property 'additional'. These properties are valid:
42-
object { bonjour?, client?, compress?, dev?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, injectClient?, injectHot?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, openPage?, overlay?, port?, progress?, proxy?, public?, setupExitSignals?, static?, stdin?, transportMode?, useLocalIp? }"
42+
object { bonjour?, client?, compress?, dev?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, injectClient?, injectHot?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, openPage?, overlay?, port?, proxy?, public?, setupExitSignals?, static?, stdin?, transportMode?, useLocalIp? }"
4343
`;

test/cli/cli.test.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -98,31 +98,6 @@ runCLITest('CLI', () => {
9898
.catch(done);
9999
});
100100

101-
it('--progress', (done) => {
102-
testBin('--progress')
103-
.then((output) => {
104-
expect(output.exitCode).toEqual(0);
105-
expect(output.stderr).toContain('100%');
106-
// should not profile
107-
expect(output.stderr).not.toContain(
108-
'ms after chunk modules optimization'
109-
);
110-
done();
111-
})
112-
.catch(done);
113-
});
114-
115-
it('--progress --profile', (done) => {
116-
testBin('--progress --profile')
117-
.then((output) => {
118-
expect(output.exitCode).toEqual(0);
119-
// should profile
120-
expect(output.stderr).toContain('after chunk modules optimization');
121-
done();
122-
})
123-
.catch(done);
124-
});
125-
126101
it('--bonjour', (done) => {
127102
testBin('--bonjour')
128103
.then((output) => {

test/e2e/Progress.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ describe('client progress', () => {
3737
port,
3838
host: '0.0.0.0',
3939
hot: true,
40-
progress: true,
40+
client: {
41+
progress: true,
42+
},
4143
};
4244

4345
// we need a delay between file writing and the start

test/fixtures/schema/webpack.config.no-dev-stats.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module.exports = {
88
devServer: {
99
host: '_foo',
1010
public: '_public',
11-
progress: '_progress',
1211
publicPath: '_publicPath',
1312
hot: '_hot',
1413
clientLogging: '_clientLogging',

test/options.test.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ describe('options', () => {
202202
port: null,
203203
},
204204
},
205+
{
206+
client: {
207+
progress: false,
208+
},
209+
},
205210
],
206211
failure: [
207212
'whoops!',
@@ -227,6 +232,11 @@ describe('options', () => {
227232
logging: 'silent',
228233
},
229234
},
235+
{
236+
client: {
237+
progress: '',
238+
},
239+
},
230240
],
231241
},
232242
compress: {
@@ -355,10 +365,6 @@ describe('options', () => {
355365
success: ['', 0, null],
356366
failure: [false],
357367
},
358-
progress: {
359-
success: [false],
360-
failure: [''],
361-
},
362368
proxy: {
363369
success: [
364370
{

0 commit comments

Comments
 (0)