Closed gmazzap closed 3 years ago
@gmazzap after running again my tests, I realized that it might be a good idea to optionally ignore pre-compiled assets or maybe even make it the default because if there are pre-compiled assets, those will be used and no local code changes will be taken into account. What do you think?
@cristianobaptista unlike the lock file, pre-compiled assets are opt-in: you need to have specific configuration to make it work.
If no configuration is there, no pre-compiled asset will be used.
When some configuration will be there... it would/should be env-specific, something like this:
{
"pre-compiled": {
"env": {
"prod": {
"source": "assets-${version}",
"target": "./assets/",
"adapter": "gh-release-zip"
},
"dev": {
"source": "assets-${hash}",
"target": "./assets/",
"adapter": "gh-action-artifact"
}
}
}
}
With such configuration, unless --env=prod
or --env=dev
is passed as argument
to the composer compile-assets
command (or the COMPOSER_ASSET_COMPILER
environment variable1 is set to one of those two values), pre-compiled assets would be ignored.
This is why, to be honest, I wouldn't mix the --ignore-lock
with pre-compiled assets (and in that case the flag should me renamed to something like --recompile
).
Even because, in that case using both --ignore-lock --env=prod
would be unclear which one takes precedence.
1 Personally, on my dev machine, I've COMPOSER_ASSET_COMPILER
environment variable globally set to local
, to have that default value when no --env
flag is used.
@gmazzap sounds reasonable to me. Thanks for your clarification and insights 😁
Please check if the PR fulfills these requirements
[x] The commit message follows our guidelines
[x] Tests for the changes have been added (for bug fixes / features)
[x] Docs have been added / updated (for bug fixes / features)
What kind of change does this PR introduce?
A new
--ignore-lock
flag is added to thecompile-assets
command.No.
The way the new flag work is documented here: https://github.com/inpsyde/composer-asset-compiler/blob/add-ignore-lock-flag/README.md#ignoring-lock