Plan a Node.js CLI Tool Project with README Driven Development

Share this video with your friends

Social Share Links

Send Tweet
Published 2 years ago
Updated 2 years ago

With any project that you start, a great way to plan it out is through README Driven Development. This means you write out all that you want to accomplish in your project README before doing anything else.

We will do just that, we will discuss what commands we want to be able to run and what we need to do to accomplish that functionality.

Kevin Cunningham: [0:00] There are many ways to plan a project, but for me, writing the readme first helps to make sure that any work I do is focused on what I want to achieve. I'm creating an app called quizme. This is going to be a CLI tool that will help to test knowledge.

[0:15] I want to think about how I expect to use this tool. I'm going to expect that I can run quizme as a command, and that will ask me a question, evaluate the answer, or have me self-evaluate, and then log the results in some way.

[0:34] On the other side, I'm going to expect that I can add questions. I'm going to expect that to start a dialogue, ask me for a question, ask me for the answer, and then store them for future uses.

[0:48] This is what my CLI tool is going to look like. As I look at this, I think about different technologies I want to use. I see that I'm going to need to be able to parse arguments. There are lots of ways to do that. There are internal ways to Node. I might have to write some custom logic, or I might lean on a third-party library.

[1:05] There's the ability to be able to ask questions and be able to wait for responses and evaluate responses and, equally, to ask questions and evaluate responses here. That again, I could write that logic and functionality from scratch, or I could look for a third-party library to help me with that.

[1:22] Then there's the storage, both the logging of the results to getting the questions, the storing the questions for future uses. I'm getting an idea of what I think I'm going to need. What do I need?

[1:31] I need to parse arguments. I need to be able to have an interactive command line where I listen for responses from the user and do something with it. I need to be able to persist my data. For now, I think I'll use JSON. That means Reading/Writing from the file system.

[1:49] As I look up and I think, "Is there anything else I want to do?" Well, I want just to use quizme. That means, I'm going to need to find a global script. I don't want to have to run this as a Node packet. I want to just be able to run it as a global script. That's going to be something different.

[2:04] Evaluating answers, I need to decide, am I self-evaluating or auto-evaluating? With this readme in hand, I can jump into starting to develop my command line tool, exploring some of these concepts, and making this as useful as

egghead
egghead

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today