1.0.0 • Published 6 years ago

dotenv.macro v1.0.0

Weekly downloads
39
License
MIT
Repository
github
Last release
6 years ago

dotenv.macro

Inline dotenv at build-time with babel-macros.

Travis Codecov Status npm package npm downloads node

Dependency Status devDependency Status peerDependency Status

prettier license

Installation

$ yarn add dotenv.macro

Note: You'll also need to install and configure babel-plugin-macros if you haven't already.

Usage

// .env
HOST=localhost
EXPAND_NODE_ENV="NODE_ENV=${NODE_ENV}"

// index.js
import { HOST } from 'dotenv.macro';
console.log(HOST);

      ↓ ↓ ↓ ↓ ↓ ↓

console.log(process && process.env && process.env.HOST || "localhost");

Alternative

Development

Requirements

  • node >= 9.4.0
  • yarn >= 1.3.2
$ yarn install --pure-lockfile

Test

$ yarn run format
$ yarn run eslint
$ yarn run test:watch
$ yarn run build

CONTRIBUTING

  • ⇄ Pull requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.
  • Pull requests must be accompanied by passing automated tests.

CHANGELOG

LICENSE

MIT: http://michaelhsu.mit-license.org