Skip to content

Commit

Permalink
fix(ui): IPC conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Jun 10, 2018
1 parent 323a38c commit 1fcd2d0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/@vue/cli-shared-utils/lib/ipc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const ipc = require('node-ipc')

const defaultId = process.env.VUE_CLI_IPC || 'vue-cli'

exports.IpcMessenger = class IpcMessenger {
constructor (id = 'vue-cli') {
constructor (id = defaultId) {
ipc.config.id = this.id = id
ipc.config.retry = 1500
ipc.config.silent = true
Expand Down
4 changes: 2 additions & 2 deletions packages/@vue/cli-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"graphql-api": "cross-env VUE_CLI_DEBUG=true VUE_CLI_UI_DEV=true vue-cli-service graphql-api",
"graphql-api": "cross-env VUE_CLI_DEBUG=true VUE_CLI_UI_DEV=true VUE_CLI_IPC=vue-cli-dev vue-cli-service graphql-api",
"run-graphql-api": "vue-cli-service run-graphql-api",
"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",
"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",
"prepublishOnly": "yarn run lint --no-fix && yarn run build",
"test:e2e:dev": "cross-env VUE_APP_CLI_UI_URL=ws://localhost:4040/graphql vue-cli-service test:e2e --mode development",
"test:e2e:run": "vue-cli-service test:e2e --mode production --headless --url=http://localhost:4040",
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-ui/src/graphql-api/utils/ipc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const ipc = require('node-ipc')
// Utils
const { log, dumpObject } = require('../utils/logger')

ipc.config.id = 'vue-cli'
ipc.config.id = process.env.VUE_CLI_IPC || 'vue-cli'
ipc.config.retry = 1500
ipc.config.silent = true

Expand Down
6 changes: 6 additions & 0 deletions packages/@vue/cli/lib/ui.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { log, error, openBrowser } = require('@vue/cli-shared-utils')
const { portfinder, server } = require('@vue/cli-ui/server')
const shortid = require('shortid')

async function ui (options = {}, context = process.cwd()) {
let port = options.port
Expand All @@ -18,6 +19,11 @@ async function ui (options = {}, context = process.cwd()) {
process.env.VUE_CLI_UI_DEV = true
}

if (!process.env.VUE_CLI_IPC) {
// Prevent IPC id conflicts
process.env.VUE_CLI_IPC = `vue-cli-${shortid()}`
}

if (!options.quiet) log(`🚀 Starting GUI...`)

const opts = {
Expand Down
1 change: 1 addition & 0 deletions packages/@vue/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"request-promise-native": "^1.0.5",
"resolve": "^1.5.0",
"semver": "^5.4.1",
"shortid": "^2.2.8",
"slash": "^1.0.0",
"validate-npm-package-name": "^3.0.0",
"yaml-front-matter": "^3.4.1"
Expand Down

0 comments on commit 1fcd2d0

Please sign in to comment.