amcgowanca/composer-patches-drupal-patching

There is no license information available for the latest version (0.0.2) of this package.

A work-around solution for patching Drupal 8 core with cweagans/composer-patches.

0.0.2 2018-08-06 13:35 UTC

This package is auto-updated.

Last update: 2024-04-16 22:37:03 UTC


README

This package provides a work-around for the issue in which Drupal 8 core package patches, applied through the use of cweagans/composer-patches, does not correctly apply patches to Drupal core itself. Instead, a common symptom of incorrectly applied patches is the creation of the directories: docroot/core/b/ or docroot/core/core. This appears to be the result of a composer.json's specification of the drupal/core project's installation path being docroot/core. This is commonly seen in Acquia BLT (and potentially Acquia Lightning) based projects.

This Composer Plugin provides a mechanism to resolve the issue so that patches defined in a composer.json for Drupal core can be applied to docroot vs. docroot/core through modification of the installation path at time of pre-patch apply events that are fired through cweagans/composer-patches plugin. However, this ultimately warrants modifications to the Composer Patches project to allow for the modification of the $install_path value which can be seen through the changes outlined here.

Usage

  • The project's composer.json file must specify the new repository in which the cweagans/composer-patches project is retrieved from. This can be done by adding the following to your composer.json's repositories property:
"cweagans/composer-patches": {
  "type": "vcs",
  "url": "git@github.com:amcgowanca/composer-patches.git"
},
  • Your composer.json should specify as a required package, the cweagans/composer-patches as the first possible package to retrieve (prior to Acquia BLT or Lightning where "merge-plugin"."replace" is false). This package should have a version of 1.x-dev.
"cweagans/composer-patches": "1.x-dev"
  • Your composer.json should require this package, available as:
"amcgowanca/composer-patches-drupal-patching": "^0.0.1"
  • Depending on your current workflow for your project, you may need to execute a "nuke" operation to rebuild your project's dependencies effectively and accurately. Note that you may (and it is likely) during your first time for executing a complete composer install or update operation to notice that some of the defined Drupal 8 core patches no longer apply. It should be noted that these most likely did not ever apply and silently were ignored.

Related issues & resources

The following is a collection of high-level issues and resources related to the core problem that this plugin (and the modified cweagans/composer-patches) helps address:

Example repository

An example repository has been put together to contain an example of a clean Acquia BLT project setup in which the error that this Composer Plugin aims to resolve, in addition to an example in which the problem at hand is in fact solved. More information can be found at amcgowanca/composer-patches-drupal-patching-proof.