Skip to content

feat: Allow git commit message through UI #1541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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