1.0.1 • Published 3 years ago
gzip-br-size v1.0.1
cli-starter
A command line tool template.
Try it now!
Create repo from this template on Github
Or:
$ npx degit peterroe/cli-starter my-cli
$ cd my-cli
$ git init
$ pnpm i # npm install -g pnpmDevelopment
Modify package.json
{
- "name": "cli-starter",
+ "name": "my-cli",
"bin": {
- "cli-starter": "./bin/index.mjs"
+ "my-cli": "./bin/index.mjs"
},Then you can link your cli tool to global
$ pnpm stub
$ pnpm link --globalExample
This command will help you understand how cli tool works:
$ my-cli -h # show help
$ my-cli -v # show version
$ my-cli lint one two --name peterroe # demo usageAnd then you can rewrite src/index.ts to what you want
Here are some projects that use cli-starter: renames、tind
More usage about cac please see cac
Build && Publish
Build it:
$ pnpm buildPublish to npm:
$ git remote add origin xxx # make sure you have bound a repo
$ git push origin main
$ pnpm release # or npm publish directlyTry yourself!
Install your own command line tool:
$ npm install -g xxx
$ xxx -h
$ xxx -vThen use it...
1.0.1
3 years ago