deprecated-packages / symplify

[DISCONTINUED] Check split packages in their own repositories :)
MIT License
618 stars 188 forks source link

[monorepo-builder] Bump inter-dependency issue #4569

Open ymorocutti opened 11 months ago

ymorocutti commented 11 months ago

Hello,

PROBLEM

Let's say I have 2 packages in my monorepo :

My bundle dummy/admin-bundle requires dummy/ui-bundle:~4.0 and dummy/api-client-bundle:^1.0. My bundle dummy/ui-bundle:~4.0 requires also dummy/api-client-bundle:^1.0.

Before continuing, lets just say that I can't add dummy/ui-bundle to my monorepo. It's too big as it's almost a monorepo itself. Using the merge command will generate a composer.json like this one.

"require": {
        "dummy/ui-bundle": "~3.0 || ~4.0"
},
"replace": {
        "dummy/admin-bundle": "self.version"
        "dummy/api-client-bundle": "self.version"
}

First issue here, when I try to update composer, it failed to resolve dummy/api-client-bundle. From what I've understand, composer tries to resolve dummy/api-client-bundle:1.0 and dummy/api-client-bundle:self.version but failed to do it.

Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - dummy/ui-bundle[4.30.2, ..., 4.30.3] require dummy/api-client-bundle ^1.0 -> found brs/api-client-bundle[1.0.0] but these were not loaded, likely because it conflicts with another require.

POSSIBLE SOLUTION

I've find a way to by pass this by replacing self.version into my monorepo by a wildcard.

"require": {
        "dummy/ui-bundle": "~3.0 || ~4.0"
},
"replace": {
        "dummy/admin-bundle": "self.version"
        "dummy/api-client-bundle": "*"
}

With this hack, it works. I'm not sure if there is a "cleaner" solution, but at least, it works as expected.

PROBLEM 2

Now, I've an other issue when trying to bump inter-dependency. This command use the monorepo name and try to find any package that start with "dummy/". It works well for dummy/admin-bundle and dummy/api-client-bundle but it also bump dummy/ui-bundle, even if it's not in my monorepo.

I haven't find any way to skip this, there is no configuration for this.

POSSIBLE SOLUTION

I see 2 way to fix this issue.

  1. We add a configuration to ignore bundles when bumping inter-dependency. This would be the safer option as we're sure we won't introduce any breaking change.
  2. We could also iterate the property replace in our composer.json and process any package that start by "dummy/" AND listed in this property.

Do you have any insight about this issue and how I could fix it ?