Ensure that script commands in package.json
are only allowed to execute on specified git branches
This module should be installed as one of your project's devDependencies
:
npm install --save-dev check-git-branch
You might also want to consider using cross-env
:
npm install --save-dev cross-env
example of the scripts
section in your project's package.json:
"scripts": {
"build": "branch master && cross-env NODE_ENV=production node build/build.js",
"build-test": "branch dev && cross-env NODE_ENV=sandbox node build/build.js"
},