DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

Joey Mink
Joey Mink

Posted on

npm install private-package

Not everyone can commit code publicly to GitHub and publish packages to npmjs.com. We all benefit from those who do, no doubt. But many of us apply those generous offerings to (and write fresh code for) internal, private projects.

However, that is no excuse to develop large, monolithic internal projects. I declare: modularization and implementation of independent packages is still necessary! Keep projects narrowly-focused. Write independent, useful, reusable packages!

uh, okay idealogical goofball. HTF am I supposed to conveniently make use of private packages when I can't just npm install my-super-secret-pkg?
^ Nay-sayer

Ah, but you can! Read on...

Sonatype has a product called Nexus. It's a well-known Maven (Java) repository you can run privately. But get this: it's not just a private Maven repository รฐลธหœยฎ It's also a private PyPi repository, and ... wait for it ... a private npm repository รฐลธลฝโ€ฐรฐลธโ€˜ย And it's free!

Details about configuring Nexus for npm repositories can be found here. Note that you can easily set it up to proxy npmjs.com and host your private packages at the same time รขยยครฏยธย

This has been crucial in recent projects for me. An electron application we've been developing included lots of complex, independent algorithms that deserved their own projects to house documentation and tests. Rather than bloat the electron project with in-the-weeds details, I was able to put those weeds in their own npm packages and have already begun reusing them in other applications.

If your situation enables it, please keep posting your magic to npmjs.com. We all benefit! But if you can't, running a private repo is a must!

Top comments (3)

Collapse
 
nektro profile image
Meghan (she/her) • Edited on

Have you seen npm enterprise?

Collapse
 
joeymink profile image
Joey Mink • Edited on

I have! But it gets pricey at $16/mo/user.

Collapse
 
nektro profile image
Meghan (she/her)

Nexus is still better here as itโ€™s free but itโ€™ll you donโ€™t want to deal with the hassle of hosting? npm orgs is only $7/mo/user

Timeless DEV post...

How to write a kickass README

Arguably the single most important piece of documentation for any open source project is the README. A good README not only informs people what the project does and who it is for but also how they use and contribute to it.

If you write a README without sufficient explanation of what your project does or how people can use it then it pretty much defeats the purpose of being open source as other developers are less likely to engage with or contribute towards it.