DEV Community

Ririio
Ririio

Posted on

Releasing package to npm

Which release tool and package registry did you choose? Provide links to everything you mention.
What was the process for creating a release? Be detailed so that other developers could read your blog and get some idea how to do the same.
What did you learn while doing your release? Did you have any "aha!" moments or get stuck?
How much did you have to alter your code, files, build, etc. to use the chosen package format and registry?
How did the User Testing session with your partner go? Describe what it was like, where they got stuck, and how you corrected the problems.
How do users install and use your project now that it has been released? Provide links and some instructions.

Throughout my time writing and updating my static-site generator, I've been using npm from the very foundation I use an npm package called commander. Therefore, it is obvious that for the tool that I will be using to publish my ssg, I will do so with npm.

Process

Creating a release is fairly simple, as long as you understand the standard for creating a website like having a README and package.json, you should be able to publish your package online--knowing how to use tag should ensure that when publishing a newer version there will not be any complication, because as far as I know, you can't publish similar version of your package.

Testing

The testing procedure took quite a bit of time to finish. We got stuck with not being able to run the command after installation; this was solved after we did an npm link. Afterwards, when running the command, we got stuck at being unable to do any other commands aside from --version and --help; we then realized that we didn't have a .env file that contains the value that is required to run all of my commands.

I realized when I had my friend install my package, that the function trim wasn't working as intended. It took me a long time to figure out what's wrong, and even decided to hand in my lab unfinished, but I asked around and was told about optional chaining which is something I have never heard of, but it ensures that trim won't run when the line given isn't undefined, which it was at the end of the .txt file

Instructions

I posted the instructions on the README of the package so it can be viewed from there, but here's how it should be installed:

  1. Open the consolde and install the package by typing npm install ririio-ssg
  2. Create a connection between the package and your current project folder by typing npm link ririio-ssg
  3. Create a file on your main directory called .env, this is used to store value of your output folder and current language
  4. Inside .env paste this line of code OUTPUT_DIRECTORY="dist" followed by HTML_LANGUAGE="en-CA" on the line beneath

Top comments (0)