Skip to content

Commit fef2f78

Browse files
author
Guillaume Chau
committed
feat(ui): dev mode
1 parent 4cb15f3 commit fef2f78

File tree

5 files changed

+64
-23
lines changed

5 files changed

+64
-23
lines changed

docs/plugin-dev-ui.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,22 @@
33
This guide will walk you through the development of cli-ui specific features for your vue-cli plugins.
44

55
- [Plugin Info](#plugin-info)
6-
- [Project configurations](#project-configurations)
7-
- [Project tasks](#project-tasks)
8-
- [Client addon](#client-addon)
9-
- [Custom views](#custom-views)
10-
- [Shared data](#shared-data)
11-
- [Plugin actions](#plugin-actions)
12-
- [Inter-process communication (IPC)](#inter-process-communication-ipc)
13-
- [Local storage](#local-storage)
14-
- [Localization](#localization)
15-
- [Hooks](#hooks)
16-
- [Public static files](#public-static-files)
6+
- [Logo](#logo)
7+
- [Discoverability](#discoverability)
8+
- [UI API](#ui-api)
9+
- [UI files](#ui-files)
10+
- [Dev mode](#dev-mode)
11+
- [Project configurations](#project-configurations)
12+
- [Project tasks](#project-tasks)
13+
- [Client addon](#client-addon)
14+
- [Custom views](#custom-views)
15+
- [Shared data](#shared-data)
16+
- [Plugin actions](#plugin-actions)
17+
- [Inter-process communication (IPC)](#inter-process-communication-ipc)
18+
- [Local storage](#local-storage)
19+
- [Localization](#localization)
20+
- [Hooks](#hooks)
21+
- [Public static files](#public-static-files)
1722

1823
## Plugin Info
1924

@@ -75,6 +80,14 @@ module.exports = api => {
7580

7681
**⚠️ 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.**
7782

83+
### Dev mode
84+
85+
While building your plugin, you may want to run the cli-ui in Dev mode, so it will output useful logs to you:
86+
87+
```
88+
vue ui --dev
89+
```
90+
7891
### Project configurations
7992

8093
![Configuration ui](./config-ui.png)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"terminate": "^2.1.0",
4444
"vue": "^2.5.16",
4545
"vue-apollo": "^3.0.0-beta.5",
46-
"vue-cli-plugin-apollo": "^0.7.8",
46+
"vue-cli-plugin-apollo": "^0.7.10",
4747
"vue-i18n": "^7.6.0",
4848
"vue-instantsearch": "^1.5.1",
4949
"vue-meta": "^1.5.0",

packages/@vue/cli/bin/vue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ program
9595
program
9696
.command('ui')
9797
.option('-p, --port <port>', 'Port used for the UI server (by default search for awailable port)')
98+
.option('-D, --dev', 'Run in dev mode')
9899
.description('start and open the vue-cli ui')
99100
.action((cmd) => {
100101
require('../lib/ui')(cleanArgs(cmd))

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ async function ui (options = {}, context = process.cwd()) {
88
port = await portfinder.getPortPromise()
99
}
1010

11-
// Re-run in production mode
12-
if (process.env.NODE_ENV !== 'production') {
11+
const configOk = process.env.VUE_UI_CONFIGURED === 'OK'
12+
if (!configOk) {
13+
process.env.VUE_UI_CONFIGURED = 'OK'
14+
// Config
1315
process.env.VUE_APP_GRAPHQL_PORT = port
1416
process.env.VUE_APP_GRAPHQL_ENDPOINT = ''
1517
process.env.VUE_APP_GRAPHQL_PLAYGROUND_PATH = '/graphql-playground'
18+
}
1619

20+
if (!options.dev && !configOk) {
21+
// Re-run in production mode
1722
const command = require.resolve('@vue/cli/bin/vue')
1823
execa('cross-env', [
1924
'NODE_ENV=production',
@@ -33,6 +38,7 @@ async function ui (options = {}, context = process.cwd()) {
3338
mock: false,
3439
apolloEngine: false,
3540
timeout: 999999999,
41+
quiet: true,
3642
paths: {
3743
typeDefs: require.resolve('@vue/cli-ui/src/graphql-api/type-defs.js'),
3844
resolvers: require.resolve('@vue/cli-ui/src/graphql-api/resolvers.js'),

yarn.lock

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,8 @@
914914
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.48.tgz#3523b126a0b049482e1c3c11877460f76622ffab"
915915

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

920920
"@types/node@^9.3.0":
921921
version "9.6.7"
@@ -930,8 +930,8 @@
930930
"@types/spdy" "*"
931931

932932
"@types/serve-static@*":
933-
version "1.13.1"
934-
resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.1.tgz#1d2801fa635d274cd97d4ec07e26b21b44127492"
933+
version "1.13.2"
934+
resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.2.tgz#f5ac4d7a6420a99a6a45af4719f4dcd8cd907a48"
935935
dependencies:
936936
"@types/express-serve-static-core" "*"
937937
"@types/mime" "*"
@@ -9532,7 +9532,7 @@ safe-buffer@5.1.1:
95329532
version "5.1.1"
95339533
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
95349534

9535-
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:
9535+
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:
95369536
version "5.1.2"
95379537
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
95389538

@@ -10364,15 +10364,15 @@ tar-stream@^1.5.2:
1036410364
xtend "^4.0.0"
1036510365

1036610366
tar@^4:
10367-
version "4.4.1"
10368-
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.1.tgz#b25d5a8470c976fd7a9a8a350f42c59e9fa81749"
10367+
version "4.4.2"
10368+
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.2.tgz#60685211ba46b38847b1ae7ee1a24d744a2cd462"
1036910369
dependencies:
1037010370
chownr "^1.0.1"
1037110371
fs-minipass "^1.2.5"
1037210372
minipass "^2.2.4"
1037310373
minizlib "^1.1.0"
1037410374
mkdirp "^0.5.0"
10375-
safe-buffer "^5.1.1"
10375+
safe-buffer "^5.1.2"
1037610376
yallist "^3.0.2"
1037710377

1037810378
temp-dir@^1.0.0:
@@ -11050,7 +11050,28 @@ vue-class-component@^6.0.0:
1105011050
version "6.2.0"
1105111051
resolved "https://registry.yarnpkg.com/vue-class-component/-/vue-class-component-6.2.0.tgz#7adb1daa9a868c75f30f97f33f4f1b94aee62089"
1105211052

11053-
vue-cli-plugin-apollo@^0.7.8, vue-cli-plugin-apollo@^0.7.9:
11053+
vue-cli-plugin-apollo@^0.7.10:
11054+
version "0.7.10"
11055+
resolved "https://registry.yarnpkg.com/vue-cli-plugin-apollo/-/vue-cli-plugin-apollo-0.7.10.tgz#d98a9e5648f4ce62766a22657d717337fad04887"
11056+
dependencies:
11057+
apollo-engine "^1.1.0"
11058+
apollo-server-express "^1.3.2"
11059+
apollo-upload-server "^5.0.0"
11060+
body-parser "^1.18.2"
11061+
cors "^2.8.4"
11062+
cross-env "^5.1.4"
11063+
express "^4.16.2"
11064+
graphql "^0.13.1"
11065+
graphql-playground-middleware-express "^1.5.7"
11066+
graphql-subscriptions "^0.5.8"
11067+
graphql-tools "^2.21.0"
11068+
lowdb "^1.0.0"
11069+
mkdirp "^0.5.1"
11070+
nodemon "^1.17.1"
11071+
shortid "^2.2.8"
11072+
subscriptions-transport-ws "^0.9.6"
11073+
11074+
vue-cli-plugin-apollo@^0.7.9:
1105411075
version "0.7.9"
1105511076
resolved "https://registry.yarnpkg.com/vue-cli-plugin-apollo/-/vue-cli-plugin-apollo-0.7.9.tgz#73db0c38ba24ca3caf49d958a8d3c431ed0ff037"
1105611077
dependencies:

0 commit comments

Comments
 (0)