Re-use personal modules via NPM/Yarn?

Nicky Hajal on September 21, 2018

Hey all! Just curious if anyone has a work flow for streamlining internal code-reuse between projects via npm/yarn? For example, most of my pro... [Read Full]
markdown guide

If you want to use npm to manage something you have to factor it out into a self-contained package. Once you do that you can use peerDependencies to ensure that sequelize or what have you has to be present alongside your "commons" library, but making it its own package is non-negotiable. If you're routinely extending your models with new fields it will probably be more trouble than it's worth.


create an NPM account, split your code into its own projects, and once you have everything setup locally (you can test your NPM package before deploying it), you publish it to Github and NPM. Shameless plug, you can check out my post about bootstrapping a project with Parcel for publishing


If you have multiple packages you think you'll be publishing I'd also look into


Agree. Here's a good intro along with pros and cons of this approach. It also doesn't require you to publish your packages on NPM.

code of conduct - report abuse