The wieni/composer-plugin-patchsets is a PHP Composer plugin designed to address the complexities in managing and applying patches within Drupal projects.
This plugin aims to centralize patch management, enabling a consistent approach to applying patches across multiple projects.
Current practices utilizing cweagans/composer-patches for patch management in projects have introduced several challenges:
- Lack of uniformity in patch application across different projects leads to inconsistencies in behaviors.
- Difficulty in identifying and applying the same patches when upgrading versions due to variations in patch creation among different projects.
The primary goal of the wieni/composer-plugin-patchsets is to enable dependency patch resolution. A feature thas has been deprecated in cweagans/composer-patches.
The plugin leverages the new plugin capabilities released by cweagans/composer-patches, allowing it to add patches by registering a custom Resolver.
- Create a repository (eg
your-org/drupal-patches) that contains acomposer.jsonwith patches defined as documented bycweagans/composer-patches. - Require the
wieni/composer-plugin-patchsetsplugin and your new patch repository (your-org/drupal-patches) in your Drupal project. - Define the patch repository (
your-org/drupal-patches) as a patch set in yourcomposer.json:
{
"extra": {
"patchRepositories": [
"your-org/drupal-patches"
]
}
}This configuration instructs wieni/composer-plugin-patchsets to apply the patches defined in the your-org/drupal-patches repository.
The plugin supports an advanced configuration allowing the exclusion of specific packages and patches.
This next example demonstrates the exclusion of the "#2907810" patch for drupal/core and all patches for drupal/field_group.
{
"extra": {
"patchRepositories": [
{
"name": "your-org/drupal-patches",
"excludedPatches": {
"drupal/core": [
"#2907810"
],
"drupal/field_group": ["*"]
}
}
]
}
}Contributions, suggestions, and issue reports are welcome. Feel free to fork this repository and submit pull requests.
This project is licensed under the MIT License.
- Acknowledgment of
cweagans/composer-patchesfor its pioneering efforts in patch management within Composer.