DEV Community

aldrin312
aldrin312

Posted on

Publishing to npm!!

This one was really a cool thing to do. Having something I worked on be publicly available on npm. I though it something the only professional would be able to do, but I'm really surprised how easy and accessible publishing to npm is.

As I mentioned above I used node to publish. I'm baffled how easy it is to publish on node. Just need to initialize npm, whitelist the files that I'm to publish, set the version and that's it.

Publishing with Node

Only issue I found in publishing is that I made small mistakes on the README.md file I published. So it took me several update version to fix the minor changes. I'm not sure if theirs a way to publish without incrementing the version every time I fix spelling mistakes on the README file.

Altering my code for publishing.

I didn't really need to alter my code for publishing to npm. I only need to alter a few files, the README file to make it work for node installation and the package.json for setting the whitelist files to be published.

Testing the packages.

I ask my friend to test the packages for me. He didn't found much issues with installing and running the packages. Though theirs some ambiguity on the instructions I have on the README file, which I promptly fixed. For this most part, theirs wasn't any major issues the the published version.

Installation

My published packaged can be found here: autocomment

Instruction:
  1. Installation:
   npm -i autocomment
Enter fullscreen mode Exit fullscreen mode
  1. Get a free API Key at https://console.groq.com

  2. Create a .env file and add your api into it

    GROQ_API_KEY=<api-key>
    

Usage

Tool Execution:

    npx autocomment <filename> ...
Enter fullscreen mode Exit fullscreen mode

or if not using .env file

    npx autocomment -a <api-key> <filename> ...
Enter fullscreen mode Exit fullscreen mode

Options:

  • --version or -v: Shows the current version of Autocomment.
  • --help or -h: Shows help menu.
  • --save <output-filename> or -s <output-filename>: Saves the output to the output folder with the designated filename.
  • --api <api-key> or -a <api-key>: Input api.
    npx autocomment -s <output-filename> <filename>...
Enter fullscreen mode Exit fullscreen mode

Top comments (0)