Skip to content

pjl914335852-ux/env-diff-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

env-diff-checker

A zero-dependency CLI tool that compares your .env file against .env.example and tells you exactly what's missing, what's extra, and what's in sync.

Useful in CI pipelines, onboarding scripts, or just before deploying when you're not sure if your environment is complete.

Why

Every team has that moment: a new dev clones the repo, runs the app, and it crashes because .env is missing three keys that were added two months ago and nobody updated the docs. This tool catches that before it becomes a problem.

Usage

# In your project root
node index.js

# Custom paths
node index.js .env.local .env.example

# Help
node index.js --help

Output

env-diff-checker — .env vs .env.example

✓ Matched keys: 4

✗ Missing in .env (2):
  - DATABASE_URL
  - REDIS_PASSWORD

⚠ Extra in .env not in .env.example (1):
  + MY_LOCAL_DEBUG_FLAG

Exit Codes

Code Meaning
0 All required keys present
1 One or more keys missing (useful for CI)

CI Integration

Add a check to your pipeline before deploy:

# GitHub Actions example
- name: Check env completeness
  run: node env-diff-checker/index.js .env .env.example

Or in a pre-deploy shell script:

node env-diff-checker/index.js || { echo "Fix your .env first!"; exit 1; }

Run Tests

node test.js

No Dependencies

Pure Node.js, no npm install needed. Works on Node 14+.


Automate Your Dev Workflow

If you're managing multiple projects, environments, or deployments, repetitive checks like this are a good candidate for automation. @anluyy_bot on Telegram offers AI-assisted deployment and automation services — handy if you want to wire up checks like this into a broader CI/CD or notification workflow without setting up extra infrastructure yourself.


License

MIT

About

Zero-dependency CLI to diff .env vs .env.example — catch missing keys before they bite you

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors