auto-type-env
v1.1.0
Published
A simple library for auto creating types for your .env file
Downloads
19
Readme
auto-type-env
auto-type-env is a Node.js library that automatically generates TypeScript types for your environment variables.
Installation
You can install auto-type-env via npm:
npm install -g auto-type-env
# or
npx auto-type-env
Usage
Here's a quick example to get you started with auto-type-env:
auto-type-env -p .env -t ./src/environment.d.ts
# or
auto-type-env # will use default values
Example
Imagine you have a .env like this:
ULTRA_SECRET_VARIABLE=value
ANOTHER_SECRET=value2
This library will generate something like:
export {};
declare global {
namespace NodeJS {
interface ProcessEnv {
ULTRA_SECRET_VARIABLE: string;
ANOTHER_SECRET: string;
}
}
}
Then you will have all the items available for you when you type process.env
Contribution
Contributions are welcome! If you find a bug, have a feature request, or want to contribute in any other way, please open an issue or submit a pull request. We appreciate your feedback and involvement in making auto-type-env even better.
License
auto-type-env is MIT licensed, which means you can use it freely in your projects, both personal and commercial.
Contact
If you have any questions, suggestions, or feedback, you can reach me at [email protected].
Disclaimer: auto-type-env is a third-party library and is not affiliated with or endorsed by Node.js or its contributors.