DEV Community

Ririio
Ririio

Posted on

2

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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay