|
|
@ -61,7 +61,7 @@ class LocalWebServer { |
|
|
|
|
|
|
|
let options = {} |
|
|
|
const allOptionDefinitions = cli.optionDefinitions.concat(middlewareOptionDefinitions) |
|
|
|
if (!initOptions.ignoreCli) { |
|
|
|
if (!initOptions.testMode) { |
|
|
|
try { |
|
|
|
options = commandLineArgs(allOptionDefinitions) |
|
|
|
} catch (err) { |
|
|
@ -90,16 +90,12 @@ class LocalWebServer { |
|
|
|
*/ |
|
|
|
this.options = options |
|
|
|
|
|
|
|
if (options.verbose) { |
|
|
|
stackModules |
|
|
|
.filter(mw => mw.on) |
|
|
|
.forEach(mw => mw.on('verbose', onVerbose)) |
|
|
|
} |
|
|
|
if (options.debug) { |
|
|
|
stackModules |
|
|
|
.filter(mw => mw.on) |
|
|
|
.forEach(mw => mw.on('debug', onDebug)) |
|
|
|
} |
|
|
|
.forEach(mw => { |
|
|
|
mw.on('verbose', this.onVerbose.bind(this)) |
|
|
|
mw.on('debug', this.onDebug.bind(this)) |
|
|
|
}) |
|
|
|
|
|
|
|
/* --config */ |
|
|
|
if (options.config) { |
|
|
@ -168,12 +164,16 @@ class LocalWebServer { |
|
|
|
|
|
|
|
const tableLayout = require('table-layout') |
|
|
|
|
|
|
|
server.listen(options.port, function () { |
|
|
|
server |
|
|
|
.listen(options.port) |
|
|
|
.on('listening', function () { |
|
|
|
if (options.testMode) return |
|
|
|
const ipList = getIPList() |
|
|
|
.map(iface => `[underline]{${server.isHttps ? 'https' : 'http'}://${iface.address}:${options.port}}`) |
|
|
|
.join(', ') |
|
|
|
console.error(ansi.format('Serving at', 'bold'), ansi.format(ipList)) |
|
|
|
}) |
|
|
|
.on('listening', onListening) |
|
|
|
return server |
|
|
|
} |
|
|
|
|
|
|
|