How to create and publish NPM Packages


1. npm init
2. Enter Following Description
package name: (new-hello) mi-hello-new-world
version: (1.0.0)
description: This hello world package
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to C:\Users\Pukar\Desktop\new-hello\package.json:

{
  "name": "mi-hello-new-world",
  "version": "1.0.0",
  "description": "This hello world package",
  "main": "index.js",
  "scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes) yes

3. npm adduser
4. npm login
5. npm whoami
6. create a file "index.js"
module.exports.area =  radius => Math.PI*radius*radius;
module.exports.perimeter =  radius => 2*Math.PI*radius;

7. npm version 1.0.0
8. npm publish

Check your npm repogistory.
Share on Google Plus

About Ram Pukar

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment