This is intended to be a starter template repo for creating CLI programs with Typescript. The template project uses commander.js as the library for wiring up the CLI commands and comes with Typescript, ESLint and Prettier preconfigured. The ora library is also preinstalled for showing spinners.
- Use GitHub's "Use this Template" feature to genrate your own repo from this one.
- Clone your repo locally
- Install dependencies
yarn install
- Edit the
package.json
file to update thebin
links to change the name of the generated binary to suit your needs.
"bin": {
"test-prog": "./dist/index.js"
}
- Run the build command to transpile the Typescript to Javascript. This will output to the
./dist
folder.
yarn build
- To enable running CLI commands locally link the project to your global NPM folder. This must be done with
npm link
sinceyarn link
does not linkbin
files.
npm link --no-package-lock
- If you rename or add additional
bin
files, you will need to unlink and relink your project.
npm unlink
npm link --no-package-lock