Problem/Motivation

When a contrib module or dependency becomes problematic, we may need to bypass a dependency to be able to move forward on a short timeframe.

Composer replaces to the rescue!

@cmlara pointed out that he's used composer replaces to get around this.

He's created the bunny module as a replacement for rabbitmq

In composer, he uses composer replaces to replace drupal/rabbitmq with drupal/bunny.

@cmlara has offered to create a writeup for this. We should add a DX note for this documentation. I'll probably create my own documentation page on my public facing website.

https://git.drupalcode.org/project/bunny/-/blob/1.x/composer.json?ref_ty...

Directive in composer.json

    "replace": {
        "drupal/rabbitmq": "3.1.0"
    },

Steps to reproduce

a contrib module becomes problematic

fork it

then use composer replaces

Proposed resolution

See issue summary and steps to reproduce

Remaining tasks

Add DX notes for documentation purposes and for maintainers of this project and others.

Comments

joseph.olstad created an issue. See original summary.

joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

Title: DX - composer replaces - forking process is easier than we thought » DX - composer replace - forking process is easier than we thought

So basically the crux is the line in the composer.json and a folder with a copy of the forked module. The foldername is the machine name of the module. Have a look at jq_ui.

https://www.drupal.org/project/jq_ui/releases/8.x-1.6

Drop-in replacement for jquery_ui.

Steps to replace jquery_ui:

Step 1) composer require drupal/jq_ui

Step 2) drush en jq_ui -y;

Step 3) drush cr;

Step 4) Sip from a marguerita

How is this possible you might ask? composer replace and a repaired copy of the jquery_ui in the jquery_ui folder inside of jq_ui!

joseph.olstad’s picture

Status: Active » Fixed
joseph.olstad’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.