A developer had a file they had wanting the 'drupal-scaffold" to append to another core file. When they no longer needed that stuff appended, they updated the append file to be empty. The scaffold still included the old contents of the append file in error.
I needed to add some code to the robots.txt
file. So I created a file in the location assets/my-robots-additions.txt
and added this to my composer.json
file:
"extra": {
"drupal-scaffold": {
"file-mapping": {
"[web-root]/robots.txt": {
"append": "assets/my-robots-additions.txt"
}
}
}
}
When I run composer install
, it adds the line(s) I had in the append file to the robots.txt
file.
After a while, the extra line(s) were no longer needed. So just removed the lines in the append file. I did not change the composer.json, but the assets/my-robots-additions.txt
was updated to empty.
The next time I run composer install
, the contents of the robots.txt
file does not change. The append file is empty, but the scaffolded file still has the lines that are no longer in the append file.
If I remove the lines that says to append in the composer.json
and run composer install
, then it removes the appended data.
Or if I update the append file to include something (a comment, some other content, etc.) then it also works.
It would be helpful if the scaffold would work with an empty file to be appended. I haven't dug into the code, so I'm not sure how that can be changed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.