1.0.4 • Published 3 years ago

random-number-generator-santhosh-sample-package v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

sample-npm-package

This repo demonstrates on how we can create sample npm package and publishing to npm registry

Steps to create new npm package

  • Create the project directory ( mkdir sample-directory )
  • Change into the project directory (cd sample-directory )
  • Initialise a new NPM package ( npm init ) Empty package json will be created
  • Update package.json and project code (index.js)

Steps to push npm package to npm registry

(You should have account created in npm registry if not you can create new account (https://www.npmjs.com/signup)

  • Open command prompt then enter npm login command and provide the login credentials

image

  • run npm whoami to confirm

  • Then run npm publish

image

  • Your new package will be published to your npm registry like mine :)

image

Testing the working of new package

  • Invoke the method we created using below piece of code and click on run button

var randomNumberGeneratorSanthoshSamplePackage = require("random-number-generator-santhosh-sample-package")

console.log(randomNumberGeneratorSanthoshSamplePackage(10,5))

  • I created this package to generate the random number and print it on console.

image

Happy Coding!!

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago