2

I am looking to transform from drupal-project to recommended-project and seeing some difference in the folder structure.

drupal-project contains a drush folder outside'web' folder and 'composer.json' contains line "drush/drush": "^9.0.0".

However, recommended-project does not have this setup although I could still install drush using composer require drush/drush. Still drush isn't installed outside 'web' folder.

Can I please know why the setup has changed and a way to have drush folder outside 'web'?

2

1 Answer 1

5

It is important to understand the distinction between the Drupal core project templates and the drupal-composer project template.

  • The Recommended and Legacy project templates are maintained by Drupal core. As a result, it only includes those components validated by the core maintainers to be very stable and needed by most Drupal users. The bar for this is very high, and the complexity of the component plays into the decision. For example, Drush is very stable and used by most Drupal users, but it is a fairly large and complex project, and therefore has not been added to a core project template. Use the Recommended project if you'd like your web root inside a "web" directory, or the Legacy project if you would like your web root at the project root.

  • The drupal-composer/drupal-project template is maintained by the community. It contains more components that are likely to be useful to a wide range of users. If a bug or configuration problem is found with this project, then it must be reported and fixed through the community repository on GitHub.

The latest version of drupal-composer/drupal-project uses the same core scaffold components as the drupal/recommended-project Composer template provided by Drupal core. It is safe to start with the drupal-composer/drupal/project template for your site.

If you add Drush to your site, either by starting with drupal-composer/drupal-project, or by adding it manually to the drupal/recommended-project, then the Drush binary will always be installed inside the vendor directory. This will be inside the web root for the Legacy project, or outside the webroot for the Recommended project, and for drupal-composer/drupal-project.

If you decide to start with the Recommended project and add Drush, you should also look at the composer.json for drupal-composer/drupal-project and see if there is any configuration in the "extra" section that you might want to copy over for your site.

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