DEV Community

Add00
Add00

Posted on

Releasing a Package

Greetings,

With the end of the semester approaching, this weeks assignment was about making our CLI tool available. Since, this project was built in JavaScript it made the most sense to release the package on NPM, the most popular JS registry in the node ecosystem.

To create the release I first made a .npmignore file which would prevent unnecessary files for testing, and documentation from being installed on the users device. This file follows a similar syntax to .gitignore file. Then, I created an NPM account. After that I ran npm login to sign in from the terminal in my project. Before publishing the project to NPM I made sure to tag the current commit with git tag -a v0.9.0 -m "version 0.9.0". So that the project would have a proper version number. Finally, I ran npm publish to make it publicly available on the internet.

To have the code function as a library I had to modify the main.js to export it's function instead of call it directly. This is a more flexible solution as other developers can use the function as they see fit.

Top comments (0)