Problem/Motivation

The d.o subsystem that generates packagist metadata ignores composer.json of non modules/themes, and infers a wrong project type and requirements. See #2715435: Support for Drush extensions.

Steps to reproduce

In a Drupal 8.8 or above installation (where sebastian/exporter is not a core requirement), run composer require drupal/drush_entity and see that:

* sebastian/exporter is not downloaded
* drush_entity is placed in web/modules/contrib instead of drush/Commands/Contrib

Proposed resolution

As a workaround, add the project's .info.yml file. As stated in #2715435: Support for Drush extensions when the info file is present, the packaging subsystem merges the composer.json from the project with d.o defaults.

Remaining tasks

Add the project's .info.yml file.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

Not applicable.

Comments

jonhattan created an issue. See original summary.

Pooja Ganjage’s picture

StatusFileSize
new558 bytes

Hi,

I am applying patch to add info file.

Kindly review this patch once.

Thanks.

Pooja Ganjage’s picture

Status: Active » Needs review
clemens.tolboom’s picture

Status: Needs review » Needs work

The example in https://git.drupalcode.org/project/dev_modules/blob/HEAD/dev_modules.inf... mentioned in #2715435-11: Support for Drush extensions has no

+
+
+# Information added by Drupal.org packaging script on 2020-05-24
+version: '8.x-6.x-dev'
+project: 'drush_entity'
+datestamp: 1590299335000
\ No newline at end of file

Please make similar by removing the above and add the core_version_requirement

Pooja Ganjage’s picture

StatusFileSize
new832 bytes

Hi,

Attached the updated patch.

Kindly review this patch once.

Thanks.

Pooja Ganjage’s picture

Status: Needs work » Needs review
clemens.tolboom’s picture

Status: Needs review » Needs work

+ "drupal/core": "^8 || ^9",

You added composer.json. Checking with https://git.drupalcode.org/project/dev_modules/-/blob/HEAD/composer.json that has no core requirements in it. Do you have some information/link why that is/must be added?

jonhattan’s picture

We don't want "drupal/core" requirement in composer.json, since drush extensions can be installed standalone/system-wide (out of a drupal installation), and is undesirable to have a copy of core in vendor/. Ref #2715435-8: Support for Drush extensions

FTR I'm leveraging drush_entity in https://www.drupal.org/project/drush_shrinkdb

suresh prabhu parkala’s picture

Status: Needs work » Needs review
StatusFileSize
new306 bytes

Please review!

Pooja Ganjage’s picture

Hi,

Here is an example for adding core_version_requirement in composer.json file.

https://www.drupal.org/project/entityqueue/issues/3111532.

May be you get some idea.

clemens.tolboom’s picture

Status: Needs review » Fixed

@Pooja Ganjage you probably missed @jonhattan answer. I was curious about your composer addition and reasoning.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.