Home > Web Front-end > JS Tutorial > body text

Explainer.js Release .�

Barbara Streisand
Release: 2024-11-22 22:37:35
Original
806 people have browsed it

Explainer.js Release .�

This week we have to implement versioned relase and publish it to npm.

Clean Up

Right now I run the application via node index.js which is inconvenient when you are using it like a npm package running under node. So, the first step was to ensure it can run with explainer --args. So I had to make some adjustments.

Research

Next step was to do do some research on how I can upload my project on npm. First resource I came across was how I can unscoped public packages. Looking through the steps everything seemed to be done. Then I noticed the section about .npmignore to exclude files that I don't want to publish to npm. And finally I'm supposed to run npm publish.

So I did some research on .npmignore. And I found this part in the docs on what files I should exclude. So I made my .npmignore. I also took the opportunity to update my README.md to reflect how I'm supposed to install the package and updated the usage of my tool as well. Next I ran

npm publish
Copy after login
Copy after login

But I got an error saying I should run

npm adduser
Copy after login

Normally that would open the browser to login from the browser. Since I'm using WSL I had to find a way to login via ternimal. So, I found this Stackoverflow thread. In short, to login via terminal run

npm login --auth-type legacy
Copy after login

After I ran

npm publish
Copy after login
Copy after login

And my application was published.

Testing

For my testing I choose someone that is not taking the course. We hopped on a call and I gave him the npm link. First issue he faced was two different installation script. One generated by npm and what I wrote npm i explainer.js vs npm install -g explainer. Next, when running inside a project it works fine. But the issue was it reads the package.json from the current directory. So it was reading package.json from his project. Cause it was showing version of his project instead the one in my package.json. And if opened just from a terminal it'd crash. So I went back to my code and realized the issue of reading package.json. So I had to make some adjustments and it was extra difficult since I cannot use __dir since I'm using ESM. So I had to look up how to make it work under ESM. After the fix I updated the README.md again and pushed and released released another version. This time it went perfect and there was no issue.

Release 0.1.0 ?

And finally (drumrolls please), Explainer.js is out for everyone. Checkout it out @ https://www.npmjs.com/package/explainer.js

The above is the detailed content of Explainer.js Release .�. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template