7

Background:

  • Drupal 8
  • Managing dependencies with compose

I want to apply one patch to vendor/behat/web_api_extension project.

I tried with this in composer.json but it doesn't works or no error.

"extra": {
    "enable-patching": true,
    "patches": {
        "drupal/better_formats": {
           "Settings have no affect on the field if it is in a Paragraph bundle - https://www.drupal.org/node/2754029": "https://www.drupal.org/files/issues/better_formats_paragraphs-2754029-15.patch"
        },
        "vendor/behat/web-api-extension": {
            "behat web api definition conflicts with mink extensions": "patches/behat_web_api/alter-definitions-text.patch"
        }
    }
}
4
  • In order to have a patching workflow, you need something like Composer Patches. github.com/cweagans/composer-patches - the format should be vendor/project, so, behat/web-api-extension. I have not tried this outside of Drupal module patches though.
    – Kevin
    Jan 25, 2017 at 15:13
  • @Kevin my drupal module patches works fine. i tried with vendor/web-api-extension but it don't work. My vendor directory is outside drupal root does it effect? Jan 25, 2017 at 15:25
  • 2
    vendor/project is the EXAMPLE format - you should use behat/web-api-extension, not vendor/
    – Kevin
    Jan 25, 2017 at 15:34
  • @Kevin i did same but no hope :( Jan 25, 2017 at 17:15

2 Answers 2

6

You will need cweagans vendor to make composer able to parse the extra->patches lines.

This line is wrong I think: "vendor/behat/web-api-extension" You always need the package name (without version) and not the relative path. In your case it should be "behat/behat"

-1

You need to have cweagans/composer-patches as a requirement on your project, so you need to:

composer require cweagans/composer-patches

Then in your composer.json you need to add your patches under extra:patches, which you already had:

...
"extra": {
    "enable-patching": true,
    "patches": {
        "drupal/better_formats": {
           "Settings have no affect on the field if it is in a Paragraph bundle - https://www.drupal.org/node/2754029": "https://www.drupal.org/files/issues/better_formats_paragraphs-2754029-15.patch"
        },
        "vendor/behat/web-api-extension": {
            "behat web api definition conflicts with mink extensions": "patches/behat_web_api/alter-definitions-text.patch"
        }
    }
}
...
1
  • This answer only rephrase the OP question.
    – tostinni
    Aug 31, 2022 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.