From a4d3b6fcfb5fd6d6dddfb2e515594c9fe9650df5 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 14 Sep 2024 18:37:36 +0100 Subject: [PATCH] Drupal's Lenient Composer endpoint --- source/_zets/25.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 source/_zets/25.md diff --git a/source/_zets/25.md b/source/_zets/25.md new file mode 100644 index 0000000..09e0a59 --- /dev/null +++ b/source/_zets/25.md @@ -0,0 +1,40 @@ +--- +title: Drupal's Lenient Composer endpoint +date: 2024-09-14 17:29:15 +tags: [Drupal, PHP, Composer] +links: + - https://www.drupal.org/project/content_access + - https://www.drupal.org/docs/develop/using-composer/using-drupals-lenient-composer-endpoint + - https://github.com/mglaman/composer-drupal-lenient + - https://github.com/cweagans/composer-patches +--- + +Today, I tried to add the Content Access module to a Drupal 11 project, but there's no Drupal 11-compatible version. + +It's a simple update - just adding `^11` to the content_access.info.yml file, but even with Composer Patches installed, it's not possible to download and patch the module using the normal Drupal 8+ Composer repository. + +This is possible, though, with the Lenient Composer endpoint. + +> This composer plugin lets you specify an allowlist of packages where you are willing to break the version constraint. + +> Together with the Composer Patches Plugin, this allows you to install any Drupal extension, even if the version constraint hasn't been officially updated yet. Of course the code may still need to be patched for deprecations. + +To add the lenient endpoint and add the Content Access plugin: + +```shell +composer require mglaman/composer-drupal-lenient +composer config --merge --json extra.drupal-lenient.allowed-list '["drupal/content_access"] +composer req drupal/content_access +``` + +Note that I'd already included this section to my composer.json file to add a patch to make the module installable on Drupal 11: + +```json +"extra": { + "composer-patches": { + "drupal/content_access": { + "Drupal 11 support": "./tools/patches/content_access/d11_support.patch" + } + }, +}, +```