Skip to content
This repository was archived by the owner on Dec 3, 2023. It is now read-only.
This repository was archived by the owner on Dec 3, 2023. It is now read-only.

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

@ymorocutti

Description

@ymorocutti

Hello,

PROBLEM

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

  • dummy/admin-bundle
  • dummy/api-client-bundle

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions