Since Drupal's composer.json file is in the root directory (which is far better than it being in the core directory), the question has been raised: Is it acceptable to modify Drupal's composer.json file?
This is an important question, however, it appears that the Drupal best practice of never modifying core still remains true.
In naderman& RobLoach's presentation at DrupalCon Munich, it was recommended that Drupal core become a dependency of Drupal. This would allow end-users to modify Drupal's composer.json file, while at the same time maintaining Drupal core's own composer.json file that would not be touched.
This setup is similar to the architecture imposed by Symfony and Symfony Standard.
For this to happen, it will require some major changes to how Drupal is developed.
Drupal core will be in it's own repository with it's own composer.json file.
I propose the composer.json name
be:drupal/drupal-core
This would also change the type
from drupal-core
to the default library
.
Lastly a new repository will be created with the drupal directory structure (excluding core).
I propose the composer.json name
be:drupal/drupal
The composer.json file would have only have one requirement: drupal/drupal-core
This would be immensely helpful for developers as they'd be able to use Drupal's root composer file to manage the dependencies of the project, without affecting Drupal core.
The end user wouldn't see much of a difference, the packing script would need to be modified to run
composer create-project drupal/drupal;
cd project;
composer install;
and then package
project
into the zip file that is downloadable on drupal.org.
Doing this would make the change transparent to most Drupal users and provide all module developers with an immense amount of flexibility.
Thanks!