best practices in publishing npm package

twitter logo github logo ・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 !

twitter logo DISCUSS (5)
markdown guide

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


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.


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


yes, I am thinking of creating two packages

Classic DEV Post from Mar 5

3 Things You Can Do to Improve as a Developer

How do we identify and solve real problems?

Santhosh Kumar profile image
Software developer

Signed up yet?

DEV is one of the most important resources in software.

Create Your Account