1

I understand the composer-merge-plugin allows the Drupal root composer.json file to load core/composer.json on runtime. I also understand require-dev will only pull dependencies for the root composer.json file (see this link).

How can I force one/all core/composer.json dependencies (including the required-dev ones) to be pulled if I want without hacking the root composer.json file e.g. with a composer require vendor/package?

1 Answer 1

1

By default, Composer will install also the development requirements, if you don't use the --no-dev option.
I ran composer create-project drupal/drupal test 8.3.*@dev, and in the output of the command I could see the following:

Installing drupal/drupal (8.3.x-dev 8a84ec5556f354861f1ddc5d7a80081b91ca42df)
- Installing drupal/drupal (8.3.x-dev 8a84ec5)
Cloning 8a84ec5556 from cache
Created project in test
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 76 installs, 0 updates, 0 removals

[Omissis]

  • Installing drupal/coder (8.2.11) Downloading: 100%
  • Installing phpunit/phpunit (4.8.28) Downloading: 100%

If you downloaded the archived release for example from https://www.drupal.org/project/drupal/releases/8.2.7, which doesn't include the development requirements, you need to run composer update from the directory containing core and composer.json.
I tested composer update --dev after removing the vendor directory from the test directory created from the previous command, and I got this output:

You are using the deprecated option "dev". Dev packages are installed by default now.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 76 installs, 0 updates, 0 removals

3
  • My issue with this is I'm currently pulling from a git clone and installing via drush site-install as there's no way that I know of we can install the tip of 8.4.x (aka chase HEAD) with create-project. But regardless, your answer does provide an interesting workaround to the original issue. Thanks.
    – anavarre
    Mar 17, 2017 at 18:42
  • You can use composer create-project drupal/drupal test 8.4.*@dev for Drupal 8.4.x.
    – apaderno
    Mar 18, 2017 at 23:22
  • I was more talking about something like composer create-project drupal/drupal test 8.4.*@dev#<commithash> - Filed stackoverflow.com/questions/42872173/… accordingly.
    – anavarre
    Mar 19, 2017 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.