An Interest In:
Web News this Week
- March 13, 2024
- March 12, 2024
- March 11, 2024
- March 10, 2024
- March 9, 2024
- March 8, 2024
- March 7, 2024
Publishing my first package
This week, I've published my 1st package on npm - mh-ssg - a static site generator CLI.
The process is not complicated and only involves 4 steps:
1. Configure the package
In the package.json
, I need to make sure that I have all the required information filled: name
and version
. When the package is first published, usually it should be version 1.0.0.
2. Publish the package
In order to publish package on npm, I had to first create an account on the website. Then log in from the command line with:
npm login
After successfully logging in, I can publish the package with:
npm publish --access public
3. Test the package
I asked my friend for help to test the package I just published. She was able to install the package but when she tried to run it, she found a bug and noticed that README.md
was outdated. Following her feedbacks, I fixed the bug and updated README.md
with more instructions on how to use the tool.
4. Update the package
When all the bug fixes were in place, I updated the version in package.json
with any related test cases, committed those changes and did a final npm publish
.
Now mh-ssg is available on npm and ready to be used by the community. The tool can be installed with the simple command:
npm i mh-ssg
Original Link: https://dev.to/minhhang107/publishing-my-first-package-1pf3
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To