Why are readme files useful?
The readme file tells users about your project. It contains the license, installation and testing information, FAQ’s, contact information and more. This file gives the user all they need to know about the project. You can add a few images and videos to show how the code works.
There are readme file generators online like this one – https://www.makeareadme.com/ which make it easy to create a readme file. A generator can take care of the markdown and the sections. You will only need to enter the content specific to your project.
I created a readme file generator using JavaScript as part of the coding bootcamp. You can download this code and use it to create quick readme files for your projects. You can find the code here – https://github.com/cguntur/readme_generator
Creating the generator using Node.js
I used inquirer to create prompts for the user input. Inquirer.js is an embeddable command line interface for Node.js. Inquirer helps you create command line options to our code. We can add options like text, select, checkboxes etc..
When you run the program, there is an option to enter the file name. You can give your readme file any name. I used process.argv
to get the filename from the command line. process.argv
is used to interact with the command line arguments in node. It is an array that contains the command line values. The first element in the array is the absolute path to the Node. The second element is the path to the file that’s currently running and finally any command-line arguments provided when the process was initiated.
The readme file generator provides the user with options for the description of the project, Installation instructions, usage information (which will have the details about how the code can be used), contribution guidelines, test instructions , license information and contact information. When a license is selected, a license badge is also displayed on top of the generated readme file.
The email and the github profile of the author can be included at the end in the Questions section. If you do not want to add content to any particular section, you can skip by entering and go to the next prompt.
Here is a screen recording of how the program works.