A template repository for CLI tools based on Typescript and CommanderJs.
Features
- Test setup with Jest
- Eslint setup with airbnb defaults and prettier
- Setup with Yarn
- Builds for multiple targets cjs, esm and esnext
- Github Actions CI Pipeline for testing and publishing
- Clone the template via the Use this template button or by clicking here.
- Search for "TODO" in the project and adjust everything applicable, and replace "{NAME}" with your project name
- (optionally) Add a secret to GitHub with the name
npm_token
to allow NPM releases - (optionally) enable packaging an exported CLI via
pkg
if enabled in the CI file - remove or adapt from the following sections to adjust to the package
Install globally via
npm install -g {NAME}
or directly use via
npx {NAME}
Usage:
Usage: npx {NAME} [options]
Options:
-V, --version output the version number
-s, --small small pizza size
-p, --pizza-type <type> flavour of pizza
-h, --help display help for command
Install the package
npm install {NAME} --save
# or
yarn add {NAME}
Import the package and use it
import {NAME} from '{NAME}'
render(
<{NAME}
myProp={42}
/>
)
yarn
to install dependenciesyarn start
to run in dev modeyarn test
to run testsyarn lint
to test and fix linter errors
To publish a new version, the publish pipeline can be manually
invoked, or run yarn publish
.