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?
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!