@everystack/cli 0.2.25 → 0.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cli/discover.ts +4 -0
package/package.json
CHANGED
package/src/cli/discover.ts
CHANGED
|
@@ -313,9 +313,11 @@ export async function discoverConfig(
|
|
|
313
313
|
// ---------------------------------------------------------------------------
|
|
314
314
|
|
|
315
315
|
const CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
316
|
+
const CACHE_VERSION = 2; // Bump when CachedOutputs schema changes to invalidate stale caches
|
|
316
317
|
|
|
317
318
|
interface CachedOutputs {
|
|
318
319
|
_cachedAt: number;
|
|
320
|
+
_version?: number;
|
|
319
321
|
routerUrl?: string;
|
|
320
322
|
apiFunctionName?: string;
|
|
321
323
|
imageFunctionName?: string;
|
|
@@ -335,6 +337,7 @@ export async function getCachedConfig(stage: string): Promise<DiscoveredConfig |
|
|
|
335
337
|
try {
|
|
336
338
|
const raw = await fs.readFile(cachePath(stage), 'utf8');
|
|
337
339
|
const cached: CachedOutputs = JSON.parse(raw);
|
|
340
|
+
if ((cached._version || 0) < CACHE_VERSION) return null;
|
|
338
341
|
if (Date.now() - cached._cachedAt > CACHE_TTL_MS) return null;
|
|
339
342
|
if (!cached.apiFunctionName || !cached.updatesBucket || !cached.clientBundlesBucket) {
|
|
340
343
|
return null;
|
|
@@ -359,6 +362,7 @@ export async function getCachedConfig(stage: string): Promise<DiscoveredConfig |
|
|
|
359
362
|
export async function setCachedConfig(stage: string, config: DiscoveredConfig): Promise<void> {
|
|
360
363
|
const data: CachedOutputs = {
|
|
361
364
|
_cachedAt: Date.now(),
|
|
365
|
+
_version: CACHE_VERSION,
|
|
362
366
|
routerUrl: config.baseUrl,
|
|
363
367
|
apiFunctionName: config.apiFunctionName,
|
|
364
368
|
imageFunctionName: config.imageFunctionName,
|