It is a quick starter for CLI tools written in Node. Typescript, Prettier and Eslint configuration included.
- Clone the repo
- Change all that you need in the package.json files
- Reuse the scaffold and write your CLI logic
npm install
npm run build
npm link
cli-tool-starter log
cli-tool-starter -v
The cli-tool-starter
is the name of your cli tool. Change it in the package.json file. In two places:
(...)
"name": "cli-tool-starter",
(...)
(...)
"bin": {
"cli-tool-starter": "./build/index.js"
},
(...)
After changes, rebuild the tool using npm run build
.
npm login
npm publish
Configuration using cosmiconfig.
The starter uses the cosmiconfig. You can create, for example, .clitoolrc
file and add there:
{
exampleQuestion: "What is the name of your dog?",
exampleAnswer: "Good dogo"
}
Then if the script will run in the same place as the config file, it will use these values instead of default ones.
You can configure the name for the config files in config.ts
file.
npm run dev:prettier
npm run dev:lint