From 4c96bea12c92453d3a6e71c3cfacecd9dd583c05 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Thu, 28 Jun 2018 22:53:46 +0200 Subject: [PATCH 0001/2120] fix(ui): task arg deduplication with = --- packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js b/packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js index f053e2c01d..0feeceec8b 100644 --- a/packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js +++ b/packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js @@ -225,9 +225,9 @@ async function run (id, context) { // Process command containing args if (command.indexOf(' ')) { - const parts = command.split(' ') + const parts = command.split(/\s+|=/) command = parts.shift() - args = [...parts, ...args] + args = parts } // Output colors From 14f23920ee59e0bf7b0046bc2014e804bac5a914 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Thu, 28 Jun 2018 23:05:51 +0200 Subject: [PATCH 0002/2120] fix(ui): (dev) task: reset NODE_ENV --- packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js b/packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js index 0feeceec8b..856fab45c4 100644 --- a/packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js +++ b/packages/@vue/cli-ui/src/graphql-api/connectors/tasks.js @@ -292,11 +292,18 @@ async function run (id, context) { process.env.VUE_CLI_CONTEXT = cwd.get() + const nodeEnv = process.env.NODE_ENV + delete process.env.NODE_ENV + const child = execa(command, args, { cwd: cwd.get(), stdio: ['inherit', 'pipe', 'pipe'] }) + if (typeof nodeEnv !== 'undefined') { + process.env.NODE_ENV = nodeEnv + } + task.child = child const outPipe = logPipe(queue => { From e2a7063c9f753ce51487394e2e12d37b6a8d0b2e Mon Sep 17 00:00:00 2001 From: "Adrian B. Danieli" Date: Thu, 28 Jun 2018 15:35:10 -0700 Subject: [PATCH 0003/2120] fix(modern): send credentials when loading script modules. (#1695) * Send credentials when loading script modules. Otherwise, things like BasicAuth won't work. * fix: updated modern mode tests. * fix: updated crossorigin comment. * fix: typo --- .../@vue/cli-service/__tests__/modernMode.spec.js | 12 ++++++------ .../@vue/cli-service/lib/webpack/ModernModePlugin.js | 9 ++++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/@vue/cli-service/__tests__/modernMode.spec.js b/packages/@vue/cli-service/__tests__/modernMode.spec.js index c402e63320..9b4f3207a6 100644 --- a/packages/@vue/cli-service/__tests__/modernMode.spec.js +++ b/packages/@vue/cli-service/__tests__/modernMode.spec.js @@ -25,13 +25,13 @@ test('modern mode', async () => { // assert correct asset links const index = await project.read('dist/index.html') - // should use @@ -87,6 +130,12 @@ export default { &:first-letter text-transform uppercase + .progress-wrapper + width 178px + height @width + position relative + + .progress-bar-wrapper, .progress, .status-icon h-box() @@ -96,12 +145,36 @@ export default { top 0 left 0 width 100% - height 178px + height @width + + .progress-bar + &.disable-animation + >>> path + transition none + &.mode-build-modern + >>> .progress + stroke $vue-ui-color-info - .progress - color lighten($vue-ui-color-dark, 60%) - font-weight lighter - font-size 42px + .progress-animation + display grid + $size = 12px + grid-template-columns repeat(2, $size) + grid-template-rows repeat(2, $size) + grid-template-areas "z1 z4" "z2 z3" + grid-gap 12px + .animation + width 100% + height @width + border-radius 50% + background rgba(black, .1) + transition background .15s + for n in (1..4) + &:nth-child({n}) + grid-area 'z%s' % n + &.active + .animation + background $vue-ui-color-primary + animation progress 1s infinite .status-icon .wrapper @@ -161,4 +234,25 @@ export default { opacity 0 &.v-leave-to opacity 0 + + &.mode-build-modern + .progress-animation.active + .animation + background $vue-ui-color-info + + .status-icon + &.done + .wrapper::before + background $vue-ui-color-info + >>> svg + fill $vue-ui-color-info + +@keyframes progress + 0%, + 30% + transform none + 50% + transform scale(1.5) + 80% + transform none diff --git a/packages/@vue/cli-ui-addon-webpack/src/components/WebpackAnalyzer.vue b/packages/@vue/cli-ui-addon-webpack/src/components/WebpackAnalyzer.vue index 83db368602..a0ddab5af0 100644 --- a/packages/@vue/cli-ui-addon-webpack/src/components/WebpackAnalyzer.vue +++ b/packages/@vue/cli-ui-addon-webpack/src/components/WebpackAnalyzer.vue @@ -5,7 +5,7 @@
{{ $t('org.vue.vue-webpack.analyzer.title') }}
{{ $t('org.vue.vue-webpack.modern-mode') }} diff --git a/packages/@vue/cli-ui-addon-webpack/src/components/WebpackDashboard.vue b/packages/@vue/cli-ui-addon-webpack/src/components/WebpackDashboard.vue index 13f9a5cef4..b6eca9f1c1 100644 --- a/packages/@vue/cli-ui-addon-webpack/src/components/WebpackDashboard.vue +++ b/packages/@vue/cli-ui-addon-webpack/src/components/WebpackDashboard.vue @@ -21,7 +21,7 @@ {{ $t('org.vue.vue-webpack.modern-mode') }} diff --git a/packages/@vue/cli-ui/ui-defaults/tasks.js b/packages/@vue/cli-ui/ui-defaults/tasks.js index 8d3ffe1058..3ebff9deaf 100644 --- a/packages/@vue/cli-ui/ui-defaults/tasks.js +++ b/packages/@vue/cli-ui/ui-defaults/tasks.js @@ -6,38 +6,57 @@ module.exports = api => { let firstRun = true let hadFailed = false - let modernMode = false + // Specific to each modes (serve, build, ...) const fields = { status: null, - progress: 0, + progress: {}, operations: null, stats: null, sizes: null, problems: null, url: null } + + // Common fields for all mode + const commonFields = { + 'modern-mode': false + } + + // Called when opening a project function setupSharedData (mode) { resetSharedData(mode) for (const field in fields) { const id = `${mode}-${field}` - watchSharedData(id, (value) => { - const project = api.getProject() - if (project) { - setSharedData(`${project.id}-${id}`, value) - } - }) + watchData(id) + } + } + + // Called when opening a project + function setupCommonData () { + for (const field in commonFields) { + setSharedData(field, getSharedDataInitialValue(field, commonFields[field])) + watchData(field) } } function resetSharedData (mode, clear = false) { for (const field in fields) { const id = `${mode}-${field}` - setSharedData(id, getSharedDataInitialValue(id, field, clear)) + setSharedData(id, getSharedDataInitialValue(id, fields[field], clear)) } } - function getSharedDataInitialValue (id, field, clear) { + function watchData (id) { + watchSharedData(id, (value) => { + const project = api.getProject() + if (project) { + setSharedData(`${project.id}-${id}`, value) + } + }) + } + + function getSharedDataInitialValue (id, defaultValue, clear) { if (!clear) { const project = api.getProject() if (project) { @@ -45,29 +64,50 @@ module.exports = api => { if (data != null) return data.value } } - return fields[field] + return defaultValue } async function onWebpackMessage ({ data: message }) { if (message.webpackDashboardData) { + const modernMode = getSharedData('modern-mode').value const type = message.webpackDashboardData.type + for (const data of message.webpackDashboardData.value) { + const id = `${type}-${data.type}` + if (data.type === 'stats') { // Stats are read from a file const statsFile = path.resolve(process.cwd(), `./node_modules/.stats-${type}.json`) const value = await fs.readJson(statsFile) - setSharedData(`${type}-${data.type}`, value) + setSharedData(id, value) await fs.remove(statsFile) - } else if (type.indexOf('build') !== -1 && modernMode && data.type === 'progress') { - // Progress is shared between 'build' and 'build-modern' - // 'build' first and then 'build-modern' - const value = type === 'build' ? data.value / 2 : (data.value + 1) / 2 - // We display the same progress bar for both - for (const t of ['build', 'build-modern']) { - setSharedData(`${t}-${data.type}`, value) + } else if (data.type === 'progress') { + if (type === 'serve' || !modernMode) { + setSharedData(id, { + [type]: data.value + }) + } else { + // Display two progress bars + const progress = getSharedData(id).value + progress[type] = data.value + for (const t of ['build', 'build-modern']) { + setSharedData(`${t}-${data.type}`, { + build: progress.build || 0, + 'build-modern': progress['build-modern'] || 0 + }) + } } } else { - setSharedData(`${type}-${data.type}`, data.value) + // Don't display success until both build and build-modern are done + if (type !== 'serve' && modernMode && data.type === 'status' && data.value === 'Success') { + if (type === 'build-modern') { + for (const t of ['build', 'build-modern']) { + setSharedData(`${t}-status`, data.value) + } + } + } else { + setSharedData(id, data.value) + } // Notifications if (type === 'serve' && data.type === 'status') { @@ -106,6 +146,7 @@ module.exports = api => { for (const key of ['serve', 'build', 'build-modern']) { setupSharedData(key) } + setupCommonData() }) // Tasks @@ -285,7 +326,7 @@ module.exports = api => { if (answers.name) args.push('--port', answers.name) if (answers.watch) args.push('--watch') if (answers.modern) args.push('--modern') - setSharedData('modern-mode', modernMode = !!answers.modern) + setSharedData('modern-mode', !!answers.modern) args.push('--dashboard') // Data @@ -341,11 +382,19 @@ module.exports = api => { } }) - // Webpack dashboard - api.addClientAddon({ - id: 'org.vue.webpack.client-addon', - path: '@vue/cli-ui-addon-webpack/dist' - }) + if (process.env.VUE_APP_CLI_UI_DEV) { + // Add dynamic components in dev mode (webpack dashboard & analyzer) + api.addClientAddon({ + id: 'org.vue.webpack.client-addon.dev', + url: 'http://localhost:8096/index.js' + }) + } else { + // Webpack dashboard + api.addClientAddon({ + id: 'org.vue.webpack.client-addon', + path: '@vue/cli-ui-addon-webpack/dist' + }) + } // Open app button api.ipcOn(({ data }) => { diff --git a/packages/@vue/cli-ui/vue-cli-ui.js b/packages/@vue/cli-ui/vue-cli-ui.js index 19ab022a7f..90f07dd694 100644 --- a/packages/@vue/cli-ui/vue-cli-ui.js +++ b/packages/@vue/cli-ui/vue-cli-ui.js @@ -5,12 +5,6 @@ module.exports = api => { console.log('has(eslint)', api.hasPlugin('eslint')) console.log('has(typescript)', api.hasPlugin('typescript')) - // Add dynamic components in dev mode (webpack dashboard & analyzer) - api.addClientAddon({ - id: 'org.vue.webpack.client-addon.dev', - url: 'http://localhost:8096/index.js' - }) - // Add a test page below 'plugins', 'configurations' and 'tasks' on the left sidebar api.addView({ id: 'org.vue.webpack.views.test', From 5e66974ca870e927228f3e79075b88a9b76c0b45 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sun, 1 Jul 2018 13:00:40 +0200 Subject: [PATCH 0011/2120] chore(ui): update to latest @vue/ui --- packages/@vue/cli-ui/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/@vue/cli-ui/package.json b/packages/@vue/cli-ui/package.json index 39c768d95d..ba0f94eacf 100644 --- a/packages/@vue/cli-ui/package.json +++ b/packages/@vue/cli-ui/package.json @@ -60,7 +60,7 @@ "@vue/cli-plugin-eslint": "^3.0.0-rc.3", "@vue/cli-service": "^3.0.0-rc.3", "@vue/eslint-config-standard": "^3.0.0-rc.3", - "@vue/ui": "^0.4.0", + "@vue/ui": "^0.4.3", "ansi_up": "^2.0.2", "cross-env": "^5.1.5", "eslint": "^4.16.0", diff --git a/yarn.lock b/yarn.lock index c360873625..3db6b6dad6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1048,9 +1048,9 @@ dependencies: lodash "^4.17.4" -"@vue/ui@^0.4.0": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@vue/ui/-/ui-0.4.2.tgz#c538a1062147f60cdf6e30bc7c4f9eeab3a54fee" +"@vue/ui@^0.4.3": + version "0.4.3" + resolved "https://registry.yarnpkg.com/@vue/ui/-/ui-0.4.3.tgz#91a0d2fa3c3088b70e4304ad6cfceeeef9b7825d" dependencies: focus-visible "^4.1.4" material-design-icons "^3.0.1" @@ -1647,7 +1647,7 @@ apollo-upload-server@^5.0.0: busboy "^0.2.14" object-path "^0.11.4" -apollo-utilities@^1.0.0, apollo-utilities@^1.0.1, apollo-utilities@^1.0.14, apollo-utilities@^1.0.8, apollo-utilities@^1.0.16: +apollo-utilities@^1.0.0, apollo-utilities@^1.0.1, apollo-utilities@^1.0.14, apollo-utilities@^1.0.16, apollo-utilities@^1.0.8: version "1.0.16" resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.16.tgz#787310df4c3900a68c0beb3d351c59725a588cdb" dependencies: From c4f3358548421ec770f6ecd5ac70af9d3fcfa20c Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sun, 1 Jul 2018 15:06:49 +0200 Subject: [PATCH 0012/2120] feat(ui): tasks overview in projects --- .../cli-ui/apollo-server/connectors/tasks.js | 51 +++--- .../cli-ui/apollo-server/schema/project.js | 5 +- .../@vue/cli-ui/apollo-server/schema/task.js | 2 +- packages/@vue/cli-ui/locales/en.json | 6 + .../@vue/cli-ui/src/components/LoggerView.vue | 15 +- .../src/components/ProjectSelectList.vue | 9 +- .../src/components/ProjectSelectListItem.vue | 19 ++- .../src/components/ProjectTasksDropdown.vue | 155 ++++++++++++++++++ .../@vue/cli-ui/src/components/TaskItem.vue | 2 + packages/@vue/cli-ui/src/graphql/projects.gql | 5 + 10 files changed, 228 insertions(+), 41 deletions(-) create mode 100644 packages/@vue/cli-ui/src/components/ProjectTasksDropdown.vue diff --git a/packages/@vue/cli-ui/apollo-server/connectors/tasks.js b/packages/@vue/cli-ui/apollo-server/connectors/tasks.js index 9cf97ca942..9b1bcbe9d3 100644 --- a/packages/@vue/cli-ui/apollo-server/connectors/tasks.js +++ b/packages/@vue/cli-ui/apollo-server/connectors/tasks.js @@ -19,8 +19,8 @@ const VIEW_ID = 'vue-project-tasks' const tasks = new Map() -function getTasks () { - const file = cwd.get() +function getTasks (file = null) { + if (!file) file = cwd.get() let list = tasks.get(file) if (!list) { list = [] @@ -29,20 +29,20 @@ function getTasks () { return list } -function list (context) { - let list = getTasks() - const file = cwd.get() +function list ({ file = null, api = true } = {}, context) { + if (!file) file = cwd.get() + let list = getTasks(file) const pkg = folders.readPackage(file, context) if (pkg.scripts) { const existing = new Map() // Get current valid tasks in project `package.json` - const currentTasks = Object.keys(pkg.scripts).map( + let currentTasks = Object.keys(pkg.scripts).map( name => { const id = `${file}:${name}` existing.set(id, true) const command = pkg.scripts[name] - const moreData = plugins.getApi().getDescribedTask(command) + const moreData = api ? plugins.getApi().getDescribedTask(command) : null return { id, name, @@ -53,20 +53,24 @@ function list (context) { ...moreData } } - ).concat(plugins.getApi().addedTasks.map( - task => { - const id = `${file}:${task.name}` - existing.set(id, true) - return { - id, - index: list.findIndex(t => t.id === id), - prompts: [], - views: [], - uiOnly: true, - ...task + ) + + if (api) { + currentTasks = currentTasks.concat(plugins.getApi().addedTasks.map( + task => { + const id = `${file}:${task.name}` + existing.set(id, true) + return { + id, + index: list.findIndex(t => t.id === id), + prompts: [], + views: [], + uiOnly: true, + ...task + } } - } - )) + )) + } // Process existing tasks const existingTasks = currentTasks.filter( @@ -113,9 +117,10 @@ function list (context) { } function findOne (id, context) { - return getTasks().find( - t => t.id === id - ) + for (const [, list] of tasks) { + const result = list.find(t => t.id === id) + if (result) return result + } } function getSavedData (id, context) { diff --git a/packages/@vue/cli-ui/apollo-server/schema/project.js b/packages/@vue/cli-ui/apollo-server/schema/project.js index 1322b1dc19..fd579c1cba 100644 --- a/packages/@vue/cli-ui/apollo-server/schema/project.js +++ b/packages/@vue/cli-ui/apollo-server/schema/project.js @@ -2,6 +2,7 @@ const gql = require('graphql-tag') // Connectors const projects = require('../connectors/projects') const plugins = require('../connectors/plugins') +const tasks = require('../connectors/tasks') exports.types = gql` extend type Query { @@ -29,6 +30,7 @@ type Project { path: String! favorite: Int plugins: [Plugin] + tasks: [Task] } input ProjectCreateInput { @@ -72,7 +74,8 @@ type Feature implements DescribedEntity { exports.resolvers = { Project: { - plugins: (project, args, context) => plugins.list(project.path, context) + plugins: (project, args, context) => plugins.list(project.path, context), + tasks: (project, args, context) => tasks.list({ file: project.path, api: false }, context) }, Query: { diff --git a/packages/@vue/cli-ui/apollo-server/schema/task.js b/packages/@vue/cli-ui/apollo-server/schema/task.js index d6a29d9fc6..009d6765c6 100644 --- a/packages/@vue/cli-ui/apollo-server/schema/task.js +++ b/packages/@vue/cli-ui/apollo-server/schema/task.js @@ -73,7 +73,7 @@ exports.resolvers = { }, Query: { - tasks: (root, args, context) => tasks.list(context), + tasks: (root, args, context) => tasks.list(undefined, context), task: (root, { id }, context) => tasks.findOne(id, context) }, diff --git a/packages/@vue/cli-ui/locales/en.json b/packages/@vue/cli-ui/locales/en.json index 93a7e9f797..a7ee2d589c 100644 --- a/packages/@vue/cli-ui/locales/en.json +++ b/packages/@vue/cli-ui/locales/en.json @@ -105,6 +105,12 @@ "update": "Update {target}" } }, + "project-tasks-dropdown": { + "tooltips": { + "tasks": "Tasks", + "running-tasks": "{count} running task(s)" + } + }, "prompt-list": { "default": "Default" }, diff --git a/packages/@vue/cli-ui/src/components/LoggerView.vue b/packages/@vue/cli-ui/src/components/LoggerView.vue index ade72dc1ec..1933833c22 100644 --- a/packages/@vue/cli-ui/src/components/LoggerView.vue +++ b/packages/@vue/cli-ui/src/components/LoggerView.vue @@ -1,6 +1,6 @@ - - -
- - - -
- -
- -
-
@@ -378,4 +380,12 @@ export default { .description color $color-text-light margin-left $padding-item + +.task-settings + padding $padding-item + box-sizing border-box + width 700px + .prompts + max-height 500px + overflow-y auto From 162ab69f72dfdbc4459f3a175efd4ec303117c01 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sun, 1 Jul 2018 16:27:53 +0200 Subject: [PATCH 0017/2120] fix(ui): build progress bar glitch --- .../@vue/cli-ui-addon-webpack/src/components/BuildProgress.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@vue/cli-ui-addon-webpack/src/components/BuildProgress.vue b/packages/@vue/cli-ui-addon-webpack/src/components/BuildProgress.vue index 7a12c95326..bc7a105ccd 100644 --- a/packages/@vue/cli-ui-addon-webpack/src/components/BuildProgress.vue +++ b/packages/@vue/cli-ui-addon-webpack/src/components/BuildProgress.vue @@ -96,7 +96,7 @@ export default { progress () { const raw = this.rawProgress - return raw && Object.keys(raw).length ? raw : { unknown: 0 } + return raw && Object.keys(raw).length ? raw : { [this.mode]: 0 } } } } From 2eabc1494bc46e6b71e5fbb88ab925836e4571a6 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 1 Jul 2018 10:31:05 -0400 Subject: [PATCH 0018/2120] chore: add bit sponsor placement --- docs/.vuepress/components/Bit.vue | 25 +++++++++++++++++++++++++ docs/config/README.md | 2 ++ docs/guide/README.md | 2 ++ 3 files changed, 29 insertions(+) create mode 100644 docs/.vuepress/components/Bit.vue diff --git a/docs/.vuepress/components/Bit.vue b/docs/.vuepress/components/Bit.vue new file mode 100644 index 0000000000..51d4048aba --- /dev/null +++ b/docs/.vuepress/components/Bit.vue @@ -0,0 +1,25 @@ + + + diff --git a/docs/config/README.md b/docs/config/README.md index ad48a2f208..60d09f2ca7 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -4,6 +4,8 @@ sidebar: auto # Configuration Reference + + ## Global CLI Config Some global configurations for `@vue/cli`, such as your preferred package manager and your locally saved presets, are stored in a JSON file named `.vuerc` in your home directory. You can edit this file directory with your editor of choice to change the saved options. diff --git a/docs/guide/README.md b/docs/guide/README.md index ebff520f7c..736ca049de 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -4,6 +4,8 @@ sidebarDepth: 0 # Overview + + Vue CLI is a full system for rapid Vue.js development, providing: - Interactive project scaffolding via `@vue/cli`. From 056b2acd6a342f1094c0b98057fbc55e2795b8c7 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sun, 1 Jul 2018 16:32:39 +0200 Subject: [PATCH 0019/2120] chore(ui): upgrade @vue/ui --- packages/@vue/cli-ui/package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/@vue/cli-ui/package.json b/packages/@vue/cli-ui/package.json index ba0f94eacf..14727a6343 100644 --- a/packages/@vue/cli-ui/package.json +++ b/packages/@vue/cli-ui/package.json @@ -60,7 +60,7 @@ "@vue/cli-plugin-eslint": "^3.0.0-rc.3", "@vue/cli-service": "^3.0.0-rc.3", "@vue/eslint-config-standard": "^3.0.0-rc.3", - "@vue/ui": "^0.4.3", + "@vue/ui": "^0.4.4", "ansi_up": "^2.0.2", "cross-env": "^5.1.5", "eslint": "^4.16.0", diff --git a/yarn.lock b/yarn.lock index 3db6b6dad6..afd9f084c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1048,9 +1048,9 @@ dependencies: lodash "^4.17.4" -"@vue/ui@^0.4.3": - version "0.4.3" - resolved "https://registry.yarnpkg.com/@vue/ui/-/ui-0.4.3.tgz#91a0d2fa3c3088b70e4304ad6cfceeeef9b7825d" +"@vue/ui@^0.4.4": + version "0.4.4" + resolved "https://registry.yarnpkg.com/@vue/ui/-/ui-0.4.4.tgz#47c843f6b1da21e3f919c7668f9e3a49c27bcd80" dependencies: focus-visible "^4.1.4" material-design-icons "^3.0.1" From bf9d30bde0f352530512c5475beafda6ff8c9eb7 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sun, 1 Jul 2018 18:09:23 +0200 Subject: [PATCH 0020/2120] feat(ui): import non- vue-cli projects --- .../apollo-server/connectors/plugins.js | 28 ++++++++++-------- .../apollo-server/connectors/projects.js | 10 +++++-- .../cli-ui/apollo-server/connectors/views.js | 3 +- .../cli-ui/apollo-server/schema/project.js | 7 +++++ .../@vue/cli-ui/apollo-server/schema/view.js | 1 + .../@vue/cli-ui/src/components/ProjectNav.vue | 29 +++++++++++++++++++ .../cli-ui/src/graphql/projectFragment.gql | 1 + .../@vue/cli-ui/src/graphql/viewFragment.gql | 1 + .../@vue/cli-ui/src/views/ProjectPlugins.vue | 8 ++++- .../@vue/cli-ui/src/views/ProjectSelect.vue | 2 +- 10 files changed, 73 insertions(+), 17 deletions(-) diff --git a/packages/@vue/cli-ui/apollo-server/connectors/plugins.js b/packages/@vue/cli-ui/apollo-server/connectors/plugins.js index bcfb014de3..a98b6a2221 100644 --- a/packages/@vue/cli-ui/apollo-server/connectors/plugins.js +++ b/packages/@vue/cli-ui/apollo-server/connectors/plugins.js @@ -105,21 +105,25 @@ function resetPluginApi (context) { clientAddons.clear(context) suggestions.clear(context) - pluginApi = new PluginApi({ - plugins - }, context) - // Run Plugin API - runPluginApi(path.resolve(__dirname, '../../'), context, 'ui-defaults') - plugins.forEach(plugin => runPluginApi(plugin.id, context)) - runPluginApi(cwd.get(), context, 'vue-cli-ui') - // Add client addons - pluginApi.clientAddons.forEach(options => clientAddons.add(options, context)) - // Add views - pluginApi.views.forEach(view => views.add(view, context)) - setTimeout(() => { const projects = require('./projects') const project = projects.getCurrent(context) + + pluginApi = new PluginApi({ + plugins + }, context) + + if (projects.getType(project) !== 'vue') return + + // Run Plugin API + runPluginApi(path.resolve(__dirname, '../../'), context, 'ui-defaults') + plugins.forEach(plugin => runPluginApi(plugin.id, context)) + runPluginApi(cwd.get(), context, 'vue-cli-ui') + // Add client addons + pluginApi.clientAddons.forEach(options => clientAddons.add(options, context)) + // Add views + pluginApi.views.forEach(view => views.add(view, context)) + if (!project) return projectId = project.id pluginApi.project = project diff --git a/packages/@vue/cli-ui/apollo-server/connectors/projects.js b/packages/@vue/cli-ui/apollo-server/connectors/projects.js index 449caee15b..550834e783 100644 --- a/packages/@vue/cli-ui/apollo-server/connectors/projects.js +++ b/packages/@vue/cli-ui/apollo-server/connectors/projects.js @@ -342,7 +342,8 @@ async function importProject (input, context) { const project = { id: shortId.generate(), path: input.path, - favorite: 0 + favorite: 0, + type: folders.isVueProject(input.path) ? 'vue' : 'unknown' } const packageData = folders.readPackage(project.path, context) project.name = packageData.name @@ -407,6 +408,10 @@ function setFavorite ({ id, favorite }, context) { return findOne(id, context) } +function getType (project) { + return !project.type ? 'vue' : project.type +} + // Open last project async function autoOpenLastProject () { const context = getContext() @@ -436,5 +441,6 @@ module.exports = { resetCwd, setFavorite, initCreator, - removeCreator + removeCreator, + getType } diff --git a/packages/@vue/cli-ui/apollo-server/connectors/views.js b/packages/@vue/cli-ui/apollo-server/connectors/views.js index 849853ffdc..fcc93f0dcb 100644 --- a/packages/@vue/cli-ui/apollo-server/connectors/views.js +++ b/packages/@vue/cli-ui/apollo-server/connectors/views.js @@ -24,7 +24,8 @@ function createViewsSet () { id: 'vue-project-tasks', name: 'project-tasks', icon: 'assignment', - tooltip: 'org.vue.components.project-nav.tooltips.tasks' + tooltip: 'org.vue.components.project-nav.tooltips.tasks', + projectTypes: ['vue', 'unknown'] } ] } diff --git a/packages/@vue/cli-ui/apollo-server/schema/project.js b/packages/@vue/cli-ui/apollo-server/schema/project.js index fd579c1cba..7588f26834 100644 --- a/packages/@vue/cli-ui/apollo-server/schema/project.js +++ b/packages/@vue/cli-ui/apollo-server/schema/project.js @@ -27,12 +27,18 @@ extend type Mutation { type Project { id: ID! name: String! + type: ProjectType path: String! favorite: Int plugins: [Plugin] tasks: [Task] } +enum ProjectType { + vue + unknown +} + input ProjectCreateInput { folder: String! force: Boolean! @@ -74,6 +80,7 @@ type Feature implements DescribedEntity { exports.resolvers = { Project: { + type: (project, args, context) => projects.getType(project), plugins: (project, args, context) => plugins.list(project.path, context), tasks: (project, args, context) => tasks.list({ file: project.path, api: false }, context) }, diff --git a/packages/@vue/cli-ui/apollo-server/schema/view.js b/packages/@vue/cli-ui/apollo-server/schema/view.js index 848ab15915..de4ed1541b 100644 --- a/packages/@vue/cli-ui/apollo-server/schema/view.js +++ b/packages/@vue/cli-ui/apollo-server/schema/view.js @@ -25,6 +25,7 @@ type View { icon: String! tooltip: String badges: [ViewBadge] + projectTypes: [ProjectType] } type ViewBadge { diff --git a/packages/@vue/cli-ui/src/components/ProjectNav.vue b/packages/@vue/cli-ui/src/components/ProjectNav.vue index 398e3e6a78..b5dc9a8404 100644 --- a/packages/@vue/cli-ui/src/components/ProjectNav.vue +++ b/packages/@vue/cli-ui/src/components/ProjectNav.vue @@ -13,6 +13,7 @@ > @@ -26,6 +27,7 @@ diff --git a/packages/@vue/cli-ui/src/components/TopBar.vue b/packages/@vue/cli-ui/src/components/TopBar.vue index 32fc65b16c..6131402051 100644 --- a/packages/@vue/cli-ui/src/components/TopBar.vue +++ b/packages/@vue/cli-ui/src/components/TopBar.vue @@ -17,6 +17,12 @@ {{ $t('org.vue.components.project-select-list-item.tooltips.favorite') }}
+ + Date: Mon, 2 Jul 2018 00:46:30 +0200 Subject: [PATCH 0029/2120] fix(ui): dropdown separator color --- packages/@vue/cli-ui/src/style/main.styl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/@vue/cli-ui/src/style/main.styl b/packages/@vue/cli-ui/src/style/main.styl index 177a0a41c7..fa406382f4 100644 --- a/packages/@vue/cli-ui/src/style/main.styl +++ b/packages/@vue/cli-ui/src/style/main.styl @@ -150,8 +150,10 @@ ansi-colors('white', $vue-ui-color-light) .dropdown-separator height 1px - background rgba($vue-ui-color-dark, .1) margin ($padding-item / 2) 0 + background rgba($vue-ui-color-dark, .05) + .vue-ui-dark-mode & + background rgba($vue-ui-color-dark-neutral, .2) .vue-ui-modal &.anchor From 81e51842efb7c56bc49585dea2bc09f3b2caf5a1 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Mon, 2 Jul 2018 01:39:01 +0200 Subject: [PATCH 0030/2120] feat(ui): tasks dropdown: open task details --- .../src/components/ProjectTasksDropdown.vue | 50 ++++++++++++++++--- packages/@vue/cli-ui/src/graphql/projects.gql | 3 ++ .../@vue/cli-ui/src/mixins/RestoreRoute.js | 15 ++++-- packages/@vue/cli-ui/src/util/bus.js | 15 ++++-- packages/@vue/cli-ui/src/util/route.js | 8 +-- .../@vue/cli-ui/src/views/ProjectTasks.vue | 10 ++++ 6 files changed, 81 insertions(+), 20 deletions(-) diff --git a/packages/@vue/cli-ui/src/components/ProjectTasksDropdown.vue b/packages/@vue/cli-ui/src/components/ProjectTasksDropdown.vue index 96e042be24..6e3705e59c 100644 --- a/packages/@vue/cli-ui/src/components/ProjectTasksDropdown.vue +++ b/packages/@vue/cli-ui/src/components/ProjectTasksDropdown.vue @@ -30,22 +30,28 @@ v-for="task of tasks" :key="task.id" :task="task" + @click.native="openTask(task)" > + + @@ -55,6 +61,8 @@ import TASK_CHANGED from '../graphql/taskChanged.gql' import TASK_RUN from '../graphql/taskRun.gql' import TASK_STOP from '../graphql/taskStop.gql' +import PROJECT_CURRENT from '../graphql/projectCurrent.gql' +import PROJECT_OPEN from '../graphql/projectOpen.gql' export default { props: { @@ -69,7 +77,15 @@ export default { } }, + data () { + return { + loading: false + } + }, + apollo: { + projectCurrent: PROJECT_CURRENT, + $subscribe: { taskChanged: { query: TASK_CHANGED @@ -99,13 +115,31 @@ export default { }, methods: { - runTask (task) { - this.$apollo.mutate({ - mutation: TASK_RUN, - variables: { - id: task.id - } + async openTask (task, run = false) { + this.loading = true + + if (task.project.id !== this.projectCurrent.id) { + await this.$apollo.mutate({ + mutation: PROJECT_OPEN, + variables: { + id: task.project.id + } + }) + } + + this.$router.push({ + name: 'project-tasks', + query: { id: task.id } }) + + if (run) { + await this.$apollo.mutate({ + mutation: TASK_RUN, + variables: { + id: task.id + } + }) + } }, stopTask (task) { diff --git a/packages/@vue/cli-ui/src/graphql/projects.gql b/packages/@vue/cli-ui/src/graphql/projects.gql index d9636fb8f1..02fbf262ba 100644 --- a/packages/@vue/cli-ui/src/graphql/projects.gql +++ b/packages/@vue/cli-ui/src/graphql/projects.gql @@ -7,6 +7,9 @@ query projects { id name status + project { + id + } } } } diff --git a/packages/@vue/cli-ui/src/mixins/RestoreRoute.js b/packages/@vue/cli-ui/src/mixins/RestoreRoute.js index d9d02aa004..08c37e51de 100644 --- a/packages/@vue/cli-ui/src/mixins/RestoreRoute.js +++ b/packages/@vue/cli-ui/src/mixins/RestoreRoute.js @@ -1,3 +1,4 @@ +import { isSameRoute } from '../util/route' import PROJECT_CURRENT from '../graphql/projectCurrent.gql' @@ -26,12 +27,14 @@ export default function ({ beforeRouteEnter (to, from, next) { if (lastRoute) { - const { name, params, query } = lastRoute - next({ name, params, query }) + if (!to.query) { + const { name, params, query } = lastRoute + next({ name, params, query }) + return + } lastRoute = null - } else { - next() } + next() }, beforeRouteLeave (to, from, next) { @@ -41,7 +44,9 @@ export default function ({ methods: { replaceBaseRoute () { - if (baseRoute) this.$router.replace(baseRoute) + if (baseRoute && !isSameRoute(this.$route, baseRoute, false)) { + this.$router.replace(baseRoute) + } } } } diff --git a/packages/@vue/cli-ui/src/util/bus.js b/packages/@vue/cli-ui/src/util/bus.js index 0fdcdfff8d..380bc05f51 100644 --- a/packages/@vue/cli-ui/src/util/bus.js +++ b/packages/@vue/cli-ui/src/util/bus.js @@ -41,10 +41,19 @@ export default { Vue.config.optionMergeStrategies.bus = (parent, child, vm) => { if (Array.isArray(parent)) { - parent.push(child) - return parent - } else if (parent) { + if (Array.isArray(child)) { + return parent.concat(child) + } else { + parent.push(child) + return parent + } + } else if (Array.isArray(child)) { + child.push(parent) + return child + } else if (parent && child) { return [parent, child] + } else if (parent) { + return parent } return child } diff --git a/packages/@vue/cli-ui/src/util/route.js b/packages/@vue/cli-ui/src/util/route.js index 27b689771f..cd79302f68 100644 --- a/packages/@vue/cli-ui/src/util/route.js +++ b/packages/@vue/cli-ui/src/util/route.js @@ -1,20 +1,20 @@ const trailingSlashRE = /\/?$/ -export function isSameRoute (a, b) { +export function isSameRoute (a, b, checkQuery = true) { if (!b) { return false } else if (a.path && b.path) { return ( a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') && a.hash === b.hash && - isObjectEqual(a.query, b.query) + (!checkQuery || isObjectEqual(a.query, b.query)) ) } else if (a.name && b.name) { return ( a.name === b.name && a.hash === b.hash && - isObjectEqual(a.query, b.query) && - isObjectEqual(a.params, b.params) + isObjectEqual(a.params, b.params) && + (!checkQuery || isObjectEqual(a.query, b.query)) ) } else { return false diff --git a/packages/@vue/cli-ui/src/views/ProjectTasks.vue b/packages/@vue/cli-ui/src/views/ProjectTasks.vue index 7cb3c32ca2..5f806770d2 100644 --- a/packages/@vue/cli-ui/src/views/ProjectTasks.vue +++ b/packages/@vue/cli-ui/src/views/ProjectTasks.vue @@ -6,6 +6,7 @@