drupal-scaffold
drupal-scaffold copied to clipboard
Composer tool minimal version requirement
Problem: When using the module through BLT manager (step2: https://blt.readthedocs.io/en/latest/readme/creating-new-project/), the scaffold step was never executed. There were no errors or warnings in the output, just no files after project was "scafolded".
The cause:
The root cause of the issue was due to legacy install of the composer tool: Composer version 1.1.3 2016-06-26 15:42:08.
The fix:
Once updated to Composer version 1.6.3 2018-01-31 16:28:17 everything is behaving normally.
Proposed solutions:
- Add a dependency on composer's minimal version that will always work.
- Add a warning at least, so people can diagnose the issue faster, not like me - spending good half a day on that :(.
Add a dependency on composer's minimal version that will always work.
Let's do this.
@webflo could you speculate on what would make older Composer versions incompatible with Drupal Scaffold, and/or what minimum Composer version is required?
@danepowell We added a similar dependency for drupal-project in https://github.com/drupal-composer/drupal-project/pull/170
But it looks like it is not sufficient and we should bump the version further up.
@danepowell Could you try composer 1.2.4? I think this version should work as well.
Ubuntu 16.04 ships with 1.0.0-beta2 :/
Another user has reported to me that 1.3.2 doesn't work. I haven't personally tested/verified that any versions do or don't work, these are all second-hand reports. I'll try to test later.
Actually I suspect that whatever is going on here is not version-related.
I tested by creating the following composer.json in an empty directory:
{
"require": {
"composer/installers": "~1.0",
"drupal-composer/drupal-scaffold": "^2.1.0",
"drupal/core": "^8.5"
},
"extra": {
"installer-paths": {
"docroot/core": [
"type:drupal-core"
]
}
}
}
I then downloaded Composer phars as old as 1.1.3 and ran php composer.phar install.
I then found all of the non-core files (such as index.php and .htaccess) in docroot as expected. No sign of a problem with Composer or Drupal Scaffold.
Unless someone else can consistently reproduce this, this seems like a Heisenbug, possibly related to BLT rather than Drupal Scaffold.
The issue is coming from a events that composer is triggering (I do not know the version they were added). This tool depends on them to initiate the scaffolding. In the older versions the events are not there - the scaffold does not work, as the events are not triggered and thus not executed.