-
Notifications
You must be signed in to change notification settings - Fork 56
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
Adds composer.json package information to the extension #267
base: master
Are you sure you want to change the base?
Conversation
hi @totten .. do you have any objection on adding composer.json by default when creating the extension with civix? |
My only objection to this is that we've been using civix a lot lately to generate core extensions which go in the same repo as civicrm and therefore don't need composer files. I wonder if it would be better as a command like
|
Can one of the admins verify this patch? |
hmm why not the opposite?, a param to not generate composer.json by default on extension creation..
|
I don't have a strong preference; either way it would need to be documented. |
ok, we can adapt the PR for one way or the other... @totten thoughts? |
I've found myself pretty torn:
Maybe a way to balance those could be:
|
We've used composer for our D7 and now D9 installations, so this functionality is compelling. It will save a huge amount of repository forking, etc., for the sake of one file. Given colemanw's note about using civix for core extensions, and that D8+ sites only account for ~21% of reported User frameworks on stats.civicrm.org, I'd suggest the better option for now is to make generation of a composer.json file non-default, along the lines of A followup PR could look to add support for developers enabling this by default by way of the Either way, I'm excited and grateful to find this PR. |
In my experience, it works fine for D7 and WP. D7/WP typically don't use composer for their core, but for CiviCRM extensions, it usually works fine, even if they bundle libraries. I've also seen quite a few WP setups that used composer (for packaging). Also works fine for CiviCRM Standalone. Although in general, if we use extensions that have libraries without composer, then it's generally a pain (ex: the Omnipay extension, and I had to remove/reduce libraries from extensions like my Sparkpost fork and Report Error, to avoid conflicts and the various ways people can install extensions). Like others have mentioned, using composer for extensions is mostly about saving a lot of time when updating a codebase with many extensions (ex: CiviCRM Spark, which builds with composer, commit to git, |
More discussion on composer/extensions: https://lab.civicrm.org/infra/gitlab/-/issues/45 |
@totten This minor PR adds the functionality to add a default (from template)
composer.json
file to the extension's root folder