diff --git a/README.md b/README.md index aba04a2..859ecd9 100644 --- a/README.md +++ b/README.md @@ -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. @@ -37,9 +37,9 @@ 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" @@ -47,20 +47,20 @@ yarn add run-env }, "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", @@ -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" } @@ -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. diff --git a/bin/run-env b/bin/runenv similarity index 89% rename from bin/run-env rename to bin/runenv index c3e540d..21b4bb0 100755 --- a/bin/run-env +++ b/bin/runenv @@ -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 @@ -32,7 +32,7 @@ var args = [ "run", script ].concat( - // Extra arguments after "run-env" + // Extra arguments after "runenv" process.argv.slice(2) ); diff --git a/package.json b/package.json index 100608c..b47dd7d 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "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}", @@ -14,14 +14,14 @@ "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", @@ -60,7 +60,7 @@ "process", "prod", "production", - "run-env", + "runenv", "run", "script", "scripts", @@ -76,9 +76,9 @@ "author": "Chuah Chee Shian ", "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" }