Generates type declarations for your .env file
npm install dotenv-types-generatordotenv-types-generator is a command line tool for automatically generating type declarations files (.d.ts) for your .env files
!demo
``sh
npx dotenv-types-generator
By default, a .env file is expected in the root directory of the project. To specify a path, use the --file or -f flag
`sh
npx dotenv-types-generator -f [path/to/file/.env]Or using Yarn 2.x
yarn dlx dotenv-types-generator -f [path/to/file/.env]
`Options
| | flag | alias | default value |
| -------------------------------------------: | ------------------------------ | ---------------------- | ------------- |
| Path to .env file |
--file path/to/file/.env | -f path/to/file/.env | ./.env |
| Optional/Nullable Types | --optionalTypes | -o | false |
| Merge with existing env.d.ts file | --mergeTypes | -m | false |
| Include project's default env properties | --defaults PROP1 PROP2 PROP3 | -d PROP1 PROP2 PROP3 | |
| File Indentation Size (spaces) | --indentationSize | -i | 2 |
| version | --version | -v | |
| help | --help | -h | |Development installation
`sh
git clone https://github.com/saulmaldonado/dotenv-types-generator.gitnpm run build
or
yarn buildnpm link
or
yarn linknpm link dotenv-types-generator
or
yarn link dotenv-types-generator
`Run tests
`sh
yarn test
or
npm run test
``Issues and PRs are welcome!
See CONTRIBUTING.md
Give a ⭐️ if this project helped you!
---