this post was submitted on 18 Jul 2024
104 points (96.4% liked)
Programming
17419 readers
49 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Split up the monorepo?
That brings more problems. Despite the scaling challenges monorepos are clearly the way to go for company code in most cases.
Unfortunately my company heavily uses submodules and it is a complete mess. People duplicating work all over the place, updates in submodules breaking their super-modules because testing becomes intractable. Tons of duplicate submodules because of transitive dependencies. Making cross-repo changes becomes extremely difficult.
But if not for using submodules, how can one share code between (mono-)repos, which rely on the same common "module" / library / etc.? Is it a matter of "not letting submodules usage get out of hand", sticking to an "upper limit of submodules", or are submodules to be avoided entirely for monorepos of a certain scale and there's a better option?
You don't share code between monorepos, the whole point of a monorepo is you only have one repo where all code goes. Want to share a library, just start using it as it is just in a different directory.
Submodules are a poor way to share code between lots of small separate repos. IMO they should never be used as I have never seen them work well.
If you don't want a mono repo then have your repos publish code to artifact stores/registries that can be reused by other projects. But IMO that just adds more complexities and problems then having everything in a single repo does.
So AFAIU, if a company had:
... and all those apps would share some smaller, self developed libraries / components with the frontend and/or backend, then the "no submodules, but one big monorepo" approach would be to just put all those apps into that monorepo as well and simply reference whatever shared code there might be via relative paths, effectively tracking "latest", or maybe some distinct "stable version folders" (not sure if that's a thing).
Anyway, certainly never thought to go that far, because having an app that's "mostly independant" from a codebase perspective be in it's own repo seemed beneficial. But yeah, it seems to me this is a matter of scale and at some point the cost of not having everything in a monorepo would become too great.
Thanks!