DEV Community

loading...

best practices in publishing npm package

5anthosh profile image Santhosh Kumar ・1 min read

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

pic
Editor guide
Collapse
stereobooster profile image
stereobooster

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

Collapse
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.

Collapse
5anthosh profile image
Santhosh Kumar Author

it seems good idea, thanks

Collapse
mr_h profile image
Huxley

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

Collapse
5anthosh profile image
Santhosh Kumar Author

yes, I am thinking of creating two packages