Book Image

Learning Yeoman

By : Jonathan Spratley
Book Image

Learning Yeoman

By: Jonathan Spratley

Overview of this book

Table of Contents (17 chapters)
Learning Yeoman
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Modern Workflows for Modern Webapps
Index

The new CommonJS project


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!

Installing the generator-commonjs

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.

Scaffolding a CommonJS project

To scaffold a new CommonJS project, open a terminal and do the following steps:

  1. 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.

  2. Then, invoke the Yeoman generator inside the projects directory using the following...