env-guard-v2
v1.0.1
Published
Env Guard v2 is an enhanced CLI tool designed to help developers manage and verify environment variables in Node.js projects. It ensures `.env` files are properly configured, checks for missing or unused variables, and provides auto-fix options to streaml
Readme
Env Guard v2
Overview
Env Guard v2 is an enhanced CLI tool designed to help developers manage and verify environment variables in Node.js projects. It ensures .env files are properly configured, checks for missing or unused variables, and provides auto-fix options to streamline development.
Features
- Check for Missing
.envand.env.exampleFiles: Ensures the necessary environment files exist. - Auto-Fix Missing Variables: Adds missing variables from
.env.exampleto.envautomatically. - Export
.envto JSON: Converts.envfile into a structuredenv.jsonformat. - Detect Unused Variables: Identifies variables in
.envthat are not referenced in.env.example. - Initialize
.envFiles: Creates empty.envand.env.examplefiles if missing. - Validate Environment Variables: Ensures all required variables are correctly set.
- Format and Clean
.envFiles: Organizes and removes duplicate or incorrect entries.
Installation
To install globally, run:
npm install -g env-guard-v2Usage
Run env-guard in your project directory to check environment variables.
Commands
env-guard→ Checks.envand.env.examplefor issues.env-guard --fix→ Auto-fix missing variables in.env.env-guard --export→ Export.envasenv.json.env-guard --unused→ Detect unused variables in.env.env-guard --init→ Initialize.envand.env.examplefiles.env-guard --validate→ Validates environment variables.env-guard --clean→ Formats and cleans.envfile.
Example Output
✅ All environment variables are properly set!
❌ .env file not found!
❌ Missing variables detected: API_KEY, DB_URL
✅ .env file updated with missing variables.Contributing
Feel free to open issues or submit pull requests to improve the tool. Contributions are welcome!
License
MIT
