feat(cache-magento): add stamp caching for vendor/ directory (#245)

Adds an opt-in `stamp` mode that caches the extracted `vendor/`
directory in addition to the Composer download cache. On a warm
hit, `composer install` is effectively a no-op and shaves 2–5
minutes off a full Magento install.
This commit is contained in:
Damien Retzinger
2026-05-09 15:42:40 -04:00
parent 2d7238de14
commit 8d00f8149a
6 changed files with 260 additions and 39 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Args: working_directory exclude_from_stamp
# working_directory: absolute path (caller is responsible for realpath resolution)
# exclude_from_stamp: newline-separated list of composer package names to exclude
WORKING_DIR="$1"
EXCLUDE_FROM_STAMP="${2:-}"
VENDOR="${WORKING_DIR}/vendor"
PATHS="${VENDOR}/**"$'\n'"!${VENDOR}/**/"$'\n'"!${VENDOR}/magento/magento2-base"$'\n'"!${VENDOR}/magento/magento2-base/**"$'\n'"!${VENDOR}/mage-os/magento2-base"$'\n'"!${VENDOR}/mage-os/magento2-base/**"
while IFS= read -r pkg; do
pkg="${pkg#"${pkg%%[![:space:]]*}"}"
pkg="${pkg%"${pkg##*[![:space:]]}"}"
[[ -z "$pkg" ]] && continue
PATHS="${PATHS}"$'\n'"!${VENDOR}/${pkg}"$'\n'"!${VENDOR}/${pkg}/**"
done <<< "$EXCLUDE_FROM_STAMP"
echo "$PATHS"