helpful libraries and resources for building Node.js CLIs. Not a list of CLIs.
CLI Design Thinking
CLI State Machines (Gist): My little thoughts on state management
- Commander: Built by TJ, used in
vue-cli, and many others. Key feature: pluggability. Vorpal is another framework inspired by Commander and is seeking maintainers
- Oclif: Built by Heroku, used in Heroku and Salesforce CLI's. Key feature: pluggability.
- Sade: Built by lukeed, used in tsdx. Key feature: lightweight?
- Gluegun: Built by Infinite Red, used in Ignite and AWS Amplify. Key feature: templating/filesystem
- Ink: Built by Vadim & Sindre. Key Feature: React Components and Yoga Layout.
- Scritch: Built by Jamie, used at Eventbrite. Key Feature: compose multiple scripts regardless of language into one CLI.
- Yargs: Built by bcoe, used by
nyc, and 14,343 other modules.
- arg: Built by ZEIT, used by
serve, and many others. Key Feature: tiny
Context from filesystem/PATH
- https://github.com/npm/node-which Like running
which: Find the first instance of an executable in the PATH.
- https://github.com/szwacz/fs-jetpack filesystem access
- https://github.com/sindresorhus/find-up search up the parents path for where files are located
- https://github.com/sindresorhus/conf simple config storing (maybe try conf-cli to manipulate if needed) the successor to configstore
- https://github.com/davidtheclark/cosmiconfig Find and load configuration from a package.json property, rc file, or CommonJS module. Check
searchPathsto implement XDG spec compliance.
- https://github.com/jonschlinkert/data-store conf like datastore but in the shclinkerverse
- https://npm.im/enquirer (recommended)
⚠️Your framework may come with parsing built in
- https://npm.im/ora (recommended)
- https://www.npmjs.com/package/ejs (Gluegun has this built in)
- Angular Schematics https://angular.io/guide/schematics
- Yeoman generator https://yeoman.io/
- https://www.npmjs.com/package/pacote (used in npm cli)
- https://www.npmjs.com/package/gh-release-fetch (very low level pull from github)
⚠️None of these are offline-first. Keen on finding one that respects offline first.
- https://npm.im/stmux for
- https://npm.im/listr for progress lists
- https://www.npmjs.com/package/cli-ux general Heroku CLI utils including OS notification
- https://github.com/jeroenouw/cgx Generate all the recommended files (pre-filled) for the Github community standards. (Issue templates, code of conduct, etc)