From cdf9d07790ec565a1d0249d9f451d487cca7a732 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Mon, 16 Apr 2018 18:18:45 +0200 Subject: [PATCH] feat(ui): vue ui command --- packages/@vue/cli-service-global/package.json | 2 + packages/@vue/cli-service/lib/Service.js | 1 + packages/@vue/cli-service/lib/commands/ui.js | 22 +++ packages/@vue/cli-service/ui.js | 2 +- .../cli-ui-addon-build/public/favicon.ico | Bin 1150 -> 0 bytes .../@vue/cli-ui-addon-build/public/index.html | 17 --- .../cli-ui-addon-build/src/assets/logo.png | Bin 6849 -> 0 bytes .../@vue/cli-ui-addon-build/vue.config.js | 12 -- .../.babelrc | 0 .../.eslintrc.json | 0 .../.gitignore | 0 .../.postcssrc | 0 .../package.json | 4 +- .../@vue/cli-ui-addon-webpack/public/.gitkeep | 0 .../src/assets/speeds.json | 0 .../src/assets/webpack.svg | 1 + .../src/components/AssetList.vue | 0 .../src/components/AssetListItem.vue | 0 .../src/components/BuildProgress.vue | 0 .../src/components/BuildStatus.vue | 0 .../src/components/ModuleList.vue | 0 .../src/components/ModuleListItem.vue | 0 .../src/components/SpeedStats.vue | 0 .../src/components/SpeedStatsItem.vue | 0 .../src/components/WebpackDashboard.vue | 14 ++ .../src/filters.js | 0 .../src/main.js | 0 .../src/store/index.js | 0 .../src/util/assets.js | 0 .../src/util/modules.js | 0 .../@vue/cli-ui-addon-webpack/vue.config.js | 25 ++++ packages/@vue/cli-ui/.env.production | 1 + packages/@vue/cli-ui/package.json | 5 +- packages/@vue/cli-ui/src/apollo.js | 2 +- .../cli-ui/src/components/ContentView.vue | 4 +- .../@vue/cli-ui/src/components/NavList.vue | 2 +- .../@vue/cli-ui/src/components/StepWizard.vue | 5 +- .../graphql-api/connectors/client-addons.js | 38 ++++- .../@vue/cli-ui/src/graphql-api/resolvers.js | 10 ++ .../@vue/cli-ui/src/graphql-api/server.js | 13 ++ packages/@vue/cli-ui/src/style/main.styl | 2 +- .../cli-ui/src/views/ProjectTaskDetails.vue | 8 ++ packages/@vue/cli-ui/src/vue-apollo.js | 9 +- packages/@vue/cli/bin/vue.js | 8 ++ packages/@vue/cli/lib/ui.js | 39 ++++++ yarn.lock | 132 ++---------------- 46 files changed, 216 insertions(+), 162 deletions(-) create mode 100644 packages/@vue/cli-service/lib/commands/ui.js delete mode 100644 packages/@vue/cli-ui-addon-build/public/favicon.ico delete mode 100644 packages/@vue/cli-ui-addon-build/public/index.html delete mode 100644 packages/@vue/cli-ui-addon-build/src/assets/logo.png delete mode 100644 packages/@vue/cli-ui-addon-build/vue.config.js rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/.babelrc (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/.eslintrc.json (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/.gitignore (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/.postcssrc (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/package.json (90%) create mode 100644 packages/@vue/cli-ui-addon-webpack/public/.gitkeep rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/assets/speeds.json (100%) create mode 100644 packages/@vue/cli-ui-addon-webpack/src/assets/webpack.svg rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/components/AssetList.vue (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/components/AssetListItem.vue (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/components/BuildProgress.vue (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/components/BuildStatus.vue (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/components/ModuleList.vue (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/components/ModuleListItem.vue (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/components/SpeedStats.vue (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/components/SpeedStatsItem.vue (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/components/WebpackDashboard.vue (89%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/filters.js (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/main.js (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/store/index.js (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/util/assets.js (100%) rename packages/@vue/{cli-ui-addon-build => cli-ui-addon-webpack}/src/util/modules.js (100%) create mode 100644 packages/@vue/cli-ui-addon-webpack/vue.config.js create mode 100644 packages/@vue/cli-ui/.env.production create mode 100644 packages/@vue/cli-ui/src/graphql-api/server.js create mode 100644 packages/@vue/cli/lib/ui.js diff --git a/packages/@vue/cli-service-global/package.json b/packages/@vue/cli-service-global/package.json index be8e98cd72..70a664ff2f 100644 --- a/packages/@vue/cli-service-global/package.json +++ b/packages/@vue/cli-service-global/package.json @@ -25,6 +25,8 @@ "@vue/cli-plugin-babel": "^3.0.0-beta.6", "@vue/cli-plugin-eslint": "^3.0.0-beta.6", "@vue/cli-service": "^3.0.0-beta.6", + "@vue/cli-ui": "^3.0.0-beta.6", + "@vue/cli-ui-addon-webpack": "^3.0.0-beta.6", "chalk": "^2.3.2", "eslint-plugin-vue": "^4.3.0", "resolve": "^1.5.0", diff --git a/packages/@vue/cli-service/lib/Service.js b/packages/@vue/cli-service/lib/Service.js index c903ff9aac..60b9dd40a2 100644 --- a/packages/@vue/cli-service/lib/Service.js +++ b/packages/@vue/cli-service/lib/Service.js @@ -91,6 +91,7 @@ module.exports = class Service { './commands/build', './commands/inspect', './commands/help', + './commands/ui', // config plugins are order sensitive './config/base', './config/css', diff --git a/packages/@vue/cli-service/lib/commands/ui.js b/packages/@vue/cli-service/lib/commands/ui.js new file mode 100644 index 0000000000..204170951f --- /dev/null +++ b/packages/@vue/cli-service/lib/commands/ui.js @@ -0,0 +1,22 @@ +module.exports = api => { + api.registerCommand('ui', args => { + api.setMode('production') + + let server = require('vue-cli-plugin-apollo/graphql-server') + server = server.default || server + + const opts = { + mock: false, + apolloEngine: false, + timeout: 0, + paths: { + typeDefs: require.resolve('@vue/cli-ui/src/graphql-api/type-defs.js'), + resolvers: require.resolve('@vue/cli-ui/src/graphql-api/resolvers.js'), + context: require.resolve('@vue/cli-ui/src/graphql-api/context.js'), + server: require.resolve('@vue/cli-ui/src/graphql-api/server.js') + } + } + + server(opts) + }) +} diff --git a/packages/@vue/cli-service/ui.js b/packages/@vue/cli-service/ui.js index 6e609a0e07..1a9b30df57 100644 --- a/packages/@vue/cli-service/ui.js +++ b/packages/@vue/cli-service/ui.js @@ -202,6 +202,6 @@ module.exports = api => { // Testing client addon api.addClientAddon({ id: 'vue-webpack', - url: 'http://localhost:8081/app.js' + path: '@vue/cli-ui-addon-webpack/dist' }) } diff --git a/packages/@vue/cli-ui-addon-build/public/favicon.ico b/packages/@vue/cli-ui-addon-build/public/favicon.ico deleted file mode 100644 index c7b9a43c8cd16d0b434adaf513fcacb340809a11..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmchVOGsN$5QZm2NTI$erQpKHrdQX(jn+pVxKN`Ng)RzW5+8_2Xb@Y)Dkd6tq9V8u z3WAh^C@KZ1kA;tohzs}b3NC_*QmUXr$oP*rH(2mdT{z*(KX=aj=bX$9kqMvFRKj;Q zwI&d~A);J>5-PDega~WT5us%#Dc(Y}C4WpP?+fS;FaZ*z_CFzgiW=w{I02=q_TUz( z?=^H2uwoIK1n%|Ay21~QgjV1emYtWttJdz^L#=DjJ@Ex*9UPc*7<=rZo*_NAh4PxA zqkso~Ioa1y$e+3kIkXi29YNLi&lW}vY6C}ut4{8ou(7w=$_=$v{yJ$h?y!&bJfq*( zL_NQRF37$6e>%9erGV?p^lRFD?|5J_eupXaS;QluyrOmBT>PJhirMYb*i?(4Tf=j~?VvnUlY_ zDCVuuk3E&T9aP~Cr-0i-MaKUjf_|U!=R&t}_CfD=d${p~HH`BPaqb9aXT}UI$iGRg z>0^GlZ`vM4?;$*LhfI(RG|XK4GF+@-W*W}YJT5&2N_ZyZuaM_Ry=%PWx>r0P(Rc?> jRc4}SfGA>*agjwN{7E7DEm(*)%rSx{B0<6wBoglxJAy|R diff --git a/packages/@vue/cli-ui-addon-build/public/index.html b/packages/@vue/cli-ui-addon-build/public/index.html deleted file mode 100644 index ffaf0a08a6..0000000000 --- a/packages/@vue/cli-ui-addon-build/public/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - cli-ui-addon-build - - - -
- - - diff --git a/packages/@vue/cli-ui-addon-build/src/assets/logo.png b/packages/@vue/cli-ui-addon-build/src/assets/logo.png deleted file mode 100644 index f3d2503fc2a44b5053b0837ebea6e87a2d339a43..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6849 zcmaKRcUV(fvo}bjDT-7nLI_nlK}sT_69H+`qzVWDA|yaU?}j417wLi^B1KB1SLsC& zL0ag7$U(XW5YR7p&Ux?sP$d4lvMt8C^+TcQu4F zQqv!UF!I+kw)c0jhd6+g6oCr9P?7)?!qX1ui*iL{p}sKCAGuJ{{W)0z1pLF|=>h}& zt(2Lr0Z`2ig8<5i%Zk}cO5Fm=LByqGWaS`oqChZdEFmc`0hSb#gg|Aap^{+WKOYcj zHjINK)KDG%&s?Mt4CL(T=?;~U@bU2x_mLKN!#GJuK_CzbNw5SMEJorG!}_5;?R>@1 zSl)jns3WlU7^J%=(hUtfmuUCU&C3%8B5C^f5>W2Cy8jW3#{Od{lF1}|?c61##3dzA zsPlFG;l_FzBK}8>|H_Ru_H#!_7$UH4UKo3lKOA}g1(R&|e@}GINYVzX?q=_WLZCgh z)L|eJMce`D0EIwgRaNETDsr+?vQknSGAi=7H00r`QnI%oQnFxm`G2umXso9l+8*&Q z7WqF|$p49js$mdzo^BXpH#gURy=UO;=IMrYc5?@+sR4y_?d*~0^YP7d+y0{}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z%U^bmpn%;(V%%ugMk92&?_XX1K@mwnVSE6!&%P%Wdi7_h`CpScvspMx?N zQUR>oadnG17#hNc$pkTp+9lW+MBKHRZ~74XWUryd)4yd zj98$%XmIL4(9OnoeO5Fnyn&fpQ9b0h4e6EHHw*l68j;>(ya`g^S&y2{O8U>1*>4zR zq*WSI_2o$CHQ?x0!wl9bpx|Cm2+kFMR)oMud1%n2=qn5nE&t@Fgr#=Zv2?}wtEz^T z9rrj=?IH*qI5{G@Rn&}^Z{+TW}mQeb9=8b<_a`&Cm#n%n~ zU47MvCBsdXFB1+adOO)03+nczfWa#vwk#r{o{dF)QWya9v2nv43Zp3%Ps}($lA02*_g25t;|T{A5snSY?3A zrRQ~(Ygh_ebltHo1VCbJb*eOAr;4cnlXLvI>*$-#AVsGg6B1r7@;g^L zFlJ_th0vxO7;-opU@WAFe;<}?!2q?RBrFK5U{*ai@NLKZ^};Ul}beukveh?TQn;$%9=R+DX07m82gP$=}Uo_%&ngV`}Hyv8g{u z3SWzTGV|cwQuFIs7ZDOqO_fGf8Q`8MwL}eUp>q?4eqCmOTcwQuXtQckPy|4F1on8l zP*h>d+cH#XQf|+6c|S{7SF(Lg>bR~l(0uY?O{OEVlaxa5@e%T&xju=o1`=OD#qc16 zSvyH*my(dcp6~VqR;o(#@m44Lug@~_qw+HA=mS#Z^4reBy8iV?H~I;{LQWk3aKK8$bLRyt$g?-icon-square-small \ No newline at end of file diff --git a/packages/@vue/cli-ui-addon-build/src/components/AssetList.vue b/packages/@vue/cli-ui-addon-webpack/src/components/AssetList.vue similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/components/AssetList.vue rename to packages/@vue/cli-ui-addon-webpack/src/components/AssetList.vue diff --git a/packages/@vue/cli-ui-addon-build/src/components/AssetListItem.vue b/packages/@vue/cli-ui-addon-webpack/src/components/AssetListItem.vue similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/components/AssetListItem.vue rename to packages/@vue/cli-ui-addon-webpack/src/components/AssetListItem.vue diff --git a/packages/@vue/cli-ui-addon-build/src/components/BuildProgress.vue b/packages/@vue/cli-ui-addon-webpack/src/components/BuildProgress.vue similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/components/BuildProgress.vue rename to packages/@vue/cli-ui-addon-webpack/src/components/BuildProgress.vue diff --git a/packages/@vue/cli-ui-addon-build/src/components/BuildStatus.vue b/packages/@vue/cli-ui-addon-webpack/src/components/BuildStatus.vue similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/components/BuildStatus.vue rename to packages/@vue/cli-ui-addon-webpack/src/components/BuildStatus.vue diff --git a/packages/@vue/cli-ui-addon-build/src/components/ModuleList.vue b/packages/@vue/cli-ui-addon-webpack/src/components/ModuleList.vue similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/components/ModuleList.vue rename to packages/@vue/cli-ui-addon-webpack/src/components/ModuleList.vue diff --git a/packages/@vue/cli-ui-addon-build/src/components/ModuleListItem.vue b/packages/@vue/cli-ui-addon-webpack/src/components/ModuleListItem.vue similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/components/ModuleListItem.vue rename to packages/@vue/cli-ui-addon-webpack/src/components/ModuleListItem.vue diff --git a/packages/@vue/cli-ui-addon-build/src/components/SpeedStats.vue b/packages/@vue/cli-ui-addon-webpack/src/components/SpeedStats.vue similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/components/SpeedStats.vue rename to packages/@vue/cli-ui-addon-webpack/src/components/SpeedStats.vue diff --git a/packages/@vue/cli-ui-addon-build/src/components/SpeedStatsItem.vue b/packages/@vue/cli-ui-addon-webpack/src/components/SpeedStatsItem.vue similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/components/SpeedStatsItem.vue rename to packages/@vue/cli-ui-addon-webpack/src/components/SpeedStatsItem.vue diff --git a/packages/@vue/cli-ui-addon-build/src/components/WebpackDashboard.vue b/packages/@vue/cli-ui-addon-webpack/src/components/WebpackDashboard.vue similarity index 89% rename from packages/@vue/cli-ui-addon-build/src/components/WebpackDashboard.vue rename to packages/@vue/cli-ui-addon-webpack/src/components/WebpackDashboard.vue index 575184f5eb..603ef0c4e2 100644 --- a/packages/@vue/cli-ui-addon-build/src/components/WebpackDashboard.vue +++ b/packages/@vue/cli-ui-addon-webpack/src/components/WebpackDashboard.vue @@ -17,6 +17,12 @@ + + @@ -114,4 +120,12 @@ export default { .pane-toolbar margin-bottom $padding-item + + .logo + margin $padding-item 0 + v-box() + box-center() + .webpack-logo + width 32px + height @width diff --git a/packages/@vue/cli-ui-addon-build/src/filters.js b/packages/@vue/cli-ui-addon-webpack/src/filters.js similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/filters.js rename to packages/@vue/cli-ui-addon-webpack/src/filters.js diff --git a/packages/@vue/cli-ui-addon-build/src/main.js b/packages/@vue/cli-ui-addon-webpack/src/main.js similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/main.js rename to packages/@vue/cli-ui-addon-webpack/src/main.js diff --git a/packages/@vue/cli-ui-addon-build/src/store/index.js b/packages/@vue/cli-ui-addon-webpack/src/store/index.js similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/store/index.js rename to packages/@vue/cli-ui-addon-webpack/src/store/index.js diff --git a/packages/@vue/cli-ui-addon-build/src/util/assets.js b/packages/@vue/cli-ui-addon-webpack/src/util/assets.js similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/util/assets.js rename to packages/@vue/cli-ui-addon-webpack/src/util/assets.js diff --git a/packages/@vue/cli-ui-addon-build/src/util/modules.js b/packages/@vue/cli-ui-addon-webpack/src/util/modules.js similarity index 100% rename from packages/@vue/cli-ui-addon-build/src/util/modules.js rename to packages/@vue/cli-ui-addon-webpack/src/util/modules.js diff --git a/packages/@vue/cli-ui-addon-webpack/vue.config.js b/packages/@vue/cli-ui-addon-webpack/vue.config.js new file mode 100644 index 0000000000..ad293d33a5 --- /dev/null +++ b/packages/@vue/cli-ui-addon-webpack/vue.config.js @@ -0,0 +1,25 @@ +module.exports = { + baseUrl: '/_addon/vue-webpack', + configureWebpack: { + output: { + // Important + filename: 'index.js' + } + }, + css: { + extract: false + }, + chainWebpack: config => { + config.plugins.delete('preload') + config.plugins.delete('prefetch') + config.plugins.delete('html') + config.plugins.delete('split-vendor') + config.plugins.delete('split-vendor-async') + config.plugins.delete('split-manifest') + }, + devServer: { + headers: { + 'Access-Control-Allow-Origin': '*' + } + } +} diff --git a/packages/@vue/cli-ui/.env.production b/packages/@vue/cli-ui/.env.production new file mode 100644 index 0000000000..9646df27dc --- /dev/null +++ b/packages/@vue/cli-ui/.env.production @@ -0,0 +1 @@ +VUE_APP_GRAPHQL_ENDPOINT= diff --git a/packages/@vue/cli-ui/package.json b/packages/@vue/cli-ui/package.json index 113f3678a5..3c61ef8f2f 100644 --- a/packages/@vue/cli-ui/package.json +++ b/packages/@vue/cli-ui/package.json @@ -12,7 +12,7 @@ "prod-graphql-api": "cross-env NODE_ENV=production vue-cli-service run-graphql-api" }, "dependencies": { - "@vue/ui": "^0.2.2", + "@vue/ui": "^0.2.4", "ansi_up": "^2.0.2", "apollo-cache-inmemory": "^1.1.10", "apollo-client": "^2.2.6", @@ -22,6 +22,7 @@ "apollo-link-ws": "^1.0.0", "apollo-utilities": "^1.0.9", "clone": "^1.0.4", + "express-history-api-fallback": "^2.2.1", "file-icons-js": "^1.0.3", "graphql": "^0.13.0", "graphql-type-json": "^0.2.0", @@ -53,7 +54,7 @@ "lint-staged": "^6.0.0", "stylus": "^0.54.5", "stylus-loader": "^3.0.1", - "vue-cli-plugin-apollo": "^0.7.4", + "vue-cli-plugin-apollo": "^0.7.7", "vue-template-compiler": "^2.5.17-beta.0" }, "browserslist": [ diff --git a/packages/@vue/cli-ui/src/apollo.js b/packages/@vue/cli-ui/src/apollo.js index fecd872d83..64a7b621c2 100644 --- a/packages/@vue/cli-ui/src/apollo.js +++ b/packages/@vue/cli-ui/src/apollo.js @@ -26,7 +26,7 @@ export default function createApolloClient ({ base, endpoints, persisting }) { const stateLink = withClientState({ defaults, cache, resolvers }) // Web socket - wsClient = new SubscriptionClient(base.replace(/^https?/i, 'ws' + (process.env.NODE_ENV === 'production' ? 's' : '')) + + wsClient = new SubscriptionClient(base.replace(/^https?/i, 'ws') + endpoints.subscription, { reconnect: true }) diff --git a/packages/@vue/cli-ui/src/components/ContentView.vue b/packages/@vue/cli-ui/src/components/ContentView.vue index 5dec55bd28..cd0e98f924 100644 --- a/packages/@vue/cli-ui/src/components/ContentView.vue +++ b/packages/@vue/cli-ui/src/components/ContentView.vue @@ -60,9 +60,9 @@ export default { .content grid-area content - background darken($color-background-light, 3%) + background $color-background-light .wrapper - background $color-background-light + background $md-white position relative overflow-x hidden overflow-y auto diff --git a/packages/@vue/cli-ui/src/components/NavList.vue b/packages/@vue/cli-ui/src/components/NavList.vue index 78ff61ee8f..95021f2e5f 100644 --- a/packages/@vue/cli-ui/src/components/NavList.vue +++ b/packages/@vue/cli-ui/src/components/NavList.vue @@ -51,5 +51,5 @@ export default { .nav-list overflow-x none overflow-y auto - background darken($color-background-light, 2%) + background $color-background-light diff --git a/packages/@vue/cli-ui/src/components/StepWizard.vue b/packages/@vue/cli-ui/src/components/StepWizard.vue index 593a46f5e3..179fadaa3c 100644 --- a/packages/@vue/cli-ui/src/components/StepWizard.vue +++ b/packages/@vue/cli-ui/src/components/StepWizard.vue @@ -72,7 +72,7 @@ export default { margin 0 auto .main-tabs - height 100% + height 0 flex auto 1 1 >>> .vue-ui-tab @@ -86,6 +86,7 @@ export default { >>> .tabs-content height 0 + flex auto 1 1 &, >>> .vue-ui-tab, @@ -121,7 +122,7 @@ export default { margin 0 auto $max-width = 1200px .shell - background $color-background-light + background $md-white .header .content, >>> .vue-ui-tab max-width $max-width diff --git a/packages/@vue/cli-ui/src/graphql-api/connectors/client-addons.js b/packages/@vue/cli-ui/src/graphql-api/connectors/client-addons.js index 8b7355b366..9a651ff583 100644 --- a/packages/@vue/cli-ui/src/graphql-api/connectors/client-addons.js +++ b/packages/@vue/cli-ui/src/graphql-api/connectors/client-addons.js @@ -1,13 +1,19 @@ +const path = require('path') +// Subs const channels = require('../channels') let addons = [] +let baseUrl = process.env.VUE_APP_GRAPHQL_ENDPOINT +if (typeof baseUrl === 'undefined') baseUrl = 'http://localhost:4000' +console.log(process.env.VUE_APP_GRAPHQL_ENDPOINT, baseUrl) + function list (context) { return addons } function add (options, context) { - if (findOne(options.id)) return + if (findOne(options.id)) remove(options.id, context) addons.push(options) context.pubsub.publish(channels.CLIENT_ADDON_ADDED, { @@ -15,7 +21,7 @@ function add (options, context) { }) } -function findOne (id, context) { +function findOne (id, context = null) { return addons.find( addon => addon.id === id ) @@ -28,9 +34,35 @@ function remove (id, context) { if (index !== -1) addons.splice(index, 1) } +function getUrl (addon, context) { + return addon.url || `${baseUrl}/_addon/${addon.id}/index.js` +} + +function getBasePath (filePath) { + const index = filePath.lastIndexOf('/index.js') + if (index !== -1) { + return filePath.substr(0, index) + } + return filePath +} + +function serve (req, res) { + const { id, 0: file } = req.params + const addon = findOne(id) + if (addon) { + const basePath = getBasePath(require.resolve(addon.path)) + res.sendFile(path.join(basePath, file)) + } else { + res.status(404) + res.send(`Addon ${id} not found in loaded addons. Try opening a vue-cli project first?`) + } +} + module.exports = { list, add, remove, - findOne + findOne, + getUrl, + serve } diff --git a/packages/@vue/cli-ui/src/graphql-api/resolvers.js b/packages/@vue/cli-ui/src/graphql-api/resolvers.js index d02197c396..73d3e7c073 100644 --- a/packages/@vue/cli-ui/src/graphql-api/resolvers.js +++ b/packages/@vue/cli-ui/src/graphql-api/resolvers.js @@ -23,6 +23,16 @@ process.env.VUE_CLI_API_MODE = true const resolvers = [{ JSON: GraphQLJSON, + DescribedEntity: { + __resolveType (obj, context, info) { + return null + } + }, + + ClientAddon: { + url: (addon, args, context) => clientAddons.getUrl(addon, context) + }, + Query: { cwd: () => cwd.get(), progress: (root, { id }, context) => progress.get(id, context), diff --git a/packages/@vue/cli-ui/src/graphql-api/server.js b/packages/@vue/cli-ui/src/graphql-api/server.js new file mode 100644 index 0000000000..873d4a51fa --- /dev/null +++ b/packages/@vue/cli-ui/src/graphql-api/server.js @@ -0,0 +1,13 @@ +const path = require('path') +const express = require('express') +const fallback = require('express-history-api-fallback') + +const clientAddons = require('./connectors/client-addons') + +const distPath = path.resolve(__dirname, '../../dist') + +module.exports = app => { + app.use(express.static(distPath)) + app.use('/_addon/:id/*', clientAddons.serve) + app.use(fallback(path.join(distPath, 'index.html'))) +} diff --git a/packages/@vue/cli-ui/src/style/main.styl b/packages/@vue/cli-ui/src/style/main.styl index c2b45a4157..0f94eab4b2 100644 --- a/packages/@vue/cli-ui/src/style/main.styl +++ b/packages/@vue/cli-ui/src/style/main.styl @@ -17,7 +17,7 @@ h2 .actions-bar padding $padding-item - background $color-background-light + background $md-white h-box() box-center() position relative diff --git a/packages/@vue/cli-ui/src/views/ProjectTaskDetails.vue b/packages/@vue/cli-ui/src/views/ProjectTaskDetails.vue index 3290a9464e..fb231dfae7 100644 --- a/packages/@vue/cli-ui/src/views/ProjectTaskDetails.vue +++ b/packages/@vue/cli-ui/src/views/ProjectTaskDetails.vue @@ -53,6 +53,7 @@ ', 'Port used for the UI server (by default search for awailable port)') + .description('start and open the vue-cli ui') + .action((cmd) => { + require('../lib/ui')(cleanArgs(cmd)) + }) + program .command('init