README
typescript-cli-template
example multi-command CLI built with typescript
Give it a name
Here this can be found as typescript-cli-template
Define a command
Here this can be found as typescriptclitemplate
Set the version
Ensure the version in package.json is 1.0.0 as a starting point.
Subsequent versions should be bumped using the appropriate npm scripts.
Make it a github repo
See here.
Here this can be found as AlexJeffcott/typescript-cli-template
Set up codecov.io
See here.
This is very easy to set up - just create an account, or login, link the repo and copy the token.
Put it in CI/CD
See here.
This project uses circleci. This is very easy to set up - just create an account, or login, link the repo and tell it to use the config that already exists.
Go to project settings/Environment Variables and add CODECOV_TOKEN with the token gleaned from codecov.io above.
Make it an npm package
Here this can be found as @alexjeffcott/typescript-cli-template
NB this must be unique in npm registry, otherwise you will get confusing/misleading error messages.
Sign in to npm and publish
You must have an npm account, and the user must be able to create/publish packages.
Usage
$ npm install -g @alexjeffcott/typescript-cli-template
$ typescriptclitemplate COMMAND
running command...
$ typescriptclitemplate (-v|--version|version)
@alexjeffcott/typescript-cli-template/1.1.0 darwin-x64 node-v12.18.3
$ typescriptclitemplate --help [COMMAND]
USAGE
$ typescriptclitemplate COMMAND
...
Commands
typescriptclitemplate goodbye [FILE]typescriptclitemplate hello [FILE]typescriptclitemplate help [COMMAND]
typescriptclitemplate goodbye [FILE]
describe the command here
USAGE
$ typescriptclitemplate goodbye [FILE]
OPTIONS
-f, --force
-h, --help show CLI help
-n, --name=name name to print
See code: src/commands/goodbye.ts
typescriptclitemplate hello [FILE]
describe the command here
USAGE
$ typescriptclitemplate hello [FILE]
OPTIONS
-f, --force
-h, --help show CLI help
-n, --name=name name to print
EXAMPLE
$ test-npm-cli hello
hello world from ./src/hello.ts!
See code: src/commands/hello.ts
typescriptclitemplate help [COMMAND]
display help for typescriptclitemplate
USAGE
$ typescriptclitemplate help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help