@dhiyanesh/env-check
v1.0.2
Published
Ensure all .env variables are present in .env.example before commit
Downloads
13
Maintainers
Readme
env-check (@dhiyanesh/env-check)
env-check is a simple CLI tool to ensure your .env.example file is in sync with your .env file. It can add missing variables, comment out extra ones, or remove them.
Installation
npm install -g @dhiyanesh/env-checkUsage
Run the CLI in your project root:
env-check [options]Options
Add missing variables
env-check --addAdd missing variables from .env to .env.example.
Comment extra variables
env-check --removeComment out extra variables in .env.example.
Remove extra variables
env-check --remove-hardRemove extra variables from .env.example.
Sync variables
env-check --syncAdd missing variables and comment extra ones.
Sync (with remove) extra variables
env-check --sync-hardAdd missing variables and remove extra ones.
Usage with husky
Add the following to husky pre-commit to automatically sync the .env and .env-example files before pushing your code.
npx env-check --sync-hard
git add .env.exampleNotes
The tool requires .env file to exist in the project root.
After running, .env.example will be updated automatically.
