batman-cli
v1.1.2
Published
batman-cli is an advance command runner tool. Easy to maintain command runner. Easy to config via external json or js.
Downloads
18
Maintainers
Readme
batman-cli
batman-cli is an advance command runner tool. Easy to maintain command runner. Easy to config via external json or js. Cross-platform cli tool, same command can be run on both window and unix based systems.
How to install
# As a global module
npm i -g batman-cli
####################
# As a local module
npm i batman-cli --save-dev
Prerequisite:
- NodeJS es6(v6.10.1 lts or higher)
Demo:
Youtube:
https://www.youtube.com/watch?v=DtZ6CLPxezM
How to initialize
batman init
#with config file
batman init --config "./configs/batman.config.js"
How to write commands
{
// translated command: ng e2e --serve=false --config=./e2e/config/protractor.cucumber.conf.js -wu=false
"e2e:cucumber": { //command name that batman will refer
"command": "ng e2e", //actual command that batman will execute
"desc": "Run e2e with cucumber", //description
"params": [], //extra params user want to pass with command, like. --prod
"envs": ["TEST=ENV", "TEST2=$MOCK"], //enviroment variables, it can take enviroment variable to build envs
"options": { //options requires by actual command ex. ng
"--serve": false,
"--config": "./e2e/config/protractor.cucumber.conf.js",
"-wu": "false"
}
},
"new": "ng new testapp", //simple command without description
"test": "ng test --code-coverage", // command without description
"install": ["npm install", "Install node modules"] // command with description
}
How to configure
- Using .batmanrc.json in root of project
{
//commands here
}
- Using batman.config.js in root of project
module.exports = {
//commands here
}
- Using package.json
// Inside package.json
"batman": {
// commands here
}
- Using external config inside package.json
// In package.json, config path from root of project
// Using path module, path.resolve(process.cwd(), config)
// Hack if needed
"batman": {
"config": "./batman.config.js" //or batman.config.json(js and json both supported)
}
// batman.config.js or batman.config.json both will work
module.exports = {
//same as above
}
NOTE: Path preference is batman.config.js, .batmanrc.json, package.json
How to use
- Run or excute command
- As global module Install as global module, and simply use
batman run e2e:cucumber
# This will read your batman command config, parse batman commands
# Once found e2e:cucumber, will execute.
- As local module, using npm Install as local module, and simply configure package.json
//package.json
{
//...rest of the prop
"scripts": {
"batman": "batman",
"e2e:cucumber": "batman run e2e:cucumber"
},
"batman" : {
//Super configuration here
}
}
# Run using npm
npm run e2e:cucumber
# This will read your config, parse batman commands
# Once found e2e:cucumber, will execute.
Advance config
All the options and env supports enviroment variables, So user can replace value using $Enviroment variable
//Example
"e2e:cucumber": { //command name that batman will refer
"command": "ng e2e", //actual command that batman will execute
"desc": "Run e2e with cucumber", //description
"params": [], //extra params user want to pass with command, like. --prod
"envs": ["TEST=ENV", "TEST2=$MOCK"], //enviroment variables, it can take enviroment variable to build envs
"options": { //options requires by actual command ex. ng
"--serve": false,
"--config": "./e2e/config/protractor.cucumber.conf.js",
"-wu": "false"
}
}
Other commands
- List Command
batman list #List commands only batman configured
batman list --npm #List all commands including local npm script
Release Note:
v1.1.2:
- Pretty clean command print, fixed linter issue
v1.1.1:
- updated Docs
v1.1.0:
Added command line options, Run npm commands
- Added command line option to init config
- Added command line option to run npm commands
- Added command line option to list commands
- Now user can execute npm commands using same batman run command
v1.0.0:
Simple command interface
- Simplify command config
- User can use command without any other parameters
- Description in command using array
- List commands- using batman list
v0.0.3:
Initial release- Stable woking module
- fixed linter issue, added eslint
Links:
- Docs: https://deepakshrma.github.io/batman-cli/
- NPM module: https://www.npmjs.com/package/batman-cli
- Issues+Suggestions: https://github.com/deepakshrma/batman-cli/issues