AUTOMATICALLY REMOVE README FILES FROM DRUPAL CORE AND OTHER SCAFFOLDING FILES
When creating a Drupal 8 or 9 project using the drupal/recommended-project composer template, you may notice during certain Composer commands that the scaffolding files are copied from an "assets" directory inside the Drupal core directory to their correct place in the codebase.
But did you know that the plugin that manages this process, drupal/core-composer-scaffold, can be easily customized in your project's composer.json file to not copy some of the scaffold files?
For example, if you don't want the main README.txt file to be created, then all you need to do is add the following to the "drupal-scaffold" data in the "extras" section of your project's composer.json:
"file-mapping": {
"[web-root]/README.txt": false
}
The file-mapping syntax is simply: "a:from". That is, copy [web-root]/README.txt from "false" (from nowhere).
The power of the scaffolding add-on doesn't stop there: you can also add additional scaffolding files and modify existing ones, all automatically.
This can be very useful when for security and privacy issues you don't want certain files to be accessible from the user's browser or because they are files that you don't want to have duplicated in different directories in your GIT repository.
For example in badly configured apache or nginx servers. Usually, these are cases where access to such files can allow malicious people to find out what version of Drupal is running the web, and if the web is more or less updated.
Have Any Project in Mind?
If you want to do something in Drupal maybe you can hire me.
Either for consulting, development or maintenance of Drupal websites.