Cache Priming
This project updates launch.json before builds to prime the cache with all
content URLs that are marked for sitemap inclusion. The list is generated from
Contentstack entries and written to the cache.cachePriming.urls array.
How It Works
- The
updateLaunchConfig.mjsscript queries Contentstack forpage,blogpost,guide,live_stream, andpersonentries. - Only entries with
metadata.include_in_sitemap === trueare included. - Existing
launch.jsonsettings are preserved; onlycache.cachePriming.urlsis overwritten.
When It Runs
The script runs automatically during npm run build via the prebuild hook:
npm run prebuildRequired Environment Variables
The script is skipped if any required values are missing:
NEXT_PUBLIC_CONTENTSTACK_API_KEYNEXT_PUBLIC_CONTENTSTACK_DELIVERY_TOKENNEXT_PUBLIC_CONTENTSTACK_ENVIRONMENT
The script loads .env files using @next/env, so the same environment file
setup that works for next build will be picked up here. If the required
values are still unset, the build continues and launch.json is not modified.