From bc96129a747104cdb2af732b04178d35d6ae0472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ertu=C4=9Frul=20Emre=20Ertekin?= Date: Tue, 7 Jan 2020 00:38:59 +0300 Subject: [PATCH 1/2] fix(serve): UNIX socket support --- .../@vue/cli-service/lib/commands/serve.js | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/packages/@vue/cli-service/lib/commands/serve.js b/packages/@vue/cli-service/lib/commands/serve.js index 6d4c274576..cc2746c069 100644 --- a/packages/@vue/cli-service/lib/commands/serve.js +++ b/packages/@vue/cli-service/lib/commands/serve.js @@ -103,7 +103,7 @@ module.exports = (api, options) => { const protocol = useHttps ? 'https' : 'http' const host = args.host || process.env.HOST || projectDevServerOptions.host || defaults.host portfinder.basePort = args.port || process.env.PORT || projectDevServerOptions.port || defaults.port - const port = await portfinder.getPortPromise() + const port = projectDevServerOptions.socket || await portfinder.getPortPromise() const rawPublicUrl = args.public || projectDevServerOptions.public const publicUrl = rawPublicUrl ? /^[a-zA-Z]+:\/\//.test(rawPublicUrl) @@ -241,23 +241,28 @@ module.exports = (api, options) => { console.log() console.log(` App running at:`) - console.log(` - Local: ${chalk.cyan(urls.localUrlForTerminal)} ${copied}`) - if (!isInContainer) { - console.log(` - Network: ${chalk.cyan(networkUrl)}`) - } else { - console.log() - console.log(chalk.yellow(` It seems you are running Vue CLI inside a container.`)) - if (!publicUrl && options.publicPath && options.publicPath !== '/') { - console.log() - console.log(chalk.yellow(` Since you are using a non-root publicPath, the hot-reload socket`)) - console.log(chalk.yellow(` will not be able to infer the correct URL to connect. You should`)) - console.log(chalk.yellow(` explicitly specify the URL via ${chalk.blue(`devServer.public`)}.`)) + if (!projectDevServerOptions.socket) { + console.log(` - Local: ${chalk.cyan(urls.localUrlForTerminal)} ${copied}`) + if (!isInContainer) { + console.log(` - Network: ${chalk.cyan(networkUrl)}`) + } else { console.log() + console.log(chalk.yellow(` It seems you are running Vue CLI inside a container.`)) + if (!publicUrl && options.publicPath && options.publicPath !== '/') { + console.log() + console.log(chalk.yellow(` Since you are using a non-root publicPath, the hot-reload socket`)) + console.log(chalk.yellow(` will not be able to infer the correct URL to connect. You should`)) + console.log(chalk.yellow(` explicitly specify the URL via ${chalk.blue(`devServer.public`)}.`)) + console.log() + } + console.log(chalk.yellow(` Access the dev server via ${chalk.cyan( + `${protocol}://localhost:${options.publicPath}` + )}`)) } - console.log(chalk.yellow(` Access the dev server via ${chalk.cyan( - `${protocol}://localhost:${options.publicPath}` - )}`)) + } else { + console.log(` - UNIX Socket: ${chalk.cyan(projectDevServerOptions.socket)}`) } + console.log() if (isFirstCompile) { From 100f149d95815686699718d275c0f3c1d0803fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ertu=C4=9Frul=20Emre=20Ertekin?= Date: Tue, 7 Jan 2020 01:10:34 +0300 Subject: [PATCH 2/2] Trailing spaces not allowed no-trailing-spaces --- packages/@vue/cli-service/lib/commands/serve.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/@vue/cli-service/lib/commands/serve.js b/packages/@vue/cli-service/lib/commands/serve.js index cc2746c069..64575dd3ec 100644 --- a/packages/@vue/cli-service/lib/commands/serve.js +++ b/packages/@vue/cli-service/lib/commands/serve.js @@ -262,7 +262,6 @@ module.exports = (api, options) => { } else { console.log(` - UNIX Socket: ${chalk.cyan(projectDevServerOptions.socket)}`) } - console.log() if (isFirstCompile) {