1.2.2 • Published 1 year ago

@mazp/dotenv v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@mazp/dotenv

Introduce

This is a package about injecting data to process.env object from a .env file, made this package reason is dotenv package is unstable.

Install

npm i @mazp/dotenv
yarn add @mazp/dotenv

Usage

Use env file inject

dotenv test.env rimraf dist

if you don't pass a .env file, default use that named config.env file in the root dir, that you can direct use command like follow:

dotenv rimraf dist

Use parameter inject

dotenv NODE_ENV=development rimraf dist

API

dotnet(option: DotenvOption)

interface DotenvOption {
  path?: string | string[];
  command?: string[];
}
declare function dotenv(option: DotenvOption): void;

you can use this API, pass the path parameter inject data to process.env, path is a .env file location, if you do not pass, default use that named config.env file in the root dir. The path parameter is a relative root dir, so you maybe use a path or url module to load the correct path.

// ESM
import dotenv from "@mazp/dotenv";
dotenv({});
// CJS
let dotenv = require("@mazp/dotenv");
dotenv({ path: "test.env" });
1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.0

1 year ago