A CLI tool for managing environment variables.
- Load configuration from multiple file formats: Supports
env.config.js,env.config.ts, andenv.config.jsonfiles usingunconfig - Multiple environment configurations: Define multiple named configurations with different output files
- Interactive selection: Choose which configuration to write when multiple are available
- Simple CLI interface: Use
-eflag to specify configuration directory
npm install -g genv-cligenv --help- Create an
env.config.jsfile in your project:
export default {
configs: [
{
name: 'Development',
output: '.env.development',
variables: {
API_URL: 'http://localhost:3000',
DEBUG: 'true'
}
},
{
name: 'Production',
output: '.env.production',
variables: {
API_URL: 'https://api.example.com',
DEBUG: 'false'
}
}
]
}- Run the CLI:
# If env.config.js is in current directory
genv
# Or specify config directory
genv -e ./config-
If multiple configurations are defined, you'll be prompted to select one.
-
The selected environment variables will be written to the specified output file.
# Install dependencies
pnpm install
# Build
pnpm run build
# Test
pnpm run test
# Lint
pnpm run lint
# Type checking
pnpm run typecheckMIT License