composer-drupal-lenient icon indicating copy to clipboard operation
composer-drupal-lenient copied to clipboard

How can I bypass the module’s composer requirements?

Open emircanerkul opened this issue 2 years ago • 7 comments

Even after I added drupal/commerce_country_store to drupal-lenient allowed-list, it still gives,

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - drupal/commerce_country_store dev-1.x requires drupal/geoip ~2.0 -> found drupal/geoip[dev-2.x, 2.0.0-beta1, 2.x-dev (alias of dev-2.x)] but it conflicts with your root composer.json require (3.0.x-dev@dev).

The module's composer.json

{
    "name": "drupal/commerce_country_store",
    "type": "drupal-module",
    "description": "Enable having one store per country in Drupal Commerce",
    "homepage": "http://drupal.org/project/commerce_country_store",
    "license": "GPL-2.0+",
    "authors": [
        {
            "name": "Florian Loretan",
            "email": "[email protected]"
        }
    ],
    "require": {
        "drupal/commerce": "~2.0",
        "drupal/geoip": "~2.0"
    }
}

I'll continue with the custom repo but if this lenient extension would be capable of bypassing these too, that would be great @mglaman but I still use yours because it just works fine and is great with the Drupal modules' version dependencies.

emircanerkul avatar Oct 19 '23 09:10 emircanerkul

I am not sure if this will help in your case, but I was able to work around a similar sounding issue by using an inline alias

https://getcomposer.org/doc/articles/aliases.md#require-inline-alias

Specifically I used

"drupal/jquery_ui_accordion": "2.0 as 1.1"

which let me install drupal/accordion_menus

sdubois avatar Oct 27 '23 17:10 sdubois

Yes that workaround fixes but it would be good without any workaround.

emircanerkul avatar Oct 27 '23 17:10 emircanerkul

Look at your errors. Has nothing to do with this package.

Your root package requires geoip 3 and the other module requires 2.

This package is only for Drupal core.

mglaman avatar Oct 27 '23 18:10 mglaman

I see @mglaman I just feature requested. Or do you know a similar package for that purpose to bypass composer requirements too?

emircanerkul avatar Oct 27 '23 18:10 emircanerkul

Oh, sorry. I thought this was a bug report. I would be afraid to extend this package that way. Especially since Composer does have a workaround as commented.

mglaman avatar Oct 27 '23 18:10 mglaman

I actually would like, if it's possible, to reconsider using such a plugin for modules as well.

My current situation:

  • I have a site with https://www.drupal.org/project/ief_table_view_mode v2.3.0 which locks ief to 1.0
  • There's https://www.drupal.org/project/ief_table_view_mode/issues/3410575 which is not committed

I know I could make "drupal/inline_entity_form": "3.0.0-rc19 as 1.0", which I am doing, however this means that I have to manually edit the alias each time a new version for inline_entity_form appears and makes everything counterintuitive.

So such a feature would definitely be welcome for such cases and others.

hanoii avatar Jan 17 '24 14:01 hanoii

I won't close this, but I won't set aside time to work on it. I'll welcome the idea if someone puts up a pull request. However, it's bending the purpose of this plugin. The purpose is for drupal/core leniency.

mglaman avatar Jan 19 '24 21:01 mglaman