gaffle
v0.1.5
Published
Run many commands based on arguments to one npm script
Downloads
16
Readme
Gaffle
Installation
npm install --save-dev gaffle
Example
Add this to your package.json:
{
"scripts": {
"test": "gaffle"
},
"gaffle": {
"jest": { "cmd": "jest $0", "env": { "NODE_ENV": "test" } },
"jest": { "cmd": "jest --watch", "env": { "NODE_ENV": "test" } },
"flow": "flow check $0"
}
}Usage: npm test jest / npm test jest watch / npm test flow.
Why?
For organizing advanced scripts in package.json into simpler commands, and being able to run them via special commands such as npm test that suppresses some annoying output.
Config schema
{
"<short-hand command 1>": "<actual command>",
"<short-hand command 2>": {
"cmd": "<actual command>",
"env": {
"SOME_ENV_VAR": "<env var value>"
},
"desc": "<Description of the command>"
},
"<short-hand command 3>": "<actual command> $0 $1",
"<short-hand command 4>": "<actual command> $*"
}Running an invalid short-hand command (or no command) yields a help output that lists the commands
