Skip to content

CLI tool for generating TypeScript type declarations for your .env file

License

Notifications You must be signed in to change notification settings

saulmaldonado/dotenv-types-generator

Repository files navigation

dotenv-types-generator 👨‍💻

CI Build Code Coverage Version License: MIT

dotenv-types-generator is a command line tool for automatically generating type declarations files (.d.ts) for your .env files

Get the benefits of a strongly typed .env file

demo

Getting Started

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]

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

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

Run tests

yarn test
# or
npm run test

Contribute

Issues and PRs are welcome! See CONTRIBUTING.md

Contributors

Show your support

Give a ⭐️ if this project helped you!


About

CLI tool for generating TypeScript type declarations for your .env file

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published