Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Scaffold out Files and Projects from Templates in a Node.js CLI

    javascriptJavaScript
    nodeNode.js
    >=8.0.0

    One of the killer apps of CLIs is with templating (or scaffolding). The rails generate and ng generate commands are famous for this. By immediately reducing the pain of boilerplate, you can also make it easy to write standardized code, with in-place reminders for comments and developer warnings (it is easier to delete generated code than write code, though of course one can overdo it). There is no standardized tooling for doing scaffolding, since you can use everything from the Express.js templating languages to writing your own, but we explore this problem space with the tiny copy-template-dir library to prove out the developer experience of adding scaffolding to your CLI.