Publishing a Node Module

I created and published a command line tool to generate my Models and Controllers for a SailsJS API.

The process is the same as writing anything for node but requires the following at the top of the main script.

#!/usr/bin/env node

And the following addition in the package.json file.

"preferGlobal": true,
"bin": {
"commandlineCommand": "./bin/mainScript.js"

Commit the project to github or another repository and publish to using the following commands.

npm set "Your Name"
npm set ""
npm set ""
npm adduser

npm publish ./


Leave a Reply

Your email address will not be published. Required fields are marked *