Skip to content

Commit 8e2d3d9

Browse files
committed
misc(serve): change async await and use includes for args
1 parent 1544a12 commit 8e2d3d9

File tree

3 files changed

+8
-42
lines changed

3 files changed

+8
-42
lines changed

lib/bootstrap.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const normalizeFlags = (args, cmd) => {
1212
return slicedArgs.filter(arg => !isArgCommandName(arg, cmd));
1313
}
1414
else {
15-
return slicedArgs.filter(arg => arg.indexOf('--') < 0 && !isArgCommandName(arg, cmd));
15+
return slicedArgs.filter(arg => !arg.includes('--') && !isArgCommandName(arg, cmd));
1616
}
1717
};
1818

@@ -52,9 +52,6 @@ async function runCLI(cli, commandIsUsed) {
5252
}
5353
}
5454

55-
// eslint-disable-next-line space-before-function-paren
56-
(async () => {
57-
const commandIsUsed = isCommandUsed(commands);
58-
const cli = new WebpackCLI();
59-
await runCLI(cli, commandIsUsed);
60-
})();
55+
const commandIsUsed = isCommandUsed(commands);
56+
const cli = new WebpackCLI();
57+
runCLI(cli, commandIsUsed);

lib/utils/compiler.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ function compilerCallback(compiler, err, stats, lastHash, options, outputOptions
112112
}
113113
}
114114

115-
async function getCompiler(opts) {
116-
return await webpack(opts.options);
115+
function getCompiler(opts) {
116+
return webpack(opts.options);
117117
}
118118

119119
async function webpackInstance(opts, shouldUseMem) {
@@ -203,7 +203,5 @@ async function webpackInstance(opts, shouldUseMem) {
203203
}
204204
};
205205

206-
module.exports = {
207-
getCompiler,
208-
webpackInstance,
209-
};
206+
module.exports.getCompiler = getCompiler;
207+
module.exports.webpackInstance = webpackInstance;

packages/serve/flags.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -74,35 +74,6 @@ module.exports = {
7474
type: String,
7575
describe: 'Open default browser with the specified page',
7676
},
77-
// instead of this option, we should consider retrieving the 'color' option
78-
// from the compiler (since webpack CLI already has 'color' option)
79-
// also, we should reconsider how to use supports-color with command-line-args
80-
// {
81-
// name: 'colors',
82-
// type: Boolean,
83-
// // alias: 'color',
84-
// defaultValue: function supportsColor() {
85-
// // Use `require('supports-color').stdout` for supports-color >= 5.0.0.
86-
// // See https://github.com/webpack/webpack-dev-server/pull/1555.
87-
// return require('supports-color').stdout;
88-
// },
89-
// group: DISPLAY_GROUP,
90-
// describe: 'Enables/Disables colors on the console',
91-
// },
92-
// we need to rethink this option, since it is CLI only at the moment
93-
// {
94-
// name: 'info',
95-
// type: Boolean,
96-
// group: DISPLAY_GROUP,
97-
// defaultValue: true,
98-
// describe: 'Info',
99-
// },
100-
{
101-
name: 'quiet',
102-
type: Boolean,
103-
group: DISPLAY_GROUP,
104-
describe: 'Quiet',
105-
},
10677
{
10778
name: 'client-log-level',
10879
type: String,

0 commit comments

Comments
 (0)