-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scan block.json to generate a list of files to be copied via CopyWebpackPlugin #39653
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
src
to the definedbuild
Why?
Many blocks have files that they need to reference and having them files moved from
src
tobuild
simplifies working with them This is why the--webpack-copy-php
flag was added with #39171.How?
This PR allows a block to define what files need to be copied by adding a
files
property 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-php
is set currently but if this approach is adopted, it may not be needed.Testing Instructions
src
to represent blocks, giving each a block.json file and adding some extra files ietest.xml
andtest.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