dotenv-types-generator is a command line tool for automatically generating type declarations files (.d.ts) for your .env files
npx dotenv-types-generator
# Or using Yarn 2.x
yarn dlx 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
npx dotenv-types-generator -f [path/to/file/.env]
# Or using Yarn 2.x
yarn dlx dotenv-types-generator -f [path/to/file/.env]
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 |
git clone https://github.com/saulmaldonado/dotenv-types-generator.git
npm run build
# or
yarn build
npm link
# or
yarn link
npm link dotenv-types-generator
# or
yarn link dotenv-types-generator
yarn test
# or
npm run test
Issues and PRs are welcome! See CONTRIBUTING.md
Give a ⭐️ if this project helped you!