Creating NPM Modules

In notebook:
FrontEndMasters Real-Time Web with Node.js
Created at:
2015-10-13
Updated:
2015-11-06
Tags:
JavaScript backend
Video Course on Real-Time HTML5 with Node.jsecosystem of modules

to create a package to publish to npm

need to create a package.json that has to be in the directory of the module file.
usually you create it in a separate directory

best to take an example file and start from there:
  {
   "name": "helloworld",
   "version": "0.0.1-a",
   "description": "hello world",
   "main": "./helloworld3.js",
   "keywords": [
      "hello",
      "world"
   ],
   "author": "Kyle Simpson <getify@gmail.com>",
   "license": "MIT"
}
it has to be a valid JSON file (keys must be surrounded in quotes,string values and arrays

​name​ it must be unique
​version​ it must be manually versioned. semantic versioning major, minor, patch, and a fourth level for trivial updates e.g. documentation update
functional change: patch
once you publish a version, we have to bump the version up
if you make API changing version: minor or major 
major is when you rewrite the whole
​description​ not required but very useful
​main​ main entry point for the module 
​keywords​ not obligatory 
​author​ and ​license​ - definitely 
​repo​ link to your github repo, where people can file bugs
​dependencies: {
  "minimist": "~0.0.8"
}​  the ​~​ means patch updates (most typical use)


then we can do ​npm publish​ 
  function vvvv(){
    ddd
}