helpful libraries and resources for building Node.js CLIs. Not a list of CLIs.
-
12 Factor CLI Apps (Blogpost, Talk): Jeff Dickey's list of requirements for UX.
-
Heroku CLI Style Guide (Guide, Talk, Talk): Heroku's CLI Style Guide.
-
CLI State Machines (Gist): My little thoughts on state management
- Commander: Built by TJ, used in
create-react-app
,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.
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
Loading/Storing config
⚠️ Be aware of the XDG spec. Sindre's libraries useenv-paths
to get paths compliant with this.
- 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
searchPaths
to implement XDG spec compliance. - https://github.com/jonschlinkert/data-store conf like datastore but in the shclinkerverse
- https://npm.im/enquirer (recommended)
- https://npm.im/inquirer
- https://npm.im/prompts
- https://npm.im/email-prompt
⚠️ Your framework may come with parsing built in
- https://npm.im/ora (recommended)
- https://www.npmjs.com/package/cli-ux#cliaction
- http://npm.im/log-update
- https://www.npmjs.com/package/consolidate
- https://www.npmjs.com/package/ejs (Gluegun has this built in)
- https://github.com/amwmedia/plop
- Angular Schematics https://angular.io/guide/schematics
- Yeoman generator https://yeoman.io/
Coloring
- https://npm.im/chalk (recommended)
- https://npm.im/kleur
- https://npm.im/cfonts
Boxing
Tables
*Debug Logging
- https://www.npmjs.com/package/live-plugin-manager
- 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
tmux
like UI - https://npm.im/listr for progress lists
- https://www.npmjs.com/package/cli-ux general Heroku CLI utils including OS notification