Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/RajaRakoto/cli-boilerplate

Minimalistic boilerplate to quick-start CLI development with Inquirer.js in TypeScript ๐Ÿš€
https://github.com/RajaRakoto/cli-boilerplate

boilerplate cli inquirer inquirerjs minimalist starter template typescript

Last synced: 3 months ago
JSON representation

Minimalistic boilerplate to quick-start CLI development with Inquirer.js in TypeScript ๐Ÿš€

Awesome Lists containing this project

README

        

# cli-boilerplate ๐Ÿš€

[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/for-you.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/open-source.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/uses-git.svg)](https://forthebadge.com) [![forthebadge](https://github.com/RajaRakoto/github-docs/blob/master/badge/build-by.svg?raw=true)](https://forthebadge.com)

![Git](https://img.shields.io/badge/-Git-777?style=flat&logo=git&logoColor=F05032&labelColor=ffffff) ![Gitub](https://img.shields.io/badge/-Gitub-777?style=flat&logo=github&logoColor=777&labelColor=ffffff)

**Developer Ready: A versatile template designed to jumpstart CLI development in TypeScript - Engineered to seamlessly integrate with various CLI projects, ensuring smooth compatibility with a pre-configured environment**

Instant Value - All basic tools included and configured:

- ๐Ÿš€ Typescript >= 5.3
- ๐Ÿง… Bun.js >= 1.0.26
- ๐Ÿง… Use Bun as package manager
- ๐ŸŒˆ ESM
- ๐Ÿงช Biome for code formatting and linting
- โœ… Jest or Bun test for fast unit testing and code coverage
- ๐Ÿ“š Type definitions for Bun.js and Jest
- โš™๏ธ EditorConfig for consistent coding style
- ๐Ÿ“ฆ NPM scripts for common operations
- ๐Ÿ› ๏ธ Example configuration for GitHub Actions
- ๐Ÿ“ Simple example of TypeScript code and unit test
- ๐Ÿ— Run tasks with Grunt (example for backup)
- ๐Ÿš„ Build faster
- ๐Ÿ–ฅ๏ธ Ungit for version control (git) with a GUI
- ๐Ÿงช A lightweight private npm proxy registry with Verdaccio, useful for testing your CLI
- ๐Ÿ”ณ Inquirer.js - A collection of common interactive command line user interfaces
- ๐Ÿ”ณ Execa - A process execution library that supports synchronous and asynchronous execution of child processes
- ๐Ÿ”ณ Figlet - A program that generates text banners, in a variety of typefaces, composed of letters made up of conglomerations of smaller ASCII characters
- ๐Ÿ”ณ Node-emoji - A library that provides a simple way to use emojis in your CLI
- ๐Ÿ”ณ Ora - A terminal spinner library that allows you to add a loading spinner to your CLI
- ๐Ÿ”ณ Chalk - A library for styling terminal strings with colors and text styles

---

### ๐Ÿ“Œ Usage

To use this template, use the following commands:

```bash
bun create github.com/RajaRakoto/cli-boilerplate
cd
bun run pkg-upgrade # to upgrade outdated dependencies in interactive mode
```

> NOTE 1: I employ the `MIT license` for this starter kit, which includes my name and GitHub profile. Please remember to adjust or remove it if deemed unnecessary.

> NOTE 2: In order to help you better understand the structure of this boilerplate, there is a `README.md` file in each subdirectory of src.

> NOTE 3: For certain configurations in the `package.json` file, you need to modify them to tailor them to your project (e.g: name, description, author, keywords, main, repository, ...).

---

### ๐Ÿ“Œ NPM Scripts

**Start**

- ๐Ÿ“œ `start` - Run your application with bun.
- ๐Ÿ“œ `start:smol` - Run your application with bun and a flag which configures the JavaScriptCore heap size to be smaller and grow slower.
- ๐Ÿ“œ `start:bin` - Run your standalone binary app.

**Clean**

- ๐Ÿ“œ `clean` - Remove coverage data, prod, build.

**Development**

- ๐Ÿ“œ `dev` - Launch your application in development mode with bun.
- ๐Ÿ“œ `dev:watch` - Interactive watch mode to automatically transpile source files with bun in development.
- ๐Ÿ“œ `dev:hot` - Hot reloading of source files with bun in development.
- ๐Ÿ“œ `dev:smol:watch` - Interactive watch mode to automatically transpile source files with bun in development, while using --smol flag.
- ๐Ÿ“œ `dev:smol:hot` - Hot reloading source files with bun in development, while using --smol flag.

**Build**

- ๐Ÿ“œ `build` - Transpile and bundle source files with bun.
- ๐Ÿ“œ `build:watch` - Interactive watch mode to automatically transpile source files with bun.
- ๐Ÿ“œ `build:bin` - bun's bundler implements a --compile flag for generating a standalone binary from a TypeScript or JavaScript file, use this in your production environment to ensure optimal execution of your app.

**Testing**

- ๐Ÿ“œ `test` - Run bun test.
- ๐Ÿ“œ `test:watch` - Interactive watch mode to automatically re-run tests with bun.

**Linting and Formatting**

- ๐Ÿ“œ `biome:start` - Starts the Biome daemon server. You can specify a custom configuration file path using the `--config-path` option.
- ๐Ÿ“œ `biome:stop` - Stops the Biome daemon server.
- ๐Ÿ“œ `biome:fix` - Runs a source code check and applies automatic fixes (linter & formatter) according to the defined rules.
- ๐Ÿ“œ `biome:unsafe` - Works like `biome:fix`, but may apply more invasive or risky changes.

**Backup and Dependency Management**

- ๐Ÿ“œ `backup` - Backup files with Grunt.
- ๐Ÿ“œ `pkg-check` - Check useless dependencies with depcheck.
- ๐Ÿ“œ `pkg-upgrade` - Upgrade outdated dependencies (interactive mode) with npm-check-updates.

**Versioning**

- ๐Ÿ“œ `versioning` - Start ungit server.

**NPM Commands**

- ๐Ÿ“œ `npm-version:major` - Increments the major version number of your project using npm.
- ๐Ÿ“œ `npm-version:minor` - Increments the minor version number of your project using npm.
- ๐Ÿ“œ `npm-version:patch` - Increments the version patch number of your project using npm.
- ๐Ÿ“œ `npm-login` - Login to a registry user account.
- ๐Ÿ“œ `npm-publish` - Publish your npm package with public access.
- ๐Ÿ“œ `npm-unpublish` - Forcefully unpublish the cli package from npm.
- ๐Ÿ“œ `npm-reset:registry` - Delete the custom npm registry.
- ๐Ÿ“œ `npm-check:registry` - Get the currently configured registry for npm.
- ๐Ÿ“œ `npm-proxy-set:registry` - Set the npm registry to use a local proxy.
- ๐Ÿ“œ `npm-proxy:start` - Start a Verdaccio server with a local npm proxy.
- ๐Ÿ“œ `npm-proxy:publish` - Publish your npm package via the local proxy.
- ๐Ÿ“œ `npm-proxy:unpublish` - Forcefully unpublish the cli package from the npm registry via the local proxy.
- ๐Ÿ“œ `npm-proxy:republish` - Republish your npm package by first unpublishing it and then publishing it again via the local proxy.

**NVM**

- ๐Ÿ“œ `nvm` - Manage multiple node.js versions. Easily switch between node versions per project to ensure compatibility.

---

### ๐Ÿ“Œ Build

When using the **build.js** file in this boilerplate, it's important to note the significance of the **target** option. By default, if the target option is not specified in the **build.js** file, it will be set to `browser`. However, for projects utilizing the `bun.js` runtime environment, it's imperative to explicitly set the target to `bun`. This guarantees compatibility with the `bun` shell environment and prevents unexpected behavior. Furthermore, it's noteworthy that the `target` supports three possible values: `browser`, `bun`, and `node`, providing flexibility in defining the build target according to specific project requirements.

---

### ๐Ÿ“Œ Similar

You can also check out my other starter projects:

- ๐Ÿš€ [node-boilerplate](https://github.com/RajaRakoto/node-boilerplate)
- ๐Ÿš€ [bun-boilerplate](https://github.com/RajaRakoto/bun-boilerplate)
- ๐Ÿš€ [react-boilerplate](https://github.com/RajaRakoto/react-boilerplate)
- ๐Ÿš€ [next-boilerplate](https://github.com/RajaRakoto/next-boilerplate)
- ๐Ÿš€ [qwik-boilerplate](https://github.com/RajaRakoto/qwik-boilerplate)
- ๐Ÿš€ [vscode-boilerplate](https://github.com/RajaRakoto/vscode-boilerplate)