Skip to content

Commit 1fcd2d0

Browse files
committed
fix(ui): IPC conflict
1 parent 323a38c commit 1fcd2d0

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

packages/@vue/cli-shared-utils/lib/ipc.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const ipc = require('node-ipc')
22

3+
const defaultId = process.env.VUE_CLI_IPC || 'vue-cli'
4+
35
exports.IpcMessenger = class IpcMessenger {
4-
constructor (id = 'vue-cli') {
6+
constructor (id = defaultId) {
57
ipc.config.id = this.id = id
68
ipc.config.retry = 1500
79
ipc.config.silent = true

packages/@vue/cli-ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"serve": "vue-cli-service serve",
66
"build": "vue-cli-service build",
77
"lint": "vue-cli-service lint",
8-
"graphql-api": "cross-env VUE_CLI_DEBUG=true VUE_CLI_UI_DEV=true vue-cli-service graphql-api",
8+
"graphql-api": "cross-env VUE_CLI_DEBUG=true VUE_CLI_UI_DEV=true VUE_CLI_IPC=vue-cli-dev vue-cli-service graphql-api",
99
"run-graphql-api": "vue-cli-service run-graphql-api",
10-
"test-graphql-api": "cross-env VUE_CLI_UI_TEST=true VUE_APP_GRAPHQL_PORT=4040 VUE_APP_CLI_UI_URL=ws://localhost:4040/graphql yarn run graphql-api",
10+
"test-graphql-api": "cross-env VUE_CLI_UI_TEST=true VUE_APP_GRAPHQL_PORT=4040 VUE_APP_CLI_UI_URL=ws://localhost:4040/graphql VUE_CLI_IPC=vue-cli-test yarn run graphql-api",
1111
"prepublishOnly": "yarn run lint --no-fix && yarn run build",
1212
"test:e2e:dev": "cross-env VUE_APP_CLI_UI_URL=ws://localhost:4040/graphql vue-cli-service test:e2e --mode development",
1313
"test:e2e:run": "vue-cli-service test:e2e --mode production --headless --url=http://localhost:4040",

packages/@vue/cli-ui/src/graphql-api/utils/ipc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const ipc = require('node-ipc')
22
// Utils
33
const { log, dumpObject } = require('../utils/logger')
44

5-
ipc.config.id = 'vue-cli'
5+
ipc.config.id = process.env.VUE_CLI_IPC || 'vue-cli'
66
ipc.config.retry = 1500
77
ipc.config.silent = true
88

packages/@vue/cli/lib/ui.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const { log, error, openBrowser } = require('@vue/cli-shared-utils')
22
const { portfinder, server } = require('@vue/cli-ui/server')
3+
const shortid = require('shortid')
34

45
async function ui (options = {}, context = process.cwd()) {
56
let port = options.port
@@ -18,6 +19,11 @@ async function ui (options = {}, context = process.cwd()) {
1819
process.env.VUE_CLI_UI_DEV = true
1920
}
2021

22+
if (!process.env.VUE_CLI_IPC) {
23+
// Prevent IPC id conflicts
24+
process.env.VUE_CLI_IPC = `vue-cli-${shortid()}`
25+
}
26+
2127
if (!options.quiet) log(`🚀 Starting GUI...`)
2228

2329
const opts = {

packages/@vue/cli/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"request-promise-native": "^1.0.5",
5454
"resolve": "^1.5.0",
5555
"semver": "^5.4.1",
56+
"shortid": "^2.2.8",
5657
"slash": "^1.0.0",
5758
"validate-npm-package-name": "^3.0.0",
5859
"yaml-front-matter": "^3.4.1"

0 commit comments

Comments
 (0)