Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Comment | File | Size | Author |
---|---|---|---|
#11 | 2514546-add-composer-json-11.patch | 347 bytes | timwood |
Comments
Comment #1
timmillwoodComment #2
timmillwoodComment #3
anavarreTo have valid JSON, you need to drop the comma.
Comment #4
timmillwood@anavarre - Thanks for the typo spotting!
Comment #5
anavarreThanks, looks good to me now.
Comment #6
anavarreComment #7
anavarreComment #8
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedBump!
Can we get this committed please? Without this composer.json file, composer automatically adds modules I don't need/want in my codebase, such as search_api and search_api_solr. I know those are needed for Acquia Search, but we're not using it, so we don't want the modules.
Comment #9
timwoodLooks like a composer.json was already added in https://cgit.drupalcode.org/acquia_connector/commit/?id=2ee12a8&h=8.x-1.x. This is when the unnecessary(?) drupal/search_api and drupal/search_api_solr modules were added as composer requirements.
Are the maintainers open to removing these requirements from composer.json? Why are they included? Are they actually needed for the connector module, or perhaps for the acquia_search sub module?
Comment #10
timwoodHere is a patch that should apply to 8.x-1.x as well as 8.x-1.16 (current 8.x release as of this comment).
Comment #11
timwoodAdding empty require in composer.json.
Comment #12
timwoodFor some reason, composer wouldn't exclude the dependencies, even after applying my patch via composer.json using cweagans/composer-patches.
Comment #13
Mark TrappHi, thanks for the report and the suggested patch. We've committed a separate composer.json for acquia_search, and removed the search dependencies from the main module.
This has been committed to the 8.x-1.x branch: https://cgit.drupalcode.org/acquia_connector/commit/?id=744a539 and will be part of the next release.
Comment #14
timwoodThank you!
Comment #15
Mark TrappUnfortunately, Composer doesn't see the submodule composer.json, so the dependencies required for acquia_search are never resolved. I've reverted this for the time being.
Comment #16
gappleDependency resolution happens against the data retrieved from the package repository, before the packages are downloaded to your project, so you can't use a patch to change package dependencies.
Composer.json is for projects, not modules, so there should only be one root composer.json file. (...unless you're doing package splitting like Symfony components / Drupal core's components, but that's not the case here...)
For those that would like to not include a sub-requirement, you can use the
replace
parameter in your project's composer.json, and composer will not download those modules.Comment #17
gappleAlternately, if Acquia Connector would like assume by default that sites are not using Acquia Search, it could use
suggest
andconflict
to tell users that they need to require additional packages for Acquia Search, and retrieve the correct versions.search_api_solr requires search_api, so both don't need to be added.
Comment #18
Dane Powell CreditAttribution: Dane Powell at Acquia commentedI think this is resolved in the latest release. We've moved the search dependencies to Acquia Search's composer.json. If you are using Acquia Search, you should
composer require drupal/acquia_search
in addition to Acquia Connector to get these dependencies, but other users of Connector won't get them.