DEV Community

Cover image for How do you manage all the versions of your dependencies ? Our answer here.
Alienor for Lenra

Posted on

How do you manage all the versions of your dependencies ? Our answer here.

Check out our video to see the how-to with Flavien !

Intro:

How do you manage your dependencies between your GitHub repositories?

Without automation we have to update the right files at the right place.

And for big projects, Git repositories can have a complex mesh that would make this task complicated.

Part 1: Project shape

I'll start by showing you a sample of a classic mesh that could be found in a project split into several Git repositories.

This example will assume to be a cross-platform application with a web client, a mobile client, and a Desktop client.

For this we will have function libraries that will be common to all three targets.

Dependencies:


protocol-lib: string-lib

core-code: string-lib, protocol-lib

desktop-app: core-code

mobile-app: core-code

web-app: core-code

Enter fullscreen mode Exit fullscreen mode

As you can see, we have a total of 6 Git repositories that depend on each other.
In our example, repository "core-code", that will contain the main code of the app, will be shared on each platform (desktop-app, mobile-app, and web-app).
That core-code needs repository "string-lib" and "protocol-lib" to compile.
And as it is quite a pain in the *** to always have to manually edit the right dependency files, this action will take care of it, if it's well configured.
If we continue our exploration, the "protocol-lib" repository also requires the "string-lib" repository. Projects of a certain size can have pretty complex mesh links which can be a source of errors.

Image description

Part 2: GitHub Action

When you publish a new release on the repository "string-lib", this action will automatically create a Pull Request on the repository "protocol-lib" and "core-code" to update the correct files and change its own link in dependancy file(s). And now, when you merge the PR on the repository "protocol-lib", and create a new release, it will update the previously created PR on the repository "core-code" to add these changes if it's not already merged.

Now we can accept changes on the repository "core-code" to update its version of "string-lib" and "protocol-lib". This will batch upgrade at once the version in "desktop-app", "mobile-app", and "web-app".

That's it, you can now focus on your work ;)

https://github.com/lenra-io/create-or-update-pr-action

Top comments (0)