Score:0

How to run drush using locally modified repo (from github fork)

sy flag

I have my own drush repo forked from https://github.com/drush-ops/drush and have a local clone of this, as I want to start modifying and potentially push back to add a new function. How do I configure a local drupal site to use my local repo? I have tried replacing vendor/drush with a symlink to my repo but that produced the following

PHP Fatal error:
Declaration of DrupalCodeGenerator\Command\DrupalGenerator::getDestination(array $vars): ?string
must be compatible with DrupalCodeGenerator\Command\GeneratorInterface::getDestination()
in /path-to-my-drush-repo/vendor/chi-teck/drupal-code-generator/src/Command/DrupalGenerator.php
 on line 141

I have tried tracking down the cause of that problem, but I dont think this is right way to solve it. I must be doing something else wrong. I want to contribute to drush development but getting stuck here.

Score:0
id flag

Add the path to the local Git working copy as a VCS repository in the Drupal project with a file:// URI. Specify dev-your-branch-name for the package version.

id flag
You can alternatively use a “path” repository type: https://stackoverflow.com/questions/29994088/composer-require-local-package
Jonathan1055 avatar
sy flag
Thanks cilefen. After I figured out that the file:// url needs three / it recognised the path `{ "type": "vcs", "url": "file:///path/to/my/repo/drush/" }, `
Jonathan1055 avatar
sy flag
after doing `composer update drush/drush:"11.x-dev"` it appears that I have the 11.x-dev branch, but I can't get the modified command to be found.
Jonathan1055 avatar
sy flag
I have now got to the situation where the environment is recognising my new branch. Using `dev-11.x` only complained that all it could find was `11.x-dev` which was not my repo. So I checked out a new drush branch, say, `my-bugfix` and then had `require "drush/drush": "dev-my-bugfix"` and this works of sorts. I can commit to the branch and then `composer update drush/drush` and this gets my modified code. But I can't get it to simply use the latest changes without any commit and update. There must be a way to use the repo dynamically without having to commit and update every change?
id flag
You can also check out a branch of a given project in the vendor directory for real-time work.
Jonathan1055 avatar
sy flag
Solved this my replacing the directory `vendor/drush/drush/src/Drupal/Commands` with a symlink to the corresponding directory in my drush git repo
Jonathan1055 avatar
sy flag
ah, comments crossed, I did not see your last. Thank you.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.