DEV Community

Bregwin Jogi
Bregwin Jogi

Posted on

4 1 1 1 1

How to publish your node.js package to NPM

I recently added my node.js console application RefactorCode to NPM to make it easier for users to install the application without cloning the repo. It was surprisingly simple and I have laid out the steps below:

You need to first create an npmjs account from here: https://www.npmjs.com/

Image description

Once that's done, go to the root directory of the project, and type:

npm login
Enter fullscreen mode Exit fullscreen mode

This will take you to the login page and after being successfully authenticated, type npm publish to push the project to NPM:

Image description

And that's it!

Here is my package if you are curious:
https://www.npmjs.com/package/refactorcode


Other stuff

I made a release for the application by tagging a release:

git tag -a v1.0.1
Enter fullscreen mode Exit fullscreen mode

And the pushing it to github:

git push --follow-tags
Enter fullscreen mode Exit fullscreen mode

I also tested if others were able to access the application by asking my brother to try installing it, he was able to set it up from NPM pretty easily after looking at the README file.

Image description

Although, it is a bit harder compared to normal packages since you have to specify environment variables for the API key, but the screenshots helped.

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (1)

Collapse
 
nozibul_islam_113b1d5334f profile image
Nozibul Islam

Great sharing this post..

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more