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 start
command withts-node
- Bundles native executables with
pkg
for 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_token
to allow NPM releases - Push tags with the format
v0.0.0
to 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
yarn
to install dependenciesyarn start
to run the CLI script for debuggingyarn test
to run testsyarn prettier:check
to verify that your code is prettyyarn prettier:write
to 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.