diff --git a/packages/create-nuxt-app/lib/prompts.js b/packages/create-nuxt-app/lib/prompts.js index 4232455c4..a7c4829b8 100644 --- a/packages/create-nuxt-app/lib/prompts.js +++ b/packages/create-nuxt-app/lib/prompts.js @@ -112,5 +112,15 @@ module.exports = [ { name: 'Semantic Pull Requests', value: 'semantic-pull-requests' } ], default: [] + }, + { + name: 'vcs', + message: 'Version control system:', + type: 'list', + choices: [ + { name: 'Git', value: 'git' }, + { name: 'None', value: 'none' } + ], + default: 'git' } ] diff --git a/packages/create-nuxt-app/lib/saofile.js b/packages/create-nuxt-app/lib/saofile.js index c899c0dac..61406cc2e 100644 --- a/packages/create-nuxt-app/lib/saofile.js +++ b/packages/create-nuxt-app/lib/saofile.js @@ -125,7 +125,9 @@ module.exports = { return actions }, async completed () { - this.gitInit() + if (this.answers.vcs === 'git') { + this.gitInit() + } await this.npmInstall({ npmClient: this.answers.pm }) diff --git a/packages/create-nuxt-app/test/snapshots/index.test.js.md b/packages/create-nuxt-app/test/snapshots/index.test.js.md index 6792b3995..71bfd9887 100644 --- a/packages/create-nuxt-app/test/snapshots/index.test.js.md +++ b/packages/create-nuxt-app/test/snapshots/index.test.js.md @@ -4202,3 +4202,211 @@ Generated by [AVA](https://avajs.dev). }␊ }␊ ` + +## verify vcs: Git + +> Generated files + + [ + '.editorconfig', + '.gitignore', + 'README.md', + 'assets/README.md', + 'components/Logo.vue', + 'components/README.md', + 'layouts/README.md', + 'layouts/default.vue', + 'middleware/README.md', + 'nuxt.config.js', + 'package.json', + 'pages/README.md', + 'pages/index.vue', + 'plugins/README.md', + 'static/README.md', + 'static/favicon.ico', + 'store/README.md', + ] + +> package.json + + { + dependencies: { + nuxt: '^2.14.0', + }, + devDependencies: {}, + private: true, + scripts: { + build: 'nuxt build', + dev: 'nuxt', + generate: 'nuxt generate', + start: 'nuxt start', + }, + } + +> Generated nuxt.config.js + + `␊ + export default {␊ + /*␊ + ** Nuxt rendering mode␊ + ** See https://nuxtjs.org/api/configuration-mode␊ + */␊ + mode: 'universal',␊ + /*␊ + ** Nuxt target␊ + ** See https://nuxtjs.org/api/configuration-target␊ + */␊ + target: 'server',␊ + /*␊ + ** Headers of the page␊ + ** See https://nuxtjs.org/api/configuration-head␊ + */␊ + head: {␊ + title: process.env.npm_package_name || '',␊ + meta: [␊ + { charset: 'utf-8' },␊ + { name: 'viewport', content: 'width=device-width, initial-scale=1' },␊ + { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }␊ + ],␊ + link: [␊ + { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }␊ + ]␊ + },␊ + /*␊ + ** Global CSS␊ + */␊ + css: [␊ + ],␊ + /*␊ + ** Plugins to load before mounting the App␊ + ** https://nuxtjs.org/guide/plugins␊ + */␊ + plugins: [␊ + ],␊ + /*␊ + ** Auto import components␊ + ** See https://nuxtjs.org/api/configuration-components␊ + */␊ + components: true,␊ + /*␊ + ** Nuxt.js dev-modules␊ + */␊ + buildModules: [␊ + ],␊ + /*␊ + ** Nuxt.js modules␊ + */␊ + modules: [␊ + ],␊ + /*␊ + ** Build configuration␊ + ** See https://nuxtjs.org/api/configuration-build/␊ + */␊ + build: {␊ + }␊ + }␊ + ` + +## verify vcs: None + +> Generated files + + [ + '.editorconfig', + '.gitignore', + 'README.md', + 'assets/README.md', + 'components/Logo.vue', + 'components/README.md', + 'layouts/README.md', + 'layouts/default.vue', + 'middleware/README.md', + 'nuxt.config.js', + 'package.json', + 'pages/README.md', + 'pages/index.vue', + 'plugins/README.md', + 'static/README.md', + 'static/favicon.ico', + 'store/README.md', + ] + +> package.json + + { + dependencies: { + nuxt: '^2.14.0', + }, + devDependencies: {}, + private: true, + scripts: { + build: 'nuxt build', + dev: 'nuxt', + generate: 'nuxt generate', + start: 'nuxt start', + }, + } + +> Generated nuxt.config.js + + `␊ + export default {␊ + /*␊ + ** Nuxt rendering mode␊ + ** See https://nuxtjs.org/api/configuration-mode␊ + */␊ + mode: 'universal',␊ + /*␊ + ** Nuxt target␊ + ** See https://nuxtjs.org/api/configuration-target␊ + */␊ + target: 'server',␊ + /*␊ + ** Headers of the page␊ + ** See https://nuxtjs.org/api/configuration-head␊ + */␊ + head: {␊ + title: process.env.npm_package_name || '',␊ + meta: [␊ + { charset: 'utf-8' },␊ + { name: 'viewport', content: 'width=device-width, initial-scale=1' },␊ + { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }␊ + ],␊ + link: [␊ + { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }␊ + ]␊ + },␊ + /*␊ + ** Global CSS␊ + */␊ + css: [␊ + ],␊ + /*␊ + ** Plugins to load before mounting the App␊ + ** https://nuxtjs.org/guide/plugins␊ + */␊ + plugins: [␊ + ],␊ + /*␊ + ** Auto import components␊ + ** See https://nuxtjs.org/api/configuration-components␊ + */␊ + components: true,␊ + /*␊ + ** Nuxt.js dev-modules␊ + */␊ + buildModules: [␊ + ],␊ + /*␊ + ** Nuxt.js modules␊ + */␊ + modules: [␊ + ],␊ + /*␊ + ** Build configuration␊ + ** See https://nuxtjs.org/api/configuration-build/␊ + */␊ + build: {␊ + }␊ + }␊ + ` diff --git a/packages/create-nuxt-app/test/snapshots/index.test.js.snap b/packages/create-nuxt-app/test/snapshots/index.test.js.snap index 3831b4189..112e0db21 100644 Binary files a/packages/create-nuxt-app/test/snapshots/index.test.js.snap and b/packages/create-nuxt-app/test/snapshots/index.test.js.snap differ