0.2.0 • Published 3 years ago

@supertone/envjs v0.2.0

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

@supertone/envjs

npm (scoped) Test codecov

Executes commands using an environment from a .js file.

Installation

npm install --save-dev @supertone/envjs

Usage

Usage: envjs [options] <command>

Arguments:
  command                   command to run with env variables

Options:
  -f, --file <path>         env file path (default: ".env.js")
  -e, --env <key=value...>  additional env key-value pairs
  -h, --help                display help

Note:
  - You must escape "$" with "\$" for using env variables in command line.
  - If you use variadic options(e.g. -e, --env) directly before <command>,
    insert "--" between [option] and <command> to distinguish them.

Examples:
  envjs echo \$ENV_VAR
  envjs -f .env.json echo \$ENV_VAR
  envjs -e ENV_VAR=value -- echo \$ENV_VAR
  envjs -f .env.json -e ENV_VAR=value -- echo \$ENV_VAR
  envjs -e ENV_VAR=value -f .env.json echo \$ENV_VAR

For example in package.json:

{
  "scripts": {
    "test": "envjs -f .env.test.js jest",
    "start": "envjs -f .env.dev.js http-server -p \\$PORT",
    "build": "envjs -e NODE_ENV=production -- webpack"
  }
}
0.2.0

3 years ago

0.1.0

3 years ago