DEV Community

Santhosh Kumar
Santhosh Kumar

Posted on

best practices in publishing npm package

I am working on this side project fcal

I want to release it as npm package , but I also want it to act as cli.

Should I create another npm package for cli or npm package acts as (both) cli and module ?

I am new to nodejs environment and learning best practices

thanks !

Discussion (5)

stereobooster profile image
stereobooster • Edited on

People implement 2 packages, so that one can be installed globally (cli one). I avoid installing globals though, I always prefer local installation and for cli I use yarn cli-name

adam_cyclones profile image
Adam Crockett

Global packages are a bit unnecessary in my opinion due to npx. But that said a lib and a client (cli) is a good idea.

5anthosh profile image
Santhosh Kumar Author

it seems good idea, thanks

mr_h profile image
Huxley • Edited on

I see lots of people making 2 packages. Just keeps it that bit cleaner and easier to maintain.

5anthosh profile image
Santhosh Kumar Author • Edited on

yes, I am thinking of creating two packages