Sunday 23 February 2020

"Properly" installing local packages within a monorepo?

I'm currently working on a project which I've decided to split up into multiple packages, it has a "main" module which other modules can be added into. To do so I've a test app which installs the main and sub modules and passes the sub modules into the main oneThe way I installed my local packages is using (relative) paths, so npm install ../packages/[...], however this approach has various issues:1) Obviously for starters, my package.json refers to the path where the given module resides locally instead of pointing to a version and thus needs fixing before publishing2) The dependencies of the installed sub-modules are not installed into the node_modules directory of my application but rather into the seperate node_modules directory of the given installed package, this causes various issues like cli apps of the sub modules not being available, the sub modules being unable to require modules that I've installed in the top / test app and so on.Is there a way to do this in a "correcter" fashion? The only ideas that I've had would be to push all the stuff to a (local) git / npm server and install from there, however that seems way over the top and also like a massive hassle because I'd need to re-push/download on every change. I've also checked out of npm install maybe has some arg to fix this but no luckThanks in advance!

Submitted February 24, 2020 at 06:02AM by kinsi55

No comments:

Post a Comment