From bb44c5c17c48851058d2bd9c1aec1ecac33fb55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Da=C3=9Fler?= Date: Fri, 29 Aug 2025 13:05:43 +0200 Subject: [PATCH] Add startup logging for IOR_CACHE_TTL configuration Show clear cache TTL settings when Metro starts: - Displays whether cache is disabled (TTL=0) - Shows custom TTL in human-readable format (e.g., 1m 30s) - Shows default TTL when no env variable is set - Includes cache directory location This helps developers understand what cache settings are active. --- lib/metro-ior-resolver.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/metro-ior-resolver.js b/lib/metro-ior-resolver.js index dc62dfc..6cb87eb 100644 --- a/lib/metro-ior-resolver.js +++ b/lib/metro-ior-resolver.js @@ -41,6 +41,22 @@ const CACHE_TTL = process.env.IOR_CACHE_TTL !== undefined // Use project-local cache directory instead of temp directory to avoid watchman issues const CACHE_DIR = path.join(process.cwd(), '.ior-cache', 'remote'); +// Log cache TTL configuration on startup +console.log('[IOR Resolver] Cache TTL Configuration:'); +if (CACHE_TTL === 0) { + console.log('[IOR Resolver] ✓ Cache DISABLED (IOR_CACHE_TTL=0) - Always fetching fresh'); +} else if (process.env.IOR_CACHE_TTL !== undefined) { + const ttlMinutes = Math.floor(CACHE_TTL / 60000); + const ttlSeconds = Math.floor((CACHE_TTL % 60000) / 1000); + const ttlFormatted = ttlMinutes > 0 + ? `${ttlMinutes}m ${ttlSeconds}s` + : `${ttlSeconds}s`; + console.log(`[IOR Resolver] ✓ Cache TTL set to ${ttlFormatted} (IOR_CACHE_TTL=${CACHE_TTL}ms)`); +} else { + console.log('[IOR Resolver] ✓ Cache TTL using default: 1 hour (3600000ms)'); +} +console.log(`[IOR Resolver] ✓ Cache directory: ${CACHE_DIR}`); + /** * Ensure cache directory exists */