Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
env2typings
Advanced tools
Generates TypeScript typings for environment variables from a .env file.
A CLI utility to generate TypeScript typings for environment variables.
env2typings is a simple command-line utility that automates the process of generating TypeScript type declarations based on your .env files. This ensures type safety and autocompletion for process environment variables in TypeScript projects.
To install env2typings globally:
npm install -g env2typings
Basic Usage Run the tool in a directory that contains a .env file:
env2typings
By default, this will create a process-env.d.ts file in the same directory.
To specify a custom path for the .env file and the output .d.ts file:
env2typings --env-file=path/to/your/.env --output=path/to/output.d.ts
To see the generated type declarations without writing to a file:
env2typings --dry-run
If you'd like to contribute or simply test out the utility in a local environment, follow these steps:
git clone https://github.com/alexalexandrescu/env2typings.git
cd env2typings
npm install
npm link
After running this command, you can use the env2typings command globally.
--env-file
: (Optional) Path to your .env
file. Defaults to .env
if it exists in the current directory.--output
: (Optional) Path for the output .d.ts
file. Defaults to process-env.d.ts
.--dry-run
: (Optional) Prints the generated type declarations to the console without writing to a file.Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Ensure to run tests with:
npm test
MIT
FAQs
Generates TypeScript typings for environment variables from a .env file.
We found that env2typings demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.