Skip to content

Commit

Permalink
renamed run-env to runenv
Browse files Browse the repository at this point in the history
  • Loading branch information
shian15810 committed Jun 11, 2019
1 parent fb7c665 commit 0c0c95a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# run-env
# runenv

Run package.json scripts depending on `NODE_ENV`.

[![travis build](https://img.shields.io/travis/shian15810/run-env.svg)](https://travis-ci.org/shian15810/run-env)
[![version](https://img.shields.io/npm/v/run-env.svg)](http://npm.im/run-env)
[![downloads](https://img.shields.io/npm/dm/run-env.svg)](http://npm-stat.com/charts.html?package=run-env)
[![MIT License](https://img.shields.io/npm/l/run-env.svg)](http://opensource.org/licenses/MIT)
[![travis build](https://img.shields.io/travis/shian15810/runenv.svg)](https://travis-ci.org/shian15810/runenv)
[![version](https://img.shields.io/npm/v/runenv.svg)](http://npm.im/runenv)
[![downloads](https://img.shields.io/npm/dm/runenv.svg)](http://npm-stat.com/charts.html?package=runenv)
[![MIT License](https://img.shields.io/npm/l/runenv.svg)](http://opensource.org/licenses/MIT)

## Installation

Install with npm:

```sh
npm install run-env
npm install runenv
```

Install with Yarn:

```sh
yarn add run-env
yarn add runenv
```

## Features

- [x] Defaults `NODE_ENV` to `development`.
- [x] Customize `process.env` run-environment.
- [x] Customize `process.env` runenvironment.
- [x] Clearer, concise scripts.
- [x] No more Bash-scripting in `package.json`.
- [x] Works on Linux, macOS and Windows.
Expand All @@ -37,30 +37,30 @@ yarn add run-env

```js
{
// Processes spawned by `run-env` inherit environment-specific
// Processes spawned by `runenv` inherit environment-specific
// variables, if defined.
"run-env": {
"runenv": {
"production": {
"DOCKER_USER": "my",
"DOCKER_REPO": "project"
}
},
"scripts": {
// If NODE_ENV is missing, defaults to "development".
"build": "run-env",
"build": "runenv",

"build:development": "webpack -d --watch",
"build:staging": "webpack -p",
"build:production": "webpack -p",

// Deployment won't work unless NODE_ENV=production is explicitly set.
"deploy": "run-env",
"deploy": "runenv",

"predeploy:production": "docker build -t ${DOCKER_USER}/${DOCKER_PROJECT} .",
"deploy:production": "docker push ${DOCKER_USER}/${DOCKER_PROJECT}",

// "npm start" is _the_ command to start the server across all environments.
"start": "run-env",
"start": "runenv",

"start:development": "npm run build:development",

Expand All @@ -71,7 +71,7 @@ yarn add run-env
"start:staging": "start-cluster build/server/server.js",

// Explicitly set NODE_ENV, which is helpful in CI.
"test": "NODE_ENV=test run-env",
"test": "NODE_ENV=test runenv",

"test:test": "mocha"
}
Expand All @@ -80,7 +80,7 @@ yarn add run-env

## Note

`run-env` is essentially a clone of [`per-env`](https://www.npmjs.com/package/per-env) with some notable fixes in 1.0.0:
`runenv` is essentially a clone of [`per-env`](https://www.npmjs.com/package/per-env) with some notable fixes in 1.0.0:

- Windows compatibility.
- Yarn compatibility.
4 changes: 2 additions & 2 deletions bin/run-env → bin/runenv
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var env = Object.assign(
// Default NODE_ENV
{ NODE_ENV: NODE_ENV},
// Override with package.json custom env variables
(pkg && pkg["run-env"] && pkg["run-env"][NODE_ENV]) || {},
(pkg && pkg["runenv"] && pkg["runenv"][NODE_ENV]) || {},

// Explicit env takes precedence
process.env
Expand All @@ -32,7 +32,7 @@ var args = [
"run",
script
].concat(
// Extra arguments after "run-env"
// Extra arguments after "runenv"
process.argv.slice(2)
);

Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "run-env",
"name": "runenv",
"version": "1.0.0",
"description": "Run package.json scripts depending on NODE_ENV.",
"bin": {
"run-env": "./bin/run-env"
"runenv": "./bin/runenv"
},
"scripts": {
"test": "NODE_ENV=development ./bin/run-env && NODE_ENV=test ./bin/run-env",
"test": "NODE_ENV=development ./bin/runenv && NODE_ENV=test ./bin/runenv",
"pretest:development": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}",
"test:development": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}",
"posttest:development": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}",
"pretest:test": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}",
"test:test": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}",
"posttest:test": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}"
},
"run-env": {
"runenv": {
"development": {
"CUSTOM_VALUE": "dev"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/shian15810/run-env.git"
"url": "git+https://github.com/shian15810/runenv.git"
},
"keywords": [
"build",
Expand Down Expand Up @@ -60,7 +60,7 @@
"process",
"prod",
"production",
"run-env",
"runenv",
"run",
"script",
"scripts",
Expand All @@ -76,9 +76,9 @@
"author": "Chuah Chee Shian <shian15810@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/shian15810/run-env/issues"
"url": "https://github.com/shian15810/runenv/issues"
},
"homepage": "https://github.com/shian15810/run-env#readme",
"homepage": "https://github.com/shian15810/runenv#readme",
"dependencies": {
"cross-spawn": "^6.0.5"
}
Expand Down

0 comments on commit 0c0c95a

Please sign in to comment.