diff --git a/packages/@vue/cli-ui/locales/en.json b/packages/@vue/cli-ui/locales/en.json index 32be1ba622..d4aa1b3c20 100644 --- a/packages/@vue/cli-ui/locales/en.json +++ b/packages/@vue/cli-ui/locales/en.json @@ -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": { diff --git a/packages/@vue/cli-ui/src/graphql-api/connectors/projects.js b/packages/@vue/cli-ui/src/graphql-api/connectors/projects.js index e1abc46d07..6654f34a49 100644 --- a/packages/@vue/cli-ui/src/graphql-api/connectors/projects.js +++ b/packages/@vue/cli-ui/src/graphql-api/connectors/projects.js @@ -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) { @@ -306,7 +314,7 @@ async function create (input, context) { }) // Create - await creator.create({ git: true }, preset) + await creator.create(createOptions, preset) removeCreator() notify({ diff --git a/packages/@vue/cli-ui/src/graphql-api/schema/project.js b/packages/@vue/cli-ui/src/graphql-api/schema/project.js index a335d6c876..52dc68314a 100644 --- a/packages/@vue/cli-ui/src/graphql-api/schema/project.js +++ b/packages/@vue/cli-ui/src/graphql-api/schema/project.js @@ -37,6 +37,8 @@ input ProjectCreateInput { remote: Boolean clone: Boolean save: String + enableGit: Boolean! + gitCommitMessage: String } input ProjectImportInput { diff --git a/packages/@vue/cli-ui/src/views/ProjectCreate.vue b/packages/@vue/cli-ui/src/views/ProjectCreate.vue index 91c472dfe0..c3fb1303f7 100644 --- a/packages/@vue/cli-ui/src/views/ProjectCreate.vue +++ b/packages/@vue/cli-ui/src/views/ProjectCreate.vue @@ -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') }} + + + + {{ $t('views.project-create.tabs.details.form.options.git') }} + + + @@ -388,6 +402,8 @@ function formDataFactory () { return { folder: '', force: false, + enableGit: true, + gitCommitMessage: '', packageManager: undefined, selectedPreset: null, remotePreset: { @@ -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,