npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

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

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:

Alt text

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

  1. Using .batmanrc.json in root of project
{
	//commands here
}
  1. Using batman.config.js in root of project
module.exports = {
  //commands here
}
  1. Using package.json
// Inside package.json
"batman": {
	// commands here
}
  1. 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
  1. 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.
  1. 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