(this is my first post of a Drupal.org Issue ever)
I was tasked in our Team to move our Drupal 8.8.x-dev build from using the Drupal Composer drupal-scaffold package https://github.com/drupal-composer/drupal-scaffold to using the Drupal 8 core composer scaffolding package (drupal/core-composer-scaffold).
I am trying to determine if I should submit a patch/merge request for changes to this core scaffolding package, because we are in need of additional configuration/functionality from it.
Problem is...
We have our web-root directory as ./www. The following is our composer-scaffold config in composer.json file:
...
"composer-scaffold": {
"allowed-packages": [
"drupal/core"
],
"locations": {
"web-root": "./www"
}
},
...
Also, we keep our /vendor directory outside the web-root, not inside... ie. NOT ./www/vendor
When the composer scaffolding runs it generates the necessary autoload.php files in various directories. The one that is generated in our ./www directory looks like this:
./www/autoload.php
<?php
/**
* @file
* Includes the autoloader created by Composer.
*
* This file was generated by drupal-composer/drupal-scaffold.
* https://github.com/drupal-composer/drupal-scaffold
*
* @see composer.json
* @see index.php
* @see core/install.php
* @see core/rebuild.php
* @see core/modules/statistics/statistics.php
*/
return require __DIR__ . '/./vendor/autoload.php';
The problem with this... is that it cannot find the /vendor/autoload.php file, because it does not exist at ./www/vendor/autoload.php. It does exist at ./vendor/autoload.php.
I did find a composer vendor-dir setting in the overall composer config vendor-dir. But, if I set it there... it messes up other composer stuff.
I was unable to find any vendor-dir setting in the composer scaffolding documentation or files themselves.
I see in the code itself that the function getVendorPath()
in drupal/core-composer-scaffold/Handler.php is getting the vendor path from the composer config setting, as $vendor_dir = $this->composer->getConfig()->get('vendor-dir');
I am open to any advice on this. I am also able to code in contrib changes to allow an additional composer.json "locations"vendor-dir that could be used... if set. If not... it could default back to the overall composer config setting.
Example of new composer.json scaffolding config I could use:
...
"composer-scaffold": {
"allowed-packages": [
"drupal/core"
],
"locations": {
"web-root": "./www",
"vendor-dir": "../vendor"
}
},
...