Skip to content

Commit

Permalink
fix(ui): open when server is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Apr 26, 2018
1 parent 802499e commit 602be03
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 5 additions & 1 deletion packages/@vue/cli-service/lib/commands/ui.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { openBrowser } = require('@vue/cli-shared-utils')

module.exports = api => {
api.registerCommand('ui', args => {
api.setMode('production')
Expand All @@ -18,6 +20,8 @@ module.exports = api => {
}
}

server(opts)
server(opts, () => {
openBrowser(`http://localhost:${process.env.VUE_APP_GRAPHQL_PORT}`)
})
})
}
2 changes: 1 addition & 1 deletion packages/@vue/cli-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"lint-staged": "^6.0.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"vue-cli-plugin-apollo": "^0.7.7",
"vue-cli-plugin-apollo": "^0.7.8",
"vue-template-compiler": "^2.5.16"
},
"browserslist": [
Expand Down
6 changes: 1 addition & 5 deletions packages/@vue/cli/lib/ui.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { log, error, openBrowser } = require('@vue/cli-shared-utils')
const { log, error } = require('@vue/cli-shared-utils')
const portfinder = require('portfinder')
const execa = require('execa')

Expand All @@ -23,10 +23,6 @@ async function ui (options = {}, context = process.cwd()) {
cwd: context,
stdio: ['inherit', 'inherit', 'inherit']
})

setTimeout(() => {
openBrowser(`http://localhost:${port}`)
}, 1000)
}

module.exports = (...args) => {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10964,9 +10964,9 @@ vue-class-component@^6.0.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/vue-class-component/-/vue-class-component-6.2.0.tgz#7adb1daa9a868c75f30f97f33f4f1b94aee62089"

vue-cli-plugin-apollo@^0.7.7:
version "0.7.7"
resolved "https://registry.yarnpkg.com/vue-cli-plugin-apollo/-/vue-cli-plugin-apollo-0.7.7.tgz#47e7e30e02f8eca20c1cc5dd0395fb2c3848afc8"
vue-cli-plugin-apollo@^0.7.8:
version "0.7.8"
resolved "https://registry.yarnpkg.com/vue-cli-plugin-apollo/-/vue-cli-plugin-apollo-0.7.8.tgz#087898aaba4015e2791149a8d01e230ddc919beb"
dependencies:
apollo-engine "^1.1.0"
apollo-server-express "^1.3.2"
Expand Down

0 comments on commit 602be03

Please sign in to comment.