Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

env2typings

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env2typings

Generates TypeScript typings for environment variables from a .env file.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

env2typings

A CLI utility to generate TypeScript typings for environment variables.

Introduction

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.

Installation

To install env2typings globally:

npm install -g env2typings

Usage

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.

Custom .env File and Output Path

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

Dry Run

To see the generated type declarations without writing to a file:

env2typings --dry-run

Local Development

If you'd like to contribute or simply test out the utility in a local environment, follow these steps:

  1. Clone the Repository:
git clone https://github.com/alexalexandrescu/env2typings.git
cd env2typings
  1. Install Dependencies: Before you can run the utility locally, you need to install its dependencies:
npm install
  1. Link the Package: To use the command-line utility locally, you'll need to link it:
npm link

After running this command, you can use the env2typings command globally.

API

CLI Arguments

  • --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.

Contributing

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

License

MIT

Keywords

FAQs

Package last updated on 28 Nov 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc