Skip to content

feat(scripts): migrate assets and content URLs to new blob store#48

Merged
wab merged 12 commits into
mainfrom
feat/upload-assets-target-new
May 22, 2026
Merged

feat(scripts): migrate assets and content URLs to new blob store#48
wab merged 12 commits into
mainfrom
feat/upload-assets-target-new

Conversation

@wab
Copy link
Copy Markdown
Collaborator

@wab wab commented May 22, 2026

Closes #36.

Summary

Full migration to the new Ocobo team blob store (website-blob, host ipjmp3k0z0p479cb.public.blob.vercel-storage.com).

Three layers:

  1. Upload toolingscripts/upload-assets.js learns --target legacy|new (strict token resolution, HEAD verification with retries, hardening).
  2. URL rewrite toolingscripts/update-asset-urls.js learns --target legacy|new, also rewrites legacy-host URLs to the new host when --target new, and now scans team/ + tools/ in addition to blog/, stories/, legal/.
  3. Migration executed — 141 assets uploaded (128 from assets/ + 13 tool icons fetched from the legacy store and seeded into assets/tools/), 103 URL references rewritten across 66 markdown files.

Verification

  • pnpm test → 90 passing.
  • HEAD-checked every unique new-host URL in the repo post-rewrite: 103/103 return 200.
  • grep -rln "jr0deqtyc8c5pvr8" returns 0 results — zero legacy-host references remain.
  • Code review pass landed 3 SHOULD-FIX commits (regex tightening, shared sanitizer, parseArgs signature alignment).

Commits (atomic, in order)

  1. refactor(scripts): extract testable helpers from upload-assets, drop dead branch mode
  2. feat(scripts): add --target flag to upload-assets for new blob store
  3. feat(scripts): verify uploaded URLs via HEAD requests
  4. fix(scripts): harden upload-assets per code review
  5. chore(scripts): load .env via node --env-file-if-exists in asset scripts
  6. feat(scripts): add --target flag to update-asset-urls for new blob store
  7. feat(scripts): scan team/ and tools/ for asset URL rewrites
  8. chore(assets): seed tool icons from legacy blob store (13 icons)
  9. chore(content): migrate asset URLs to new blob store (66 markdown files, 103 rewrites)
  10. fix(scripts): tighten relative-path lookbehind in updateMarkdownContent
  11. refactor(scripts): share sanitizeMessage helper across asset scripts
  12. refactor(scripts): align parseArgs signature to accept already-sliced argv

New pnpm scripts

  • pnpm upload-assets:migrate--all --target new
  • pnpm update-urls:new--target new
  • pnpm sync-assets:migrateupload-assets:migrate && update-urls:new

All four asset scripts now load .env via node --env-file-if-exists=.env so tokens don't need to be exported manually.

Test plan

  • Reviewer runs pnpm test locally (90 passing)
  • Reviewer spot-checks a few rewritten URLs in the browser, e.g. https://ipjmp3k0z0p479cb.public.blob.vercel-storage.com/content/posts/target-setting/process_target_setting.png and https://ipjmp3k0z0p479cb.public.blob.vercel-storage.com/content/tools/aircall.svg
  • Confirm the website (consuming repo) renders correctly against the new host once this lands

Follow-ups (not in this PR)

  • 3 tools (hyperline.md, outreach.md, vitally.md) have no iconUrl at all — pre-existing gap, not part of this migration.
  • Once the website is confirmed live on the new store, the legacy store can be decommissioned.
  • getChangedAssets / findAssetFiles hardening notes from earlier review still apply (monorepo support, symlink handling).

wab added 9 commits May 22, 2026 12:38
- Promise.allSettled in upload loop preserves partial successes on mid-batch failure
- verifyUrls retries (default 2x with 500ms backoff) for CDN propagation races
- HEAD requests use redirect: 'follow' explicitly
- sanitizeMessage redacts vercel_blob_rw_* tokens from error output
- parseArgs rejects unknown flags (typo detection)
- run() integration tests via vi.mock('@vercel/blob')
- mirror upload-assets: --target legacy|new (default legacy)
- when --target new, also rewrite legacy-host URLs → new-host URLs
- extract pure helpers (parseArgs, resolveBaseUrl, updateMarkdownContent, run)
- add unit tests for parsing, host resolution, all rewrite patterns
- new pnpm scripts: update-urls:new, sync-assets:migrate
103 URL replacements across 66 markdown files (42 blog/fr + 11 team + 13 tools).
All URLs HEAD-verified on the new store before commit.
@wab wab changed the title feat(scripts): upload-assets --target new for blob store migration feat(scripts): migrate assets and content URLs to new blob store May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(blob): push cleaned posts/assets/ to new website-blob store

1 participant