Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 1.44 KB

File metadata and controls

72 lines (49 loc) · 1.44 KB

envdiff-cli

npm version License: MIT

Compare .env files and spot missing, extra, or changed variables instantly.

Why

  • Onboarding: compare .env.example against your local .env to find missing keys
  • Deployments: diff staging vs production env to catch misconfigurations
  • CI: fail the pipeline when env files drift apart

Install

npm install -g envdiff-cli

Or use directly with npx:

npx envdiff-cli .env .env.example

Usage

# Show differences between two env files
envdiff .env .env.example

# Include matching entries
envdiff .env .env.production --all

# JSON output (for CI pipelines)
envdiff .env .env.example --json

Output

- SECRET_KEY=abc123              # missing from right file
+ NEW_FEATURE_FLAG=true          # extra in right file
~ DATABASE_URL  old -> new       # value changed

1 missing, 1 extra, 1 changed, 5 equal

Exit Codes

Code Meaning
0 Files are identical
1 Differences found

Use exit codes in CI to fail on env drift:

- run: npx envdiff-cli .env.example .env.ci

Options

Flag Description
--all Show equal entries too
--json Output as JSON
-h, --help Show help

License

MIT