How to use composer-drupal-lenient when upgrading project from Drupal 9 to Drupal 10.

Many of use has faced challenges while upgrading Drupal core from 9 to 10 where some of the modules are not compatible with D10, we might have followed the forked issue approach solution which I have described in one of my previous posts (How to use the Drupal 9 module in a Drupal 10 project using Composer if its MR is already ready...).

But using composer-plugin composer-drupal-lenient which remove a barrier with getting extensions installed via composer to work on making modules Drupal 10 ready.

Now, let's dive into a scenario where we would upgrade the project from Drupal 9 to Drupal 10 considering some of the modules which are being used in the project are not yet compatible with Drupal 10.

For this use case I am taking the example of following modules which are being used in the project and are not yet compatible with Drupal 10
- Mail notify
- System Status

Let's add composer-drupal-lenient plugin to the project using composer.

composer require mglaman/composer-drupal-lenient

Then we will add modules to the lenient allow-list using composer command.

composer config --merge --json extra.drupal-lenient.allowed-list '["drupal/mail_notify", "drupal/system_status"]'

Then add patch for the above module in project composer.json under extra.patches section (We can check modules issue queue and look for issue title "Automated Drupal 10 compatibility fixes" and use patch from that issue).

"patches": {
  "drupal/mail_notify": {
    "Automated Drupal 10 compatibility fixes": "https://www.drupal.org/files/issues/2022-06-16/mail_notify.1.0.1.rector.patch"
  },
  "drupal/system_status": {
     "Automated Drupal 10 compatibility fixes": "https://www.drupal.org/files/issues/2023-02-15/system_status-drupal_10_compatibility-3299281-7.patch"
  }
}

Finally, we will update core by running the below command, which may varies from project to project.

composer require 'drupal/core-recommended:^10' 'drupal/core-composer-scaffold:^10' 'drupal/core-project-message:^10' drush/drush:^12 --update-with-dependencies --no-update
composer update -W

 

0/5