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.jsonfile to update thebinlinks 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
./distfolder.
yarn build- To enable running CLI commands locally link the project to your global NPM folder. This must be done with
npm linksinceyarn linkdoes not linkbinfiles.
npm link --no-package-lock- If you rename or add additional
binfiles, you will need to unlink and relink your project.
npm unlink
npm link --no-package-lock