DEV Community

CDPhu
CDPhu

Posted on

Software Release Via NPM

For this lab, I have chosen to release my tool via the use of NPM.

Preparation before publishing

Create a package.json file if you don't have in the root directory.
Use this npm init to create the new package.json file.

A package.json file:

  • Lists the packages your project depends on
  • Specifies versions of a package that your project can use using semantic versioning rules
  • Makes your build reproducible, and therefore easier to share with other developers
  • Make sure to add the name, version and author in your package.json file.

ADD a README.md file to a package:

  • In a text editor, in your package root directory, create a file called README.md.
  • In the README.md file, add useful information about your package.
  • Save the README.md file.

Publish your release:
-Make sure you have created the account npm and verified it.

  • Use the npm login on your terminal. Login with your username and password.
  • Use npm publish --access public to create and publish scoped public packages.

Note: Update types
Each digit in the version has it's own meaning:
1) First digit means major release.(resetting two later digit to zero)
2) Second digit means minor change in the software(resetting last digit to zero)
3) Last digit means a patch release.

Installing

After releasing my static site to install it locally on your device you can use npm i button-ssg to download my program.

Feedback

It's important to avoid taking feedback as personal criticism. When people provide us with feedback, we should be grateful because they are actually pointing out areas in which we need to improve.

Thoughts

This lab was a welcome one, that allowed us to contribute more to the community if anything. It was a first for me when publishing to npm, but this is useful information. I have always wondered how people were publishing their programs and now here I am, doing just that.

Top comments (1)

Collapse
 
maurerkrisztian profile image
Krisztián Maurer

Good job. I would suggest a few things to make it better:

  • package.json : include the repository and bug props
"repository": {
     "type": "git",
     "url": "git+https://github.com/OpenZer0/bonfire-rest.git"
   },
   "bugs": {
     "url": "https://github.com/OpenZer0/bonfire-rest/issues"
   },
Enter fullscreen mode Exit fullscreen mode

this will apear in npmjs
Image description

Also you can automate the releases, publish process dev.to/maurerkrisztian/useful-lib-...

if something is not clear or you have any question, feel free to ask.