Depfu supports monorepos now
We’ve just deployed the last missing pieces and can now say this with conviction: Depfu fully supports monorepos.
Not sure if it’s a trend or just my brain pattern matching, but we had more and more of our users ask us if we can handle monorepos. We actually kinda supported them for a while now, but it involved manual setup steps and a few hacks. Now it’s all polished and working nicely.
So this is what happens if you use Depfu with a monorepo, or just have your Gemfile/package.json in a non-root folder:
When you enable a repo in Depfu, we first try to find a Gemfile/package.json in your root folder. If there is none, we iterate through your subfolders and see if we can find any relevant files there. We create what we call a “project” for each of the folders we find dependency files in.
By default, we only activate the first of these projects/folders we find and start sending you pull requests. The other projects you’ll have to activate yourself in the Depfu UI. This is to make sure it’s a folder you actually want to get dependency updates for and not just random test files.
The auto-detection will only happen for repos you are adding to Depfu from now on. We are also only looking one level deep in this step. But if we don’t find a folder you’ll want Depfu to run on, you can just add it manually.
If you’re creating new folders in your monorepo or have an existing repo where we didn’t do the auto-detection, you can add a folder yourself. Just click the “+ Add” button and select the folders you want to enable in Depfu.
The Pull Requests
In order to support monorepos we’ve made two changes to the pull requests
- Indicate the folder in the branch name: Branches have to be unique, so we’re including the name of the folder in the branch name to make sure it doesn’t clash with the exact same update in another folder.
- Indicate the folder in the PR title: To also visually differentiate the PRs from each other when you look at your list of PRs, we prefix them with the name of the folder. You can additionally configure Depfu to use a unique label for each project.
The PR limit
The Depfu Scheduler makes sure we don’t open more than 7 PRs at the same time to not flood your list of PRs with only dependency updates. In the case of monorepos we wanted to make sure you get updates for each of your folders all the time, so we decided to do a PR limit of 3 per folder.
That means depending on the amount of folders you have, your monorepo can get a lot more than 7 PRs from Depfu. For example, you would get a maximum of 30 PRs from us if you had 10 folders in your monorepo. We’re not super happy with this solution yet and would like to see some more usage to come up with something better.