Using the Yeoman CommonJS generator, we will create a reusable module that can be consumed by other projects. This module will contain methods to perform CRUD (create, read, update, delete) operations. Let's get started!
To install the CommonJS generator, open a terminal and execute the following command:
$ npm install -g generator-commonjs
The preceding command will install the CommonJS generator globally on the system. You can use the yo commonjs
command, which can be invoked anywhere.
To scaffold a new CommonJS project, open a terminal and do the following steps:
First, create the directory where the project is going to live, replace the
jps
attribute with your initials, and execute the following command:$ mkdir jps-ds && cd jps-ds
The preceding command will create a new folder and make it the current directory.
Then, invoke the Yeoman generator inside the projects directory using the following...