

Publishing my package to NPM
source link: https://dev.to/tuanthanh2067/publishing-my-package-to-npm-4f22
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Introduction
Hello everyone, my name is Dustin. Today, I'd like to talk about my experience of publishing my static site generator to NPM. It's quite a fun experience as I finally made my project up and running in public.
Process
I've used this as instruction to publish it to NPM.
You can check it out here
Because I already built my project for quite a long time so, I can skip most of the steps, and just focus on this step and some steps that help me understand the semantic versioning and dist-tags.
When I first start using command line npm publish
to publish the project, I had to sign up and log in to NPM. But I encountered an error where it said something like this
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/cv-ssg - Forbidden
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.
As it stated right there, the error code is 403 which means it involved sign up or log in part. After a few minutes, I just realized that I forgot to verify email. So just make sure that if this is your first time publishing a project to npm, you have your email verified.
While working with updating version stuff, I also had to delete e2e snapshot file and run it again because when I changed the version in the package.json
, and pushed the repo to github, the github action won't be happy. I'm not sure if I'm doing the right way that other people do. If I don't, please show me. Thank you.
I tried to test it as a client's perspective by installing Nodejs and then I do npm install -g cv-ssg
to install it globally so that I can run it anywhere I like. As expected, it worked very well, I got no error. Or maybe I'm just testing the bright side of the project.
In order to tackle that problem, I got one of my friend who is also a student of this course to test it out on his computer. Fortunately, he also ran it successfully a few times using cv-ssg
command.
Wrap up
For this lab, it didn't require us to code anything as this is like a final step for the project, not quite the final one because if the project is delivered to end users and they found bugs or errors. It needs to be fixed and published again. The cycle keeps going and going.
Recommend
-
7
Spiderable middleware Google, Facebook, Twitter, Yahoo, and Bing and all other crawlers and search engines are constantly trying to view your website. If your website is built on top of the JavaScript framework...
-
6
Developing and publishing a TypeScript NPM packageWe’ll also cover unit testing, test coverage, and code analysis
-
19
Automating package publishing in JavaScript projects 02/12/21 by
-
17
Introduction Are you a software developer? And you started to use npm and curious what is package.json file? If you’re a bit intimidated by the command line when using npm, don...
-
5
4 NPM Alternatives: Best JS Package Managers and Publishing ToolsFor years every JS developer worked daily with packages installed using NPM client, often from the NPM registry or an organization’s private regist...
-
5
-
6
The Project Eleven weeks ago when I started in Open Source Development 600 at Seneca I never thought I would get to the point of actually releasing something into the wild. Over the term we have been working on our individual...
-
7
Vivian Posted on Nov 27
-
3
New npm features for secure publishing and safe consumptionNow you can create tokens with fine-grained permissions for automating your publishing and organization management workflows. And a n...
-
11
13 Decisions to Make Before Publishing JavaScript to NPM March 30, 2023 This post is half rant, half guide. Each of these 13 questions reveals tradeoffs that take time and mental energy to rese...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK