Skip to content

Commit

Permalink
feat(ui): dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed May 1, 2018
1 parent 4cb15f3 commit fef2f78
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 23 deletions.
35 changes: 24 additions & 11 deletions docs/plugin-dev-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
This guide will walk you through the development of cli-ui specific features for your vue-cli plugins.

- [Plugin Info](#plugin-info)
- [Project configurations](#project-configurations)
- [Project tasks](#project-tasks)
- [Client addon](#client-addon)
- [Custom views](#custom-views)
- [Shared data](#shared-data)
- [Plugin actions](#plugin-actions)
- [Inter-process communication (IPC)](#inter-process-communication-ipc)
- [Local storage](#local-storage)
- [Localization](#localization)
- [Hooks](#hooks)
- [Public static files](#public-static-files)
- [Logo](#logo)
- [Discoverability](#discoverability)
- [UI API](#ui-api)
- [UI files](#ui-files)
- [Dev mode](#dev-mode)
- [Project configurations](#project-configurations)
- [Project tasks](#project-tasks)
- [Client addon](#client-addon)
- [Custom views](#custom-views)
- [Shared data](#shared-data)
- [Plugin actions](#plugin-actions)
- [Inter-process communication (IPC)](#inter-process-communication-ipc)
- [Local storage](#local-storage)
- [Localization](#localization)
- [Hooks](#hooks)
- [Public static files](#public-static-files)

## Plugin Info

Expand Down Expand Up @@ -75,6 +80,14 @@ module.exports = api => {

**⚠️ The files will be reloaded when feetching the plugin list in the 'Project plugins' view. To apply changes, click on the 'Project plugins' button in the navigation sidebar on the left.**

### Dev mode

While building your plugin, you may want to run the cli-ui in Dev mode, so it will output useful logs to you:

```
vue ui --dev
```

### Project configurations

![Configuration ui](./config-ui.png)
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"terminate": "^2.1.0",
"vue": "^2.5.16",
"vue-apollo": "^3.0.0-beta.5",
"vue-cli-plugin-apollo": "^0.7.8",
"vue-cli-plugin-apollo": "^0.7.10",
"vue-i18n": "^7.6.0",
"vue-instantsearch": "^1.5.1",
"vue-meta": "^1.5.0",
Expand Down
1 change: 1 addition & 0 deletions packages/@vue/cli/bin/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ program
program
.command('ui')
.option('-p, --port <port>', 'Port used for the UI server (by default search for awailable port)')
.option('-D, --dev', 'Run in dev mode')
.description('start and open the vue-cli ui')
.action((cmd) => {
require('../lib/ui')(cleanArgs(cmd))
Expand Down
10 changes: 8 additions & 2 deletions packages/@vue/cli/lib/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ async function ui (options = {}, context = process.cwd()) {
port = await portfinder.getPortPromise()
}

// Re-run in production mode
if (process.env.NODE_ENV !== 'production') {
const configOk = process.env.VUE_UI_CONFIGURED === 'OK'
if (!configOk) {
process.env.VUE_UI_CONFIGURED = 'OK'
// Config
process.env.VUE_APP_GRAPHQL_PORT = port
process.env.VUE_APP_GRAPHQL_ENDPOINT = ''
process.env.VUE_APP_GRAPHQL_PLAYGROUND_PATH = '/graphql-playground'
}

if (!options.dev && !configOk) {
// Re-run in production mode
const command = require.resolve('@vue/cli/bin/vue')
execa('cross-env', [
'NODE_ENV=production',
Expand All @@ -33,6 +38,7 @@ async function ui (options = {}, context = process.cwd()) {
mock: false,
apolloEngine: false,
timeout: 999999999,
quiet: true,
paths: {
typeDefs: require.resolve('@vue/cli-ui/src/graphql-api/type-defs.js'),
resolvers: require.resolve('@vue/cli-ui/src/graphql-api/resolvers.js'),
Expand Down
39 changes: 30 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,8 @@
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.48.tgz#3523b126a0b049482e1c3c11877460f76622ffab"

"@types/node@*":
version "10.0.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.0.0.tgz#c40f8e07dce607d3ef25a626b93a6a7cdcf97881"
version "8.10.11"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.11.tgz#971ea8cb91adbe0b74e3fbd867dec192d5893a5f"

"@types/node@^9.3.0":
version "9.6.7"
Expand All @@ -930,8 +930,8 @@
"@types/spdy" "*"

"@types/serve-static@*":
version "1.13.1"
resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.1.tgz#1d2801fa635d274cd97d4ec07e26b21b44127492"
version "1.13.2"
resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.2.tgz#f5ac4d7a6420a99a6a45af4719f4dcd8cd907a48"
dependencies:
"@types/express-serve-static-core" "*"
"@types/mime" "*"
Expand Down Expand Up @@ -9532,7 +9532,7 @@ safe-buffer@5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"

safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"

Expand Down Expand Up @@ -10364,15 +10364,15 @@ tar-stream@^1.5.2:
xtend "^4.0.0"

tar@^4:
version "4.4.1"
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.1.tgz#b25d5a8470c976fd7a9a8a350f42c59e9fa81749"
version "4.4.2"
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.2.tgz#60685211ba46b38847b1ae7ee1a24d744a2cd462"
dependencies:
chownr "^1.0.1"
fs-minipass "^1.2.5"
minipass "^2.2.4"
minizlib "^1.1.0"
mkdirp "^0.5.0"
safe-buffer "^5.1.1"
safe-buffer "^5.1.2"
yallist "^3.0.2"

temp-dir@^1.0.0:
Expand Down Expand Up @@ -11050,7 +11050,28 @@ 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.8, vue-cli-plugin-apollo@^0.7.9:
vue-cli-plugin-apollo@^0.7.10:
version "0.7.10"
resolved "https://registry.yarnpkg.com/vue-cli-plugin-apollo/-/vue-cli-plugin-apollo-0.7.10.tgz#d98a9e5648f4ce62766a22657d717337fad04887"
dependencies:
apollo-engine "^1.1.0"
apollo-server-express "^1.3.2"
apollo-upload-server "^5.0.0"
body-parser "^1.18.2"
cors "^2.8.4"
cross-env "^5.1.4"
express "^4.16.2"
graphql "^0.13.1"
graphql-playground-middleware-express "^1.5.7"
graphql-subscriptions "^0.5.8"
graphql-tools "^2.21.0"
lowdb "^1.0.0"
mkdirp "^0.5.1"
nodemon "^1.17.1"
shortid "^2.2.8"
subscriptions-transport-ws "^0.9.6"

vue-cli-plugin-apollo@^0.7.9:
version "0.7.9"
resolved "https://registry.yarnpkg.com/vue-cli-plugin-apollo/-/vue-cli-plugin-apollo-0.7.9.tgz#73db0c38ba24ca3caf49d958a8d3c431ed0ff037"
dependencies:
Expand Down

0 comments on commit fef2f78

Please sign in to comment.