@hedonicadapter/genv
v0.1.0
Published
CLI to scan your project for env variable usage and generate .env template files
Maintainers
Readme
genv
genv scans your codebase for environment variable usage and generates or updates an env template file.
Install
npm install -g genvOr run without installing globally:
npx genvUsage
genv [options]Options
--out <path>: Output file path (default:.env.template)--include <glob>: Include glob (default:src/**/*.{js,ts,jsx,tsx})--exclude <glob>: Exclude glob (default:node_modules/**)--optional-prefix <str>: Prefix that marks optional env vars (default:OPTIONAL_)--dry-run: Print generated content instead of writing file-h, --help: Show help text
Examples
Generate a default template:
genvWrite to .env.example and scan all source files:
genv --out .env.example --include "**/*.{js,ts,jsx,tsx}" --exclude "**/*.test.*"Preview output without writing:
genv --dry-runMerge behavior
When the output file already exists:
- Existing lines are preserved as-is, including comments and current values.
- New keys are appended under
# --- Auto-added ---. - Duplicate keys are not re-added.
Release workflow (maintainers)
- Update
CHANGELOG.md. - Bump version:
npm version patch|minor|major. - Push commit and tag.
- Run
npm publishmanually, or use the GitHub Actions workflow on release tags.
Development
npm install
npm test
npm run pack:check