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 !

Latest comments (5)

Collapse
 
stereobooster profile image
stereobooster • Edited

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

it seems good idea, thanks

Collapse
 
mr_h profile image
Huxley • Edited

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

Collapse
 
5anthosh profile image
Santhosh Kumar • Edited

yes, I am thinking of creating two packages