Deploy
Deploys the joost-blog site to Cloudflare Pages.
What it does
- Fetches YouTube transcripts for any new videos (
scripts/fetch-transcripts.mjs)- Uses cached transcripts when the file already exists
- Requires
yt-dlpon PATH (install viabrew install yt-dlp)
- Regenerates the NLWeb search index (
scripts/generate-nlweb-index.mjs)- Scans all blog posts, pages, and videos
- Skips draft content
- Appends each video's transcript to its search body
- Generates embeddings for new/changed content via Cloudflare API
- Uses cached embeddings for unchanged content
- Stages the updated index + any new transcript files
- Commits with a descriptive message
- Pushes to origin, triggering the Cloudflare Pages deploy
Steps
- Run
node scripts/fetch-transcripts.mjsand show the output to the user - Run
node --env-file-if-exists=.env scripts/generate-nlweb-index.mjsand show the output - Check what changed under
src/generated/withgit status --short src/generated/ - Stage:
git add src/generated/nlweb-index.json src/generated/nlweb-index.mjs src/generated/embedding-cache.json src/generated/transcripts/(plus any other staged content the user is shipping) - Run
git statusto show the user what will be deployed - Ask the user for a commit message (suggest one based on what changed)
- Commit and push to origin
- Confirm the deploy was triggered
Notes
- The
CF_API_TOKENandCF_ACCOUNT_IDenvironment variables must be available for embedding generation; they live in.env. Pass--env-file-if-exists=.envto Node so the script picks them up. - The prebuild step was removed from package.json — the index must be regenerated locally before deploying.
- If only code changes (no content changes), the index regeneration will show "0 to generate" and the cached index is reused.
fetch-transcripts.mjsis a no-op for videos that already have a cached transcript, so it's safe to run on every deploy.