Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create composer.json on generate:module ? #234

Open
sluc23 opened this issue Jan 13, 2022 · 2 comments
Open

create composer.json on generate:module ? #234

sluc23 opened this issue Jan 13, 2022 · 2 comments

Comments

@sluc23
Copy link

sluc23 commented Jan 13, 2022

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?

@ufundo
Copy link

ufundo commented May 30, 2024

👍 for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants