=> Create account in npmjs.com. => Create git for your package:
https://github.com/ravikumar181094/otp.git
=> Create Package
npm init
- Unique package name
rv-otp-generator
- Version
1.0.0
- Description
To generate OTP
- Entry Point
index.js
- Git repository
https://github.com/ravikumar181094/otp.git
- Keywords
otp, otp-react
- Author
Ravi Kumar
- License
ISC
=> Add type
as module
in package.json
"type" : "module",
=> Create /index.js
file for Bussiness Logics.
=> Login node package manager using below command.
npm login
- Enter username
ravikumar181094
- Enter password
**********
- Enter public email
ravikumar181094@gmail.com
- Enter
OTP
which received from you email
=> Check your npm login
npm whoami
=> Publish our package using npm publish
=> App Successfully Published
=> You can see the packages under npmjs account -> Profile -> Packages
=> Initialize git
git init
git remote add origin https://github.com/ravikumar181094/otp.git
git add .
git commit -m "initial commit"
git push -u origin master
npm version 1.0.1
npm publish
=> Install our packages
npm i rv-otp-generator
import generateOtp from 'rv-otp-generator'
=> call using generateOtp(6)