I start contextualizing. This GitHub repository I made has only one file uploaded to it, a file package.json
, which I pulled from a custom web app template I use. That app uses various tools and frameworks, including AngularJS, Bootstrap 3, SASS, etc., and uses Grunt as an automator.
The two relevant aspects for this scenario that I propose are that:
NPM is used as a package manager.
In the repository there is no file
.gitignore
, i.e. no file to specify which files/folders are to be ignored by Git . It is crucial for what comes later.
The content of the file package.json
, as it appears in the repository , is as follows:
{
"name": "miproyecto",
"version": "1.0.0",
"description": "",
"main": "Gruntfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"grunt": "^1.0.4",
"grunt-angular-templates": "^1.2.0",
"grunt-contrib-connect": "^2.1.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "^3.0.0",
"grunt-contrib-htmlmin": "^3.1.0",
"grunt-contrib-jshint": "^2.1.0",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-uglify": "^4.0.1",
"grunt-contrib-watch": "^1.1.0",
"grunt-htmlhint": "^0.9.13",
"grunt-stylelint": "^0.12.0",
"load-grunt-tasks": "^5.1.0",
"stylelint": "^11.1.1"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.10.2",
"@uirouter/angularjs": "^1.0.22",
"angular": "^1.7.8",
"angular-animate": "^1.7.8",
"bootstrap": "^3.3.6",
"jquery": "^3.4.1"
}
}
Once the repository is cloned, in Visual Studio Code (which is the editor I use), I open a terminal, and then run npm install
to install the dependencies.
When the installation of the dependencies is finished, and the generation of the folder node_modules
, it strikes me that, from the VSC Git extension (which I have installed), I get the following notification (I put it in image and text):
The git repository at '[local folder where I have the local copy of my repository]' has too many active changes, only a subset of Git features will be enabled. Would you like to add 'node_modules' to .gitignore?
That refers to the volume of active changes that were taking place, and therefore it suggests if I want to include the folder node_modules
in a file .gitignore
, which until now, had not been created.
Considering the volume of changes described for GIT, and the weight on the hard drive that the installed dependencies imply, I want to ask:
- Should I, or should I not, include the folder
node_modules
, within the folders that Git should ignore? - Outside of the volume and weight aspects, what are the advantages and disadvantages of doing it, or not doing it?