dpacassi / disable-javascript

Adds the ability to disable JavaScript on specific sites.
MIT License
275 stars 36 forks source link

Git ignore node_modules #71

Closed heatherbooker closed 4 years ago

heatherbooker commented 4 years ago

I noticed when I did npm install, git said "hey! what about these node_nodules??", so I thought I should tell it what I think about that. :)

In all seriousness for anyone who looks at this and wonders why,

dpacassi commented 4 years ago

Hi Heather!

Thanks for all the energy and input on this project, I'll try to address them within the next few weeks. About this PR, I'm definitively with you that the node_modules folder should never be committed. However, it's best practice to add them in a global .gitignore file rather than adding them to the .gitignore files of all projects.

As you can see, the node_modules folder was never committed in this project. The same behavior goes for IDE generated files and other similar files.

Best, David

heatherbooker commented 4 years ago

Oh that's so interesting! I'd never heard of the idea of putting node_modules etc in the global gitignore so I tried to find some answers about best practices. If you man gitignore ([or look at docs online), it has this relevant section:

Which file to place a pattern in depends on how the pattern is meant to
be used.

 * Patterns which should be version-controlled and distributed to
   other repositories via clone (i.e., files that all developers will want
   to ignore) should go into a `.gitignore` file.

 * Patterns which are
   specific to a particular repository but which do not need to be shared
   with other related repositories (e.g., auxiliary files that live inside
   the repository but are specific to one user's workflow) should go into
   the `$GIT_DIR/info/exclude` file.

 * Patterns which a user wants Git to
   ignore in all situations (e.g., backup or temporary files generated by
   the user's editor of choice) generally go into a file specified by
   `core.excludesFile` in the user's `~/.gitconfig`. Its default value is
   $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or
   empty, $HOME/.config/git/ignore is used instead.

I think node_modules fits into the first category, no? All devs working on this project will want the pattern node_modules to be ignored >< As opposed to the last category for global gitignores which is more for user-specific files.

Let me know what you think. :)

dpacassi commented 4 years ago

Hmm. At my former workplaces and also for me, the node_modules folder belongs more to the third category. You don't want to add it to version control in any project, not just this one. However, as with life, there might be exceptions.

I guess there's no right or wrong answer. Kinda like the "tabs vs. spaces" thing, everyone has their preferences. Now, for this particular case, considering that I want to drop Gulp and Node.js (#73), I guess there's no need to add the node_modules folder to .gitignore.