DEV Community

suhhee1011
suhhee1011

Posted on

Create NPM Package - feat. last lab

This is the last blog post for this static page generator program. For this lab, I need to release my program online. I used NPM to publish my program as a package.

These are the detailed steps:

  1. Create an account in NPM(Verify email before publishing the package)
  2. Remove "Private: true" in package.json.
  3. Type the command "npm publish" and done!

Actually, I thought the process to create an npm package is more complicated and only allowed for some highly skilled developers. However, I was surprised with the npm package upload process cuz it's really simple which consists of a few steps.

After I published I need to update a few times to make it work.
v.1.0.0 - This was the first version that I published
v.1.0.1 - added testing scripts.
v.1.1.0 - I accidentally commented import statement. I uncommented the line.

// import arg from "arg";
Enter fullscreen mode Exit fullscreen mode

v.1.1.1 - fix a bug in the program.

fs.unlink(`./dist/${filelist[num]}`,(err=> {
                     console.log(err);
                  }));
Enter fullscreen mode Exit fullscreen mode

v.1.1.2 - Readme.md edited based on the partner's feedback and added a description of how to download the npm package.

I asked my friend to test the npm package. And download and running simple commands like version and help were going well. However, when she put the file in the main folder and tried to create the HTML file from the txt file. there was some problem that the program could not find the txt file. So, I tried to figure out what is the problem.
And I got the reason why the program could not find the file. This is because I set a path for finding files in the folder called "docs" and she uploaded the file to the root folder. So, I added a step on the instruction of NPM on the README.md to create a folder named "docs" and upload files in it. I also think about removing the path and letting them upload on the root. But reason, why I created a separate folder to upload the files and folders, is to make it clean. So, instead of removing the path I just add one more simple step to set instructions.
This is the edited instruction on how to download and use the project.

How to install

  1. Download npm package -> npm i -g create-ssg
  2. Create folder named "docs"
  3. Put all the files and folders that you want to convert to HTML
  4. Run the commands(Detailed instructions are in the NPM package instruction or in my GitHub Project page)

Top comments (0)