npm install npm-statement --global
depending on the environment variable, can run the script.
export NODE_ENV=production
npm-if NODE_ENV is production then 'echo optimyze files...'
# optimyze files...
in addition can be run a local npm commands.
npm install eslint
npm-if NODE_ENV is production then 'eslint src' && echo pass
# pass
npm-if VARIABLE trueScript
npm-if VARIABLE trueScript falseScript
npm-if VARIABLE then trueScript else falseScript
npm-if VARIABLE is {string|undefined} then trueScript else falseScript
npm-if VARIABLE is {string|undefined} then trueScript else falseScript
npm-if VARIABLE isnt {string|undefined} then trueScript else falseScript
npm-unless VARIABLE trueScript
npm-unless VARIABLE trueScript falseScript
npm-unless VARIABLE then trueScript else falseScript
npm-unless VARIABLE is {string|undefined} then trueScript else falseScript
npm-unless VARIABLE is {string|undefined} then trueScript else falseScript
npm-unless VARIABLE isnt {string|undefined} then trueScript else falseScript
Requirement global
- NodeJS v5.10.0
- Npm v3.8.3
git clone https://github.com/59naga/npm-statement
cd npm-statement
npm install
npm test