{"id":94,"date":"2015-02-05T22:24:38","date_gmt":"2015-02-05T22:24:38","guid":{"rendered":"https:\/\/www.tech.shinynewthings.com\/?p=94"},"modified":"2015-02-05T22:24:38","modified_gmt":"2015-02-05T22:24:38","slug":"publishing-a-node-module","status":"publish","type":"post","link":"https:\/\/www.tech.shinynewthings.com\/?p=94","title":{"rendered":"Publishing a Node Module"},"content":{"rendered":"<p>I created and published a command line tool to generate my Models and Controllers for a SailsJS API.<\/p>\n<p>The process is the same as writing anything for node but requires the following at the top of the main script.<\/p>\n<p><code>#!\/usr\/bin\/env node<\/code><\/p>\n<p>And the following addition in the package.json file.<\/p>\n<p><code>  \"preferGlobal\": true,<br \/>\n  \"bin\": {<br \/>\n    \"commandlineCommand\": \".\/bin\/mainScript.js\"<br \/>\n  }<br \/>\n<\/code><\/p>\n<p>Commit the project to github or another repository and publish to npmjs.org using the following commands.<\/p>\n<p><code>npm set init.author.name \"Your Name\"<br \/>\nnpm set init.author.email \"email@email.com\"<br \/>\nnpm set init.author.url \"http:\/\/www.projectWebsite.com\/\"<br \/>\nnpm adduser<\/p>\n<p>npm publish .\/<br \/>\n<\/code><\/p>\n<p>Finished.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. &#8220;preferGlobal&#8221;: true, &#8220;bin&#8221;: { &#8220;commandlineCommand&#8221;: &#8220;.\/bin\/mainScript.js&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-94","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.tech.shinynewthings.com\/index.php?rest_route=\/wp\/v2\/posts\/94","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tech.shinynewthings.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tech.shinynewthings.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tech.shinynewthings.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tech.shinynewthings.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=94"}],"version-history":[{"count":3,"href":"https:\/\/www.tech.shinynewthings.com\/index.php?rest_route=\/wp\/v2\/posts\/94\/revisions"}],"predecessor-version":[{"id":97,"href":"https:\/\/www.tech.shinynewthings.com\/index.php?rest_route=\/wp\/v2\/posts\/94\/revisions\/97"}],"wp:attachment":[{"href":"https:\/\/www.tech.shinynewthings.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tech.shinynewthings.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tech.shinynewthings.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}