vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.78k stars 6.33k forks source link

vue create changes .gitignore #6214

Open ZimGil opened 3 years ago

ZimGil commented 3 years ago

Version

4.5.10

Environment info

System:
    OS: Windows 10 10.0.19041
    CPU: (4) x64 Intel(R) Core(TM) i5-6600 CPU @ 3.30GHz
  Binaries:
    Node: 12.19.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.19041.423.0), Chromium (87.0.664.75)
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.2.1
    @vue/babel-helper-vue-transform-on:  1.0.0
    @vue/babel-plugin-jsx:  1.0.1
    @vue/babel-plugin-transform-vue-jsx:  1.2.1
    @vue/babel-preset-app:  4.5.10
    @vue/babel-preset-jsx:  1.2.4
    @vue/babel-sugar-composition-api-inject-h:  1.2.1
    @vue/babel-sugar-composition-api-render-instance:  1.2.4
    @vue/babel-sugar-functional-vue:  1.2.2
    @vue/babel-sugar-inject-h:  1.2.2
    @vue/babel-sugar-v-model:  1.2.3
    @vue/babel-sugar-v-on:  1.2.3
    @vue/cli-overlay:  4.5.10
    @vue/cli-plugin-babel: ~4.5.0 => 4.5.10
    @vue/cli-plugin-eslint: ~4.5.0 => 4.5.10
    @vue/cli-plugin-router:  4.5.10
    @vue/cli-plugin-vuex:  4.5.10
    @vue/cli-service: ~4.5.0 => 4.5.10
    @vue/cli-shared-utils:  4.5.10
    @vue/component-compiler-utils:  3.2.0
    @vue/preload-webpack-plugin:  1.1.2
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^6.2.2 => 6.2.2
    vue: ^2.6.11 => 2.6.12
    vue-cli-plugin-vuetify: ~2.0.9 => 2.0.9
    vue-eslint-parser:  7.3.0
    vue-hot-reload-api:  2.3.4
    vue-loader:  15.9.6 (16.1.2)
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.11 => 2.6.12
    vue-template-es2015-compiler:  1.9.1
    vuetify: ^2.2.11 => 2.4.2
    vuetify-loader: ^1.3.0 => 1.6.0
    vuewordcloud: ^18.7.12 => 18.7.12
npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

Create a new github repo with a default .gitignore for node.js clone to your machine and then inside that directory, run vue create .

What is expected?

.gitignore is changed to include new files and not replaced while losing previous ignored files

What is actually happening?

.gitignore is cahnged and things like ".env" files are added to git.

fredgan commented 3 years ago

Are you hoping that the default .gitignore content is merged with your repo's .gitignore content while currently it is totally replaced?

It seems reasonable but it doesn't make much sense.

ZimGil commented 3 years ago

When you have an existing project with a certain .gitignore content that matches you project, and you want to add Vue.js using the vue-cli, you're not expecting that vue create . will alter you .gitignore file and you may end up commiting files that should be ignored.