Include dependency to DKAN in contrib module info.yml #4149
Replies: 2 comments 2 replies
-
Drupal's Composer facade does a lot of magic in order to discover submodules with in the composer package, so it requires the correct composer package. (As an example, if you say If you're making a Drupal-hosted contrib module that needs DKAN, you should add a composer.json file to it that requires If the contrib module needs a specific DKAN module to be enabled at runtime, then as you point out above, use the info.yml to declare dependencies, so that Drupal will then try to enable that module on install. |
Beta Was this translation helpful? Give feedback.
-
@paul-m : thanks for your answer. I get it to work like you described making composer require getdkan/dkan with composer.json in the contrib module. But doing this:
does always end up in composer searching for drupal/metastore (for example) and not finding this. The Drupal magic seems to add every dependency in the modules info.yml as a composer dependency as well, but always searching only in the "drupal" composer namespace. |
Beta Was this translation helpful? Give feedback.
-
How can I include a dependency to DKAN (or even a submodule like metastore) in a info.yml for a contributed module?
I can write dependency in info.yml like on of this:
This will work if the module is only a local module. But if it is contrib module the Drupal composer packaging does somehow translate the dependencies from info.yml to composer dependencies, thus composer require drupal/custom_module will require dependency like drupal/metastore. But it cannot find drupal/metastore in the drupal composer packages (because DKAN is on Github), resulting in composer message like this
drupal/metastore * -> could not be found in any version, there may be a typo in the package name.
This seems to be the case no matter how the dependency is written in the info.yml. Drupal seems to do some magic here: https://drupal.stackexchange.com/questions/302656/how-is-composer-including-a-dependent-module
Does anybody know a solution to this problem?
PS: I can include dependency to DKAN in composer.json of the contrib module. But this will only composer install DKAN but does not have an effect on the order of module installation in Drupal.
Beta Was this translation helpful? Give feedback.
All reactions