Applying Patches - NCIOCPL/cgov-digital-platform GitHub Wiki

- ¡¡¡¡¡NEVER RUN `composer update` EVER!!!!!
- ¡¡¡¡¡NEVER try to update a composer package without having done an install first!!!!!

Note: This is for applying to patches to third-party modules. For our code, just fix it directly. 😀

Steps to Apply a Patch

To add a patch to drupal module foobar:

  1. create a branch from develop.
  2. composer cgov-clean && composer install
  3. Download (or create) the patch file.
    • Place the patch file in the patches directory, with a sub-directory structure matching the package name. e.g. Patches for drupal/core belong in patches/drupal/core and patches for drupal/paragraphs belong in patches/drupal/paragraphs.
  4. Add the entry to the “patches” section of composer.json
    "extra": {
        "patches": {
            "drupal/foobar": {
                "Patch description": "local path to patch"
            }
        }
    }
    
    • Include the patch's download URL (if applicable) in the description (e.g. "12345 : Reverse module polarity (https://www.drupal.org/file/issues/2023-09-27/polarity-12345-17.patch)")
  5. composer cgov-clean && composer install
  6. composer update --lock
  7. Launch container
  8. blt cgov:rebuild-feq && blt cgov:reinstall --no-interaction
  9. blt test