mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-02-07 07:28:28 -06:00
feat(ui): Reset CWD to project path
This commit is contained in:
@@ -107,6 +107,7 @@ import FOLDERS_FAVORITE from '../graphql/foldersFavorite.gql'
|
||||
import FOLDER_OPEN from '../graphql/folderOpen.gql'
|
||||
import FOLDER_OPEN_PARENT from '../graphql/folderOpenParent.gql'
|
||||
import FOLDER_SET_FAVORITE from '../graphql/folderSetFavorite.gql'
|
||||
import PROJECT_CWD_RESET from '../graphql/projectCwdReset.gql'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -132,6 +133,10 @@ export default {
|
||||
foldersFavorite: FOLDERS_FAVORITE
|
||||
},
|
||||
|
||||
beforeDestroy () {
|
||||
this.resetProjectCwd()
|
||||
},
|
||||
|
||||
methods: {
|
||||
async openFolder (path) {
|
||||
this.editingPath = false
|
||||
@@ -209,6 +214,12 @@ export default {
|
||||
|
||||
refreshFolder () {
|
||||
this.openFolder(this.folderCurrent.path)
|
||||
},
|
||||
|
||||
resetProjectCwd () {
|
||||
this.$apollo.mutate({
|
||||
mutation: PROJECT_CWD_RESET
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,6 +322,12 @@ async function getPlugins (id, context) {
|
||||
return []
|
||||
}
|
||||
|
||||
function resetCwd (context) {
|
||||
if (currentProject) {
|
||||
cwd.set(currentProject.path, context)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
list,
|
||||
getCurrent,
|
||||
@@ -333,5 +339,6 @@ module.exports = {
|
||||
import: importProject,
|
||||
open,
|
||||
remove,
|
||||
getPlugins
|
||||
getPlugins,
|
||||
resetCwd
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ module.exports = {
|
||||
projectCreate: (root, { input }, context) => projects.create(input, context),
|
||||
projectImport: (root, { input }, context) => projects.import(input, context),
|
||||
projectOpen: (root, { id }, context) => projects.open(id, context),
|
||||
projectRemove: (root, { id }, context) => projects.remove(id, context)
|
||||
projectRemove: (root, { id }, context) => projects.remove(id, context),
|
||||
projectCwdReset: (root, args, context) => projects.resetCwd(context)
|
||||
},
|
||||
|
||||
Subscription: {
|
||||
|
||||
@@ -172,6 +172,7 @@ type Mutation {
|
||||
projectOpen (id: ID!): Project!
|
||||
projectSetFavorite (id: ID!, favorite: Int!): Project!
|
||||
projectRemove (id: ID!): Boolean!
|
||||
projectCwdReset: String
|
||||
presetApply (id: ID!): ProjectCreation
|
||||
featureSetEnabled (id: ID!, enabled: Boolean): Feature
|
||||
pluginAdd (id: ID!): Plugin
|
||||
|
||||
3
packages/@vue/cli-ui/src/graphql/projectCwdReset.gql
Normal file
3
packages/@vue/cli-ui/src/graphql/projectCwdReset.gql
Normal file
@@ -0,0 +1,3 @@
|
||||
mutation projectCwdReset {
|
||||
projectCwdReset
|
||||
}
|
||||
Reference in New Issue
Block a user