feat: Cloudinary to Sanity asset migration tool#599
Closed
codercatdev wants to merge 8 commits intomainfrom
Closed
feat: Cloudinary to Sanity asset migration tool#599codercatdev wants to merge 8 commits intomainfrom
codercatdev wants to merge 8 commits intomainfrom
Conversation
Sanity-first migration approach: - Phase 1: Discover Cloudinary references in Sanity documents - Phase 2: Extract unique Cloudinary URLs to migrate - Phase 3: Download from Cloudinary & upload to Sanity - Phase 4: Update document references (cloudinary.asset → image/file refs) - Phase 5: Generate migration report Features: - Handles cloudinary.asset plugin objects and plain URL strings - Supports both res.cloudinary.com/ajonp and media.codingcat.dev URLs - Resume support with incremental mapping persistence - Dry-run mode for previewing changes - Configurable concurrency and per-phase execution - Retry with exponential backoff Co-authored-by: builder <builder@miriad.systems>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Skip coverImage.derived[], videoCloudinary.derived[], and other sub-fields of cloudinary.asset objects that contain transformed URL variants. These don't need separate uploads since the entire cloudinary.asset object gets replaced. Reduces unique URLs from 6,985 to 282 base assets. Co-authored-by: builder <builder@miriad.systems>
…mages Schema changes: - coverImage: cloudinary.asset → image (with hotspot) - content[]: cloudinary.asset block → image block - videoCloudinary: cloudinary.asset → file - ogImage: cloudinary.asset → image - Remove cloudinarySchemaPlugin from sanity.config.ts Component rewrites: - cover-image.tsx: CldImage → Next.js Image + urlForImage() - block-image.tsx: CldImage → Next.js Image + urlForImage() - cover-video.tsx: CldVideoPlayer → native HTML video with Sanity CDN - cover-media.tsx: update type checks for Sanity refs - avatar.tsx: CldImage → Next.js Image + urlForImage() - portable-text.tsx: cloudinary.asset handler → image handler - youtube.tsx, youtube-short.tsx, pro-benefits.tsx, user-related.tsx: remove CloudinaryAsset type refs, use asset._ref checks New file: - sanity/lib/image.ts: urlForImage() helper using @sanity/image-url Co-authored-by: builder <builder@miriad.systems>
…dd LQIP TODO, document video URL format - Delete unused cloudinary-image.tsx and cloudinary-video.tsx - Add TODO comment for LQIP blur placeholder support in cover-image.tsx - Add explanatory comment for Sanity file ref URL construction in cover-video.tsx Co-authored-by: builder <builder@miriad.systems>
…image URLs - queries.ts: settingsQuery ogImage projection (secure_url → full image object) - utils.ts: resolveOpenGraphImage uses urlForImage() instead of secure_url - layout.tsx: ogImage uses resolveOpenGraphImage() properly - devto/route.tsx: coverImage + cloudinary.asset serializer → urlForImage() - hashnode/route.tsx: coverImage + cloudinary.asset serializer → urlForImage() - rss.ts: coverImage.secure_url → urlForImage() - package.json: remove next-cloudinary and sanity-plugin-cloudinary Co-authored-by: builder <builder@miriad.systems>
… params - Add raw Cloudinary object detection (old-format docs without _type) - Add stripTransformations() to remove Cloudinary URL params - Add getOriginalUrl() to construct canonical URLs from public_id - Prevents uploading derived variants (avif, webp, resized copies) Re-run results: 433 clean originals uploaded (down from 6,970 with variants) Co-authored-by: builder <builder@miriad.systems>
Deletes unreferenced Sanity assets left over from migration. Safety: checks document references before deleting, preserves all active assets. Supports --dry-run mode. Co-authored-by: builder <builder@miriad.systems>
…s, content-type headers - Add full iTunes namespace to podcast feed (itunes:author, itunes:image, itunes:category, itunes:season, itunes:episode, enclosure tags) - Create buildPodcastFeed() with hand-crafted XML for Apple Podcasts compatibility - Add rssPodcastQuery with podcastFields (spotify, season, episode, guest) - Fix hardcoded Cloudinary image URL in feed channel - Fix content-type headers: text/xml → application/rss+xml - Fix feed links to be content-type-specific (blog, podcasts, courses) - Fix copyright year to be dynamic - Fix YouTube feed links pointing to non-existent routes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cloudinary → Sanity Asset Migration
Complete migration from Cloudinary to Sanity's native image/file pipeline — both data and code.
What Changed
Data Migration (already executed on
devdataset)Schema Changes
sanity/schemas/partials/base.tscoverImagecloudinary.assetimage(with hotspot)sanity/schemas/partials/base.tscontent[]blockcloudinary.assetimagesanity/schemas/partials/content.tsvideoCloudinarycloudinary.assetfilesanity/schemas/singletons/settings.tsxogImagecloudinary.assetimage(with hotspot)sanity.config.tscloudinarySchemaPlugin()Component Rewrites (6 files)
cover-image.tsxCldImage+public_idImage+urlForImage()block-image.tsxCldImage+public_idImage+urlForImage()cover-video.tsxCldVideoPlayer<video>+ Sanity CDN URLcover-media.tsxCloudinaryAssettypesasset._refchecksavatar.tsxCldImage+public_idImage+urlForImage()portable-text.tsxcloudinary.assethandlerimagehandlerAdditional Component Updates (4 files)
youtube.tsx,youtube-short.tsx,pro-benefits.tsx,user-related.tsx— removedCloudinaryAssettype imports, updated to useasset._refchecksNew Files
sanity/lib/image.ts—urlForImage()helper using@sanity/image-urlscripts/migration/— Migration tool (5-phase pipeline with resume, dry-run, retry)Migration Tool Features
--dry-run)res.cloudinary.com/ajonpandmedia.codingcat.devURLsFollow-up Tasks
next-cloudinaryandsanity-plugin-cloudinaryfrompackage.json(kept for now)sanity typegen generateto updatesanity/types.ts