Skip to content

fix: ignore environment-specific dotenv files - #383

Open
vibhor-aggr wants to merge 1 commit into
expressjs:masterfrom
vibhor-aggr:fix/ignore-dotenv-variants
Open

vibhor-aggr wants to merge 1 commit into
expressjs:masterfrom
vibhor-aggr:fix/ignore-dotenv-variants

Conversation

@vibhor-aggr

Copy link
Copy Markdown

Fixes #381.

The generated .gitignore now ignores environment-specific dotenv files with .env.*, while !.env.example keeps the example file trackable. This changes only the JavaScript gitignore template and adds a regression for generated --git output.

Verification on Node 24.16.0:

  • New generated-output regression fails before the template change and passes afterward.
  • ./node_modules/.bin/mocha --reporter spec --check-leaks test/ --grep=--git: 5 passed.
  • Generation-only suite: 95 passed, using --grep 'npm start|should have installable dependencies|should export an express app from app.js' --invert.
  • A generated-app git check-ignore --no-index smoke check confirms .env, .env.local, .env.development, .env.production, .env.test, and .env.production.local are ignored at root and under config/; .env.example, .environment, and README.md are not ignored in either location. Generation without --git still does not create a .gitignore.
  • npm run lint and git diff --check: passed.

The generated-app dependency installation/runtime tests were not rerun. The existing Sass fixture depends on the legacy node-sass/Python-2 toolchain and is incompatible with this local Node 24 environment; this change does not modify application dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modernize generated .gitignore to cover environment-specific dotenv files

1 participant