diff --git a/README.md b/README.md index 859ecd9..9868776 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,30 @@ -# runenv +# by-node-env Run package.json scripts depending on `NODE_ENV`. -[![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) +[![travis build](https://img.shields.io/travis/shian15810/by-node-env.svg)](https://travis-ci.org/shian15810/by-node-env) +[![version](https://img.shields.io/npm/v/by-node-env.svg)](http://npm.im/by-node-env) +[![downloads](https://img.shields.io/npm/dm/by-node-env.svg)](http://npm-stat.com/charts.html?package=by-node-env) +[![MIT License](https://img.shields.io/npm/l/by-node-env.svg)](http://opensource.org/licenses/MIT) ## Installation Install with npm: ```sh -npm install runenv +npm install by-node-env ``` Install with Yarn: ```sh -yarn add runenv +yarn add by-node-env ``` ## Features - [x] Defaults `NODE_ENV` to `development`. -- [x] Customize `process.env` runenvironment. +- [x] Customize `process.env` by-node-environment. - [x] Clearer, concise scripts. - [x] No more Bash-scripting in `package.json`. - [x] Works on Linux, macOS and Windows. @@ -37,9 +37,9 @@ yarn add runenv ```js { - // Processes spawned by `runenv` inherit environment-specific + // Processes spawned by `by-node-env` inherit environment-specific // variables, if defined. - "runenv": { + "by-node-env": { "production": { "DOCKER_USER": "my", "DOCKER_REPO": "project" @@ -47,20 +47,20 @@ yarn add runenv }, "scripts": { // If NODE_ENV is missing, defaults to "development". - "build": "runenv", + "build": "by-node-env", "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": "runenv", + "deploy": "by-node-env", "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": "runenv", + "start": "by-node-env", "start:development": "npm run build:development", @@ -71,7 +71,7 @@ yarn add runenv "start:staging": "start-cluster build/server/server.js", // Explicitly set NODE_ENV, which is helpful in CI. - "test": "NODE_ENV=test runenv", + "test": "NODE_ENV=test by-node-env", "test:test": "mocha" } @@ -80,7 +80,7 @@ yarn add runenv ## Note -`runenv` is essentially a clone of [`per-env`](https://www.npmjs.com/package/per-env) with some notable fixes in 1.0.0: +`by-node-env` 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. diff --git a/bin/runenv b/bin/by-node-env similarity index 88% rename from bin/runenv rename to bin/by-node-env index 21b4bb0..f6fd376 100755 --- a/bin/runenv +++ b/bin/by-node-env @@ -12,7 +12,7 @@ var env = Object.assign( // Default NODE_ENV { NODE_ENV: NODE_ENV}, // Override with package.json custom env variables - (pkg && pkg["runenv"] && pkg["runenv"][NODE_ENV]) || {}, + (pkg && pkg["by-node-env"] && pkg["by-node-env"][NODE_ENV]) || {}, // Explicit env takes precedence process.env @@ -32,7 +32,7 @@ var args = [ "run", script ].concat( - // Extra arguments after "runenv" + // Extra arguments after "by-node-env" process.argv.slice(2) ); diff --git a/package.json b/package.json index b47dd7d..af99d4c 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "name": "runenv", + "name": "by-node-env", "version": "1.0.0", "description": "Run package.json scripts depending on NODE_ENV.", "bin": { - "runenv": "./bin/runenv" + "by-node-env": "./bin/by-node-env" }, "scripts": { - "test": "NODE_ENV=development ./bin/runenv && NODE_ENV=test ./bin/runenv", + "test": "NODE_ENV=development ./bin/by-node-env && NODE_ENV=test ./bin/by-node-env", "pretest:development": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}", "test:development": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}", "posttest:development": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}", @@ -14,14 +14,14 @@ "test:test": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}", "posttest:test": "echo ${npm_lifecycle_event} ${CUSTOM_VALUE}" }, - "runenv": { + "by-node-env": { "development": { "CUSTOM_VALUE": "dev" } }, "repository": { "type": "git", - "url": "git+https://github.com/shian15810/runenv.git" + "url": "git+https://github.com/shian15810/by-node-env.git" }, "keywords": [ "build", @@ -60,7 +60,7 @@ "process", "prod", "production", - "runenv", + "by-node-env", "run", "script", "scripts", @@ -76,9 +76,9 @@ "author": "Chuah Chee Shian ", "license": "MIT", "bugs": { - "url": "https://github.com/shian15810/runenv/issues" + "url": "https://github.com/shian15810/by-node-env/issues" }, - "homepage": "https://github.com/shian15810/runenv#readme", + "homepage": "https://github.com/shian15810/by-node-env#readme", "dependencies": { "cross-spawn": "^6.0.5" }