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 of Drupal's core directory to their proper 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 scaffolding files?
For example, if you don't want the core README.txt scaffolding file created, then all you need to do is add the following to the "drupal-scaffold" data of the "extra" section of your project's composer.json:
"file-mapping": { "[web-root]/README.txt": false }
The syntax of the file-mapping is simply: "to: from". Meaning, copy the [web-root]/README.txt from "false" (nowhere).
The power of the scaffolding plugin doesn't stop there - you can also add additional scaffolding files and modify existing ones, all automatically.
You can manually run the scaffolding plugin using the following to test:
composer drupal:scaffold
Want to learn more about Composer? Check out our Composer Basics for Drupal Developers workshop.