Allow setting of copy instructions per bundle #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Start implementing the configurable
copy
instructions for webpack projects.Configuring this theme in
webpack.py
:Results in the
copy
instructions to be generated in theconfig.json
file:Limitations
Right now, there is no validation about the to/from locations not going out of bounds, and the values are simple string literals.Also, it will of course require another PR forInvenio-Assets
so that the new config is actually used inwebpack.config.js
.Edit: Sanity checks have been implemented in
webpack.config.js
: inveniosoftware/invenio-assets#173Checking in Python?
Theflask_webpackext.WebpackBundleProject
automatically sets some paths in the project's configuration based on the Flask application which may be useful for out-of-bounds checks.I'm not entirely sure if that is sound from a hierarchy perspective though – it'd be rough for
pywebpack
to rely on values fromflask-webpackext
.Edit: I just implemented the out-of-bounds checks in JS, see above.
Checking in JS?
Maybe the validation should happen in
webpack.config.js
?As long as the check (and possible abort) happens before any files are actually copied, I think it should be fine.
Sure that can be swapped out, but changing the
WebpackBundleProject
in Python is just as easy, it just requires changing theWEBPACKEXT_PROJECT
config value.Ease of use?
Edit: See next comment
Another question is how to make the configuration more usable.As described above, the to/from values are just plain string literals which requires some knowledge about the structure in the
instance_path
to be useful at all.In the current
webpack.config.js
, thefrom
paths are usually based on the current directory, and theto
paths are usually based on theconfig.build.assetsPath
:Perhaps it would be nice to enable the use of certain "dynamic" base paths.