DEV Community

Alexander Samaniego
Alexander Samaniego

Posted on

Lab 10: NPM Package Release

This week in my open-source course (DPS909), for our last lab, we were asked to publicly release our static site generator (SSG).

Release Process

The package registry I choose to release my project on was npm.

To add my package to the registry I essentially just followed this guide. I had already done most of the steps, all I needed to do was create a npm account on the website then use npm publish to add the package to the registry. However, I still needed to create a release for my project before using npm publish.

To create the release I used the command npm version <version number>. This updates the version number in package.json and tags the release. I then used the command git push --follow-tags to push the tags to the GitHub repo. Once the release is tagged and pushed to GitHub, then the command npm publish can be used to publish the package to the registry

These steps are repeated for every update to the package.

This process was rather simple as I had already completed most steps while creating the project. The tricky part was not realizing the command npm version <version number> also tags the release. So I was manually attempting to tag the release and getting errors telling me that the tag already exists. This had me stumped for bit until I realized it was because the command also adds the tags.

User Testing

I had another student in the course test my npm package on their local machine. The only issue encountered was during the setup process. Their machine didn't recognize the ssg command that I used for the package. So I had to adjust the instructions to have the package be installed globally. I changed npm install ssg-cli-tool to npm install -g ssg-cli-tool. Once that change was implmented and the user installed the package globally, it worked as intended.

The Final Release

Here is the final package release: https://www.npmjs.com/package/ssg-cli-tool

To install this package, in the terminal input the command:

npm i -g ssg-cli-tool
Enter fullscreen mode Exit fullscreen mode

Then run it using on a text or Markdown file by using this command:

ssg -i <filepath of txt/MD file>
Enter fullscreen mode Exit fullscreen mode

Follow the instructions in the README.md file for more options.

GitHub Repo: https://github.com/alexsam29/ssg-cli-tool

Top comments (0)