Right now, 11.9. Using Composer and Git to Download Files - https://www.drupal.org/docs/user_guide/en/install-composer.html

Contains the following step:

. If you have not already done so, you can optionally override the default
location where Composer will put downloaded modules and themes. For example,
typically you would want contributed modules to go in a _contrib_ subdirectory
of the top-level _modules_ directory, instead of the default location of
_modules_. To make this change, edit the _composer.json_ file at the root level
in your site installation. Find the line that says +"extra": {+, and add these
lines following that line:
+
----
"installer-paths": {
    "modules/contrib/{$name}": ["type:drupal-module"],
    "modules/custom/{$name}": ["type:drupal-custom-module"],
    "profiles/contrib/{$name}": ["type:drupal-profile"],
    "themes/contrib/{$name}": ["type:drupal-theme"],
    "themes/custom/{$name}": ["type:drupal-custom-theme"],
    "libraries/{$name}": ["type:drupal-library"],
    "drush/{$name}": ["type:drupal-drush"]
},
----

As of 8.3.x however it appears that these lines, with the exception of "libraries/{$name}": ["type:drupal-library"], are all part of the composer.json file in core. See #2813897: Add composer installer-paths by default. The libraries line is intentionally left out because it is up for debate if it's needed/correct.

I propose that we remove the above step from the guide as it is no longer necessary. I think we added it previously because it was considered a best practice at the time. But, it has now been added to core so there is nothing to do.

Any objections to removing this?

CommentFileSizeAuthor
#4 2930348-4-install-composer.patch2.28 KBeojthebrave
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eojthebrave created an issue. See original summary.

eojthebrave’s picture

Additionally, this chunk in the same file is no longer necessary as of 8.3.x.

. If you have not already done so, tell Composer about the download location for
contributed modules and themes, by entering this command from the root of your
site installation:
+
----
composer config repositories.drupal composer https://packages.drupal.org/8
----

. If you have not already done so, you can optionally override the default
location where Composer will put downloaded modules and themes. For example,
typically you would want contributed modules to go in a _contrib_ subdirectory
of the top-level _modules_ directory, instead of the default location of
_modules_. To make this change, edit the _composer.json_ file at the root level
in your site installation. Find the line that says +"extra": {+, and add these
lines following that line:
+
----
"installer-paths": {
    "modules/contrib/{$name}": ["type:drupal-module"],
    "modules/custom/{$name}": ["type:drupal-custom-module"],
    "profiles/contrib/{$name}": ["type:drupal-profile"],
    "themes/contrib/{$name}": ["type:drupal-theme"],
    "themes/custom/{$name}": ["type:drupal-custom-theme"],
    "libraries/{$name}": ["type:drupal-library"],
    "drush/{$name}": ["type:drupal-drush"]
},
----

As mentioned above, the installer_paths bit is already included. And you no longer need to run the composer config repositories.drupal composer https://packages.drupal.org/8 command after #2758737: Add a packages.drupal.org to root composer.json

jhodgdon’s picture

Good catch! Agreed with all the changes above. Do you want to make a patch?

eojthebrave’s picture

Status: Active » Needs review
FileSize
2.28 KB

You bet. Here's a patch for the English language source file with the proposed changes. This should apply to both the 8.x-3.x and 8.x-4.x branches. And we can apply it to both if we want since this change was introduced to core in 8.3.x.

jhodgdon’s picture

Version: 8.x-3.x-dev » 8.x-4.x-dev
Status: Needs review » Fixed

In the attributions section:

 Adapted by https://www.drupal.org/u/jhodgdon[Jennifer Hodgdon] from
 https://www.drupal.org/docs/develop/using-composer/using-composer-with-drupal["Using Composer with Drupal"],
+and edited by https://www.drupal.org/u/eojthebrave[Joe Shindelar] at https://drupalize.me[Drupalize.Me],

We usually just say "Adapted and edited by Person A, Person B, and Person C from ..."

Other than that, looks great!

I don't really want to go back and make commits to the 3.x branch right now... and the additional instructions don't really hurt anything (they would find this stuff in the file already, so it could be confusing, but ... no one should be using the 8.3.x branch anyway). So committed it to the 4.x branch with change to attributions.

I'll send out an update to the translations list.

  • jhodgdon committed d7a76cc on 8.x-4.x
    Issue #2930348 by eojthebrave: Remove "installer_paths" step from...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Balu Ertl’s picture