diff --git a/cli.js b/cli.js index 281ec85..253fb99 100644 --- a/cli.js +++ b/cli.js @@ -14,6 +14,7 @@ program .option('-s, --serve-ssr', 'serve SSR', defaults.serveSsr) .option('-B, --spa-port [port]', 'port serving spa app', defaults.spaPort) .option('-S, --ssr-port [port]', 'port serving SSR app', defaults.ssrPort) + .option('-q, --silent', 'port serving SSR app', defaults.silent) .action(_options => { const options = _options.opts() diff --git a/config.js b/config.js index 63f1556..2292692 100644 --- a/config.js +++ b/config.js @@ -7,6 +7,7 @@ const defaults = { ssrPort: "5005", serveSpa: false, serveSsr: false, + silent: false, } module.exports.defaults = defaults \ No newline at end of file diff --git a/server.js b/server.js index 1b133fa..1e5f831 100644 --- a/server.js +++ b/server.js @@ -9,7 +9,6 @@ const { defaults } = require('./config') * @param {Partial} _options */ module.exports.spassr = function (_options) { - const options = { ...defaults, ..._options } const { spaPort, ssrPort, serveSpa, serveSsr } = options @@ -28,13 +27,13 @@ module.exports.spassr = function (_options) { * @param { Config } options */ function startServer(options) { - const { distDir, host, port, mode } = options + const { distDir, host, port, mode, silent } = options const app = express() const fallback = mode === 'ssr' ? sendSSRRender : sendEntryPoint app.use(express.static(distDir)) app.get('*', fallback.bind({ options })) - console.log(`[spassr] Serving ${mode} on ${host}:${port}`) + if (!silent) console.log(`[spassr] Serving ${mode} on ${host}:${port}`) app.listen(port) }