How to kick-start a new NodeJS module
Tuesday, Nov 11, 2014 19:55 · 178 words · 1 minute read
The Goal
The goal of this blog is to describe how to create a new NodeJS module.
The Installation
You should clone the nodejs-module-init GitHub repository to kick-start a new NodeJS module:
git clone https://github.com/damyanbogoev/nodejs-module-init.git
Go to the nodejs-module-init folder and install the module dependencies:
cd nodejs-module-init
npm install
One last thing to do is to remove the .git folder and modify the README.md file accordingly, so that it describes the new NodeJS module.
The Setup
The NodeJS module template uses Grunt and Mocha for automation and testing. To be able to execute the Grunt tasks you should install the grunt-cli and mocha packages globally:
npm install grunt-cli -g
npm install mocha –g
Helpful information regarding the Grunt tasks used internally by the module template can be found here. Now you are ready to start working on your new NodeJS module. You could run the grunt tool with the default task which will watch for changes in your module and in case of such – to run JSHint over the js files and execute the Mocha tests.
grunt