DEV Community

Adam Crockett
Adam Crockett

Posted on


Undo Monorepo

I think I'm locked inside a Monorepo without a key. For an OS project I've been working on, I have very mixed feelings about this.

I wanted to try the monorepo style again for probably the 4th time in my career, it tends to end the same way, but not this time, I want to try something beyond just simple code cohabitation but instead a full test and release pipeline.

My project was going to looks like this.

    /p1 - client
    /p2 - lib
    /p1 - git submodule
    /p2 - git submodule
Enter fullscreen mode Exit fullscreen mode

This would have meant that each built package would get its own dist repository.
Sounds kind of nice.
But this is a node project and actually monorepo's are touted as an amazing way to work, but node doesn't resolve dependendent packages that sit side by side. There is a prescribed way and any other way is against the grain (including npm / yarn link).

The way I see my application is as follows, you have a client which is public and it consumes our lib package to provide the client or any newly developed client with functionality.
This means that I need to build the compiled language sources into it's respective release folder, install it's dependencies, link the development packages which also have to be built and installed.

It's a lot of boilerplate just to do something that should be trivial. It gets worse because adding a new package or deleting a package will not be straight forward, all those leftover artifacts you can never be sure if it's all been deleted. Then there's linking, I feel like symlinks could lead me into a false sense of security, come release something could actually not exist.

It's a real headache and it's going to be hard to change, I can go on writing tooling to manage the project I actually want to write, find a solution with your help, or refactor to a poly repository.

Top comments (0)

An Animated Guide to Node.js Event Loop

>> Check out this classic DEV post <<