Workflow for Poly-Repo Management (Local Workspace vs. CI Git Dependencies) #944
Unanswered
jersonal-com
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
We are using melos to manage a "virtual monorepo" where our packages and apps exist in separate Git repositories but are checked out into a single directory structure for local development. I'm struggling to find a workflow that supports both local development and our CI/CD pipeline on Codemagic. 😅
The goal is to have a setup where:
Local Development: I can work across multiple local packages seamlessly using path dependencies. melos should work with bootstrap, scripts, etc.
CI/CD Pipeline: When building a single app (e.g., on Codemagic), its dependencies on other packages must be resolved from their respective Git repositories
The issue I faced is a conflict between the requirements for these two environments:
melosrequires a workspace: For melos bootstrap to correctly link local packages and manage the workspace, the root pubspec.yaml needs aworkspace:definition, and all packages included must have resolution: workspace in their pubspec.yaml.I tried many different approaches. The one that nearly worked was to uses path: dependencies and
resolution: workspaceand then a pubspec_overrides.yaml for each package. This file containsresolution:(to opt-out of the workspace) and dependency_overrides: pointing to the git: repositories. Locally I can then remove the override files before running melos and restoring them afterwards.While this would work for the top-level app quite nicely I unfortunately have also one dependency from one package to another one:
As it seems when running
flutter pub getin the CI/CD the pubspec.yaml from the package b is analyzed before the pubspec_override.yaml is applied and I get an error referencing the path dependency that saysInvalid description in the "package_b" pubspec on the "package_a" dependency: the path "../" cannot refer outside the git repository.Update:
This is how I could got the 2 options running:
package_a: ^1.0.0- which works in the local and the CI/CD environment.While this is working now somehow I would appreciate if someone could point me to a solution that works in a cleaner way with less hot glue and gaffa tape. 😃
Thanks a lot in advance,
Oliver
Beta Was this translation helpful? Give feedback.
All reactions