It was an exciting experience whenever you create something for the first time. For me, it is my first NPM package and also my first Open source contribution. In this article, I will describe how easy to publish NPM Package.
Step 1: npm account
Step 2: Login
We will use Console or Terminal to Login
$ npm adduser or npm login
You’ll get a prompt for your username, password, and email.
Logged in as username to scope @username on registry.npmjs.org.
Step 3: Let’s make a package
Create a Folder$ mkdir directory_nameCreate a File - Package.json inside the folder$ cd directory_name$ npm init Edit the name in package.json
{
"name": "@username/number-system-converter"
}
Note: username: Your NPM username prefix with the '@' symbol
COPY
Step 4: Publish Package
npm publish — access=public — first time
npm publish — for update
If everything goes well You will see
+@username/packagename@1.0.0