0.0.5 • Published 9 months ago

gen-typed-env v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Generate Typed Env

Create a type-safe config from your .env file.

Usage

npx gen-typed-env --file .env

!NOTE You can omit the --file flag if you have a .env file in the current directory.

Example

USERNAME=Complexlity
PROFILE_URL=https://github.com/Complexlity/typesafe-env/
COMPANYNAME=
npx gen-typed-env

Will generate the following file:

import { z } from "zod";
import { config: dotenvConfig } from "dotenv";

dotenvConfig();

export const env = z.object({
  USERNAME: z.string(),
  PROFILE_URL: z.url(),
  COMPANYNAME: z.string().optional(),
});

const config = env.parse(process.env);

export default config;
0.0.5

9 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago