Express 101: Use of `--git` flag of `express-generator` for the `.gitignore` file
Checks
- [X] This is not a duplicate of an existing issue (please have a look through our open issues list to make sure)
- [X] I have thoroughly read and understand The Odin Project Contributing Guide
- [X] Would you like to work on this issue?
Describe your suggestion
The Using Git section instructs about making a .gitignore file manually and adding node_modules there.
However, express-generator also accepts a --git flag for generating a .gitignore file that also includes node_modules. I think it is preferable to let the tool handle this "step" for us.
From the MDN tutorial:
> express --help
Usage: express [options] [dir]
Options:
--version output the version number
-e, --ejs add ejs engine support
--pug add pug engine support
--hbs add handlebars engine support
-H, --hogan add hogan.js engine support
-v, --view <engine> add view <engine> support (dust|ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade)
--no-view use static html instead of view engine
-c, --css <engine> add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain CSS)
--git add .gitignore
-f, --force force on non-empty directory
-h, --help output usage information
Content of the generated file:
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# next.js build output
.next
I understand if this is undesirable since there is a lot of other things in the generated .gitignore (although Vite's .gitignore in the React course is also kind of verbose 😅). Maybe the use of the --git flag can just be suggested as an alternative.
Possible edit:
Using Git
As you work through this tutorial, make sure to put the
node_modulesfolder in a.gitignorefile.Alternatively, you can also use the
--gitflag ofexpress-generator, e.g.express express-locallibrary-tutorial --view=pug --git
I am not sure if this fits well enough here though, since the discussion around express-generator is in the MDN tutorial.
Path
Node / JS
Lesson Url
https://www.theodinproject.com/lessons/nodejs-express-101
(Optional) Discord Name
E('Mark')
(Optional) Additional Comments
No response
Thank you for the suggestion @mark-P0
Going to ping our @TheOdinProject/javascript team and ask for their input on this.
This issue is stale because it has had no activity for the last 30 days.
Unless there's any issues that arise from using the flag (like "You can use this flag, but be sure to/keep in mind..."), I don't think it's really necessary to add that in. At this point users should be used to adding files to a gitignore file, so the "Using git" section actually seems unnecessary as well. If users reading the MDN tutorial notice the --git flag being mentioned it'd be more up to them whether to use it or not.
This issue is stale because it has had no activity for the last 30 days.
Gonna close this for now as it doesn't really feel like a necessary change still, but willing to reopen if anyone feels strongly about it.