CLI Workshop
👋 hi there! My name is swyx and this is the source material for the Egghead CLI workshop!!
Pre-Workshop Instructions/Requirements
In order for us to maximize our efforts during the workshop, please do the following:
- Setup the project (follow the setup instructions below) (~5 minutes)
- Install and setup Zoom on the computer you will be using (~5 minutes)
- Watch Use Zoom for KCD Workshops (~8 minutes).
- Read 12 Factor CLI Apps or Watch Rules for creating great developer CLIs (20 mins)
- Write down 2-3 small Node.js CLI's you'd like to explore (points if I haven't heard of them!)
- (Optional) Browse the CLI Cheatsheet
The more prepared you are for the workshop, the better it will go for you.
System Requirements
All of these must be available in your PATH
. To verify things are set up
properly, you can run this:
git --version
node --version
npm --version
If you have trouble with any of these, learn more about the PATH environment variable and how to fix it here for windows or mac/linux.
Structure
- 1 - CLI Basics
- 1A: Create a Hello World Single-Command CLI with Oclif
- 1B: Parse Arguments and Flags in an Oclif Command
- 1C: Understand when to use Multi-Command vs Single-Command in Oclif
- 1D: Set up Debugging and Testing for CLI's
- 2 - Heavy Lifting
- 2A: Beautiful Prompts for User Input with Enquirer
- 2B: Read User Config with Cosmiconfig
- 2C: Build Your Own Boilerplate Scaffolding CLI with Copy-Template-Dir
- 2D: Execute and Pipe Child Processes with Execa
- 3 - Polish
- 3A: Prompt Users to Update CLI Versions with Update Notifier
- 3B: Store State on Filesystem in CLI's respecting XDG-spec with Conf
- 3C: Create CLI's that Intelligently Adapt to Usage with Frecency
- 3D: Polish CLI Output with Ora, CLI-UX, and Chalk
- 4 - React Ink
- 4A: Build Interactive CLI Components with React Ink
- 4B: Create Flexible CLI Layouts with React Ink's Box Component
- 4C: Create Dynamic Command Line User Interfaces with React Ink Input Components
License
MIT