A template repository for CLI tools based on Typescript and CommanderJs. Features
- Test setup with AVA
- Prettier setup
- Setup with Yarn
- Commander code template that automatically reads the version from the package.json file
- Dev
yarn startcommand withts-node - Bundles native executables with
pkgfor Windows, Mac OS and linux - Github Actions CI Pipeline that
- builds app and runs tests
- checks prettier
- bundles app into native binaries and deploys them as a GitHub release
- deploys the package to NPM
Example repo: https://github.com/lukasbach/json-extract-path
- Clone the template via the Use this template button or by clicking here.
- Add a secret to GitHub with the name
npm_tokento allow NPM releases - Push tags with the format
v0.0.0to automatically publish new releases.
Install globally via
npm install -g {TOOLNAME}
or directly use via
npx {TOOLNAME}
You can also download a prebuilt binary and run that.
Usage:
Usage: npx {TOOLNAME} [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
yarnto install dependenciesyarn startto run the CLI script for debuggingyarn testto run testsyarn prettier:checkto verify that your code is prettyyarn prettier:writeto make your code pretty
Don't manually publish the package to NPM! You can just tag
a commit with a new release tag (remember to bump the version
in package.json) and push the changes, a Github Action
will deploy the new version to NPM.