ddev-drupal-contrib icon indicating copy to clipboard operation
ddev-drupal-contrib copied to clipboard

Could not understand preferred installation method for optional dependencies

Open scotteuser opened this issue 10 months ago • 1 comments

Its unclear how to add optional dependencies.

I wanted to test the 'ai' module which has a number of optional dependencies (e.g. 'suggest' in composer.json or other sub-module dependencies enforced by hook_requirements in submodules).

The readme does not make it clear how to do this. I am happy to open a PR to update the readme, but wanted to check if this is the preferred approach:

Once:

  1. Clone drupal/recommend-project ddev exec wget https://raw.githubusercontent.com/drupal/recommended-project/refs/heads/11.x/composer.json (or e.g. 10.x)
  2. Remove require-dev drupal/core-dev (since that is already part of install instructions) ddev composer remove drupal/core-dev

Every time you install an additional optional dependency:

  1. Install desired modules e.g. ddev composer require drupal/ai_provider_openai --dev --prefer-source
  2. Run ddev poser
  3. Remove the dependency on 'self' from the contrib folder so it does not conflict with the symlinked version in the root ddev exec rm -rf web/modules/contrib/ai

(of course making these commands more generic like PROJECT_NAME to match current docs)

scotteuser avatar Apr 13 '25 10:04 scotteuser

You dont need to clone recomended-project.

You do need to add any dependencies in require-dev. If you have merge perms you can save the new composer.json so other users will get the dependency automatically.

weitzman avatar Apr 21 '25 17:04 weitzman

See https://github.com/ddev/ddev-drupal-contrib/issues/113

NickStees avatar Jun 05 '25 15:06 NickStees