Skip to content

Commit

Permalink
feat(ui): git commit message + disable git (#1541)
Browse files Browse the repository at this point in the history
* feat: Allow git commit message through UI

* refactor: fix git initialization on UI variable naming and behaviour

* fix(ui): condition, text, variable names

* fix(ui): polish
  • Loading branch information
voluntadpear authored and Akryum committed Jun 11, 2018
1 parent 57ff03b commit 29c1ce5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/@vue/cli-ui/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@
},
"options": {
"label": "Additional options",
"description": "Overwrite target folder if it exists"
"force": "Overwrite target folder if it exists",
"git": "Initialize git repository (recommended)",
"git-commit-message": "Initial commit message (optional)"
}
},
"buttons": {
Expand Down
10 changes: 9 additions & 1 deletion packages/@vue/cli-ui/src/graphql-api/connectors/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ async function create (input, context) {
answers.useConfigFiles = 'files'
}

const createOptions = {}
// Git
if (input.enableGit && input.gitCommitMessage) {
createOptions.git = input.gitCommitMessage
} else {
createOptions.git = input.enableGit
}

// Preset
answers.preset = input.preset
if (input.save) {
Expand All @@ -306,7 +314,7 @@ async function create (input, context) {
})

// Create
await creator.create({ git: true }, preset)
await creator.create(createOptions, preset)
removeCreator()

notify({
Expand Down
2 changes: 2 additions & 0 deletions packages/@vue/cli-ui/src/graphql-api/schema/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ input ProjectCreateInput {
remote: Boolean
clone: Boolean
save: String
enableGit: Boolean!
gitCommitMessage: String
}
input ProjectImportInput {
Expand Down
20 changes: 19 additions & 1 deletion packages/@vue/cli-ui/src/views/ProjectCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,23 @@
v-model="formData.force"
class="extend-left force"
>
{{ $t('views.project-create.tabs.details.form.options.description') }}
{{ $t('views.project-create.tabs.details.form.options.force') }}
</VueSwitch>
</VueFormField>

<VueFormField>
<VueSwitch
v-model="formData.enableGit"
class="extend-left git"
>
{{ $t('views.project-create.tabs.details.form.options.git') }}
</VueSwitch>
<VueInput
v-model="formData.gitCommitMessage"
v-show="formData.enableGit"
:placeholder="$t('views.project-create.tabs.details.form.options.git-commit-message')"
/>
</VueFormField>
</div>
</div>

Expand Down Expand Up @@ -388,6 +402,8 @@ function formDataFactory () {
return {
folder: '',
force: false,
enableGit: true,
gitCommitMessage: '',
packageManager: undefined,
selectedPreset: null,
remotePreset: {
Expand Down Expand Up @@ -512,6 +528,8 @@ export default {
input: {
folder: this.formData.folder,
force: this.formData.force,
enableGit: this.formData.enableGit,
gitCommitMessage: this.formData.gitCommitMessage,
packageManager: this.formData.packageManager,
preset: this.formData.selectedPreset,
remote: this.formData.remotePreset.url,
Expand Down

0 comments on commit 29c1ce5

Please sign in to comment.