by-node-env
Run package.json scripts by NODE_ENV
.
Installation
Install with npm:
npm install by-node-env
Install with Yarn:
yarn add by-node-env
Features
Example
{
"by-node-env": {
"production": {
"DOCKER_USER": "my",
"DOCKER_REPO": "project"
}
},
"scripts": {
"build": "by-node-env",
"build:development": "webpack -d --watch",
"build:staging": "webpack -p",
"build:production": "webpack -p",
"deploy": "by-node-env",
"predeploy:production": "docker build -t ${DOCKER_USER}/${DOCKER_PROJECT} .",
"deploy:production": "docker push ${DOCKER_USER}/${DOCKER_PROJECT}",
"start": "by-node-env",
"start:development": "npm run build:development",
"prestart:production": "npm run build",
"start:production": "start-cluster build/server/server.js",
"prestart:staging": "npm run build",
"start:staging": "start-cluster build/server/server.js",
"test": "NODE_ENV=test by-node-env",
"test:test": "mocha"
}
}
Note
by-node-env
is essentially a clone of per-env
with some notable fixes:
- Windows compatibility.
- Yarn compatibility.
Contributing
Do you encounter bugs or having new ideas?
Issues, comments and PRs are always welcomed!