Description
In order to move extensions forwards to be more composer-friendly in the Drupal 8/9/10 ecosystem, I think it would be a good idea to start requiring extensions to ship with its own composer.json
file with the basic minimal metadata.
In Drupal 8+, we start using composer to add Drupal components and we can include here Civi extensions. But because there's not (yet) a clear convention about how an extension must be shipped to be easily required in an external composer.json file, I'm proposing to start requiring (mandatory?) this..
Now a days many extensions already include composer.json
file to define their required dependencies.. but usually those files do not have the basic attributes needed to be part of another composer.json
(like name, description, and type) as composer "packages", and usually they need to be downloaded as "artifacts" or git repos, but no composer packages
So my proposal is to create on civix generate:module
command the basic composer.json
with this general format:
{
"name": "civicrm/<extension_name>",
"description": "<extension_description>",
"type": "civicrm-extension",
"license": "AGPL-3.0",
"authors": [
{
"name": "<author_name>",
"email": "<author_email>",
"homepage": "<author_homepage>",
"role": "Maintainer"
}
],
"require": {}
}
Most of the values can be copied from the original info.xml
file, and free to be edited by the developer, but the one that shouldn't be changed is "type": "civicrm-extension"
. With that attribute an external composer.json file, can require this package and depending on the type execute different actions, like placing extensions in specific path
I think this issue goes over the scope of civix
and needs some more global definitions and agreements in the Civi extensions ecosystem, by i think if we start creataing it in civix
the adoption curve will be quicker.
Thoughts?