source: trip-planner-front/node_modules/webpack-dev-server/lib/utils/processOptions.js@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1'use strict';
2
3const createConfig = require('./createConfig');
4const defaultPort = require('./defaultPort');
5const findPort = require('./findPort');
6
7function processOptions(config, argv, callback) {
8 // processOptions {Promise}
9 if (typeof config.then === 'function') {
10 config
11 .then((conf) => processOptions(conf, argv, callback))
12 .catch((err) => {
13 // eslint-disable-next-line no-console
14 console.error(err.stack || err);
15 // eslint-disable-next-line no-process-exit
16 process.exit(1);
17 });
18
19 return;
20 }
21
22 // Taken out of yargs because we must know if
23 // it wasn't given by the user, in which case
24 // we should use portfinder.
25 const options = createConfig(config, argv, { port: defaultPort });
26
27 if (options.socket) {
28 callback(config, options);
29 } else {
30 findPort(options.port)
31 .then((port) => {
32 options.port = port;
33 callback(config, options);
34 })
35 .catch((err) => {
36 // eslint-disable-next-line no-console
37 console.error(err.stack || err);
38 // eslint-disable-next-line no-process-exit
39 process.exit(1);
40 });
41 }
42}
43
44module.exports = processOptions;
Note: See TracBrowser for help on using the repository browser.