feat(migrate): provision analytics metadata in decocms Supabase - #418
Closed
JonasJesus42 wants to merge 2 commits into
Closed
feat(migrate): provision analytics metadata in decocms Supabase#418JonasJesus42 wants to merge 2 commits into
JonasJesus42 wants to merge 2 commits into
Conversation
…enerate time `website/loaders/redirectsFromCsv.ts` blocks only carry a `from` CSV path and an empty `redirects: []`; the Fresh/Deno loader that read the CSV at runtime was never ported to TanStack. Worse, these blocks are typically nested inside `site.routes[]`, and the runtime `loadRedirects` only scans TOP-LEVEL decofile entries — so CSV-backed bulk redirects never fired on migrated sites. Read each referenced CSV from `public/` at generate time (Node, fs available) and emit synthetic top-level `__csv_redirects__<name>` blocks that `loadRedirects` already understands. Runtime stays synchronous and does no I/O. CSV blocks are merged with lower precedence than curated redirect blocks, so a CMS-authored redirect wins over a bulk CSV row for the same `from`. Also fix `parseRedirectsCsv` to skip a `from,to` header row instead of turning it into a bogus `/from -> to` redirect. Verified against the granadobr-tanstack decofile: 18,455 CSV rows materialized, matchRedirect returns 301s for the migrated URLs, curated blocks unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
After bootstrap, updates sites.metadata with analytics: "onedollarstats" via Supabase Management API (requires SUPABASE_ACCESS_TOKEN). Falls back to printing the SQL manually if token is not available. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Substituído por #419 com branch correta |
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.
Summary
deco-migrate, após o bootstrapsites.metadatacomanalytics: "onedollarstats"via Supabase Management APISUPABASE_ACCESS_TOKENno ambiente; se ausente, printa o SQL para rodar manualmenteTest plan
deco-migratecomSUPABASE_ACCESS_TOKENsetado → confirmar log✓ <site> → analytics: onedollarstats🤖 Generated with Claude Code
Summary by cubic
Adds a “Provision analytics” step to
deco-migrateand materializes CSV-backed redirects at generate time so migrated sites route correctly and are tracked in decocms.New Features
deco-migrate: After bootstrap, updates decocmssites.metadatatoanalytics: "onedollarstats"via Supabase. RequiresSUPABASE_ACCESS_TOKEN; prints manual SQL if missing.blocks-cli: Readspublic/*.csvreferenced bywebsite/loaders/redirectsFromCsv.tsand emits top‑level synthetic__csv_redirects__<name>blocks thatloadRedirectsconsumes. CSV blocks are merged with lower precedence than curated redirect blocks. Also re-materializes these blocks inreadBlockDeltaso snapshots stay in sync.Bug Fixes
@decocms/blocksredirects CSV parser now skips afrom,to[,type]header row (avoids a bogus/from -> torule).Written for commit 31f5ac3. Summary will update on new commits.