boilerplates

Node.js CLI Tool Boilerplate

A modern Node.js CLI application using Commander.js.

Structure

cli_tool/
├── bin/
│   └── cli.js
├── src/
│   ├── commands/
│   │   ├── init.js
│   │   └── run.js
│   └── utils/
│       └── logger.js
├── tests/
├── package.json
├── .env.example
└── README.md

Features

Usage

Installation

# Install dependencies
npm install

# Link for local development
npm link

# Or install globally
npm install -g

Running

# Using the installed command
mycli --help
mycli init
mycli run --option value

# Or run directly
node bin/cli.js --help

Commands

Development

# Install dev dependencies
npm install

# Run tests
npm test

# Run linter
npm run lint

Publishing

# Build (if needed)
npm run build

# Publish to npm
npm publish