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
Comment #2
joseph.olstadComment #3
joseph.olstadSo 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_uiStep 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!
Comment #4
joseph.olstadIt's very easy, as described above.
I've also documented the process here:
https://a1.11pro.ca/en/public-documentation/drupalorg/dx-composer-replac...
https://a1.11pro.ca/fr/documentation-publique/drupalorg/dx-composer-repl...
Comment #5
joseph.olstadhttps://www.drupal.org/project/jq_ui/releases/8.x-1.7