Scan block.json to generate a list of files to be copied via CopyWebpackPlugin#39653
Scan block.json to generate a list of files to be copied via CopyWebpackPlugin#39653ryanwelcher wants to merge 2 commits intotrunkfrom
Conversation
|
Size Change: 0 B Total Size: 1.21 MB ℹ️ View Unchanged
|
Interesting idea. It's very tied to the build process and the project configuration. |
These files may be required for the block to function and may be different for each block. I like that we can copy PHP files from For example, if I keep my tests in the block directory and have PHP unit tests, they will be copied over as well, or if I use one template for local dev and another for production etc.
My intent was to allow any files to be copied from |
|
In the meantime, @SantosGuillamot added in #43917 automated copying for PHP files referenced in |
|
I'm going to close this out. |
What?
The PR is a first attempt at a solution to allow block.json files to determine what files should be copied from
srcto the definedbuildWhy?
Many blocks have files that they need to reference and having them files moved from
srctobuildsimplifies working with them This is why the--webpack-copy-phpflag was added with #39171.How?
This PR allows a block to define what files need to be copied by adding a
filesproperty to block.json. This should be a comma-separated list of files or glob style patterns ie."test.xml, *.csv"etc. Each block.json is scanned and a list of files to copy is generated and passed to the CopyWebpackPlugin in the webpack configuration. This PR takes into account whether or not the--webpack-copy-phpis set currently but if this approach is adopted, it may not be needed.Testing Instructions
srcto represent blocks, giving each a block.json file and adding some extra files ietest.xmlandtest.php"files": "text.xml,test.php"There is a known side-effect in that the files are cumulative and are not copied on a per-block basis. If block one indicates a file to be copied and that same file is present in other block directories, it will be copied even if the file isn't added to the second block.json