feat(cache): add additional_caches config for custom asset cache paths#906
Open
Soner (shyim) wants to merge 2 commits intomainfrom
Open
feat(cache): add additional_caches config for custom asset cache paths#906Soner (shyim) wants to merge 2 commits intomainfrom
Soner (shyim) wants to merge 2 commits intomainfrom
Conversation
Allow extensions to define custom paths for asset caching via .shopware-extension.yml under build.zip.assets.additional_caches.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for caching/restoring additional custom asset output directories for extensions via a new build.zip.assets.additional_caches config option, integrating it into asset source discovery, cache-key hashing, and cache store/restore.
Changes:
- Extend
.shopware-extension.ymlschema/config model withbuild.zip.assets.additional_cachesentries. - Include
additional_caches[].source_pathsin asset content hashing to influence cache keys. - Store/restore extra cached folders alongside standard administration/storefront caches.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
shopware-extension-schema.json |
Adds schema definitions for build.zip.assets.additional_caches. |
internal/extension/config.go |
Adds config structs for additional_caches and validates source_paths non-empty. |
internal/extension/project.go |
Propagates additional_caches from extension config into discovered asset.Sources. |
internal/extension/asset.go |
Converts extension config additional_caches into asset.AdditionalCache for sources. |
internal/asset/source.go |
Extends asset.Source to carry AdditionalCaches and defines AdditionalCache type. |
internal/extension/asset_config.go |
Incorporates source_paths from additional caches into GetContentHash() input collection and maps source caches into runtime config. |
internal/extension/asset_cache.go |
Stores/restores additional cached folders and enables caching even when only additional_caches are present. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Replace sanitizeCacheKeySuffix with xxhash to avoid collisions - Add path validation: reject absolute paths and paths escaping root - Fix early return bug: admin cache miss no longer skips storefront/additional cache restore - Use filepath.SkipDir for node_modules to skip entire subtree - Add tests for validation, hash invalidation, and node_modules skipping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
additional_cachesconfig option underbuild.zip.assetsin.shopware-extension.ymlsource_pathsis required for each entryExample config
Test plan
additional_cachesentriessource_pathsSHOPWARE_CLI_EXPERIMENTAL_ASSET_CACHING=1)