Skip to content

docs(migration-skill): use decoVitePlugin in templates + add cleanup checklist - #109

Merged
vibe-dex merged 1 commit into
mainfrom
docs/migration-skill-modernize
May 1, 2026
Merged

vibe-dex merged 1 commit into
mainfrom
docs/migration-skill-modernize

Conversation

@vibe-dex

@vibe-dex vibe-dex commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Three skill updates that capture this week's migration learnings as durable artifacts.

File Change Why
`templates/vite-config.md` Use `decoVitePlugin()` instead of inlining 60 lines of stub source Old template duplicated framework code; new one matches what real sites use
`references/vite-config/README.md` Add `decoVitePlugin()` to the "minimal" config The "minimal" example was actually broken — no Deco site can boot without the plugin
`references/post-migration-cleanup.md` (new) 6-step cleanup checklist with detection scripts Distills cleanup work surfaced in baggagio#5/#6/#7 and deco-start#107

Both `.agents/skills/` and `.cursor/skills/` copies stay in sync.

Detail

templates/vite-config.md

Before (113 lines): Inlined the entire `deco-server-only-stubs` plugin — `react-dom/server`, `node:async_hooks`, `node:stream`, etc. — plus stub source for each. Pre-dates `decoVitePlugin()`.

After (~190 lines): Uses `decoVitePlugin()` from `@decocms/start/vite`, and adds the production-grade boilerplate real sites actually need but the old template omitted:

  • VTEX dev proxy (`/api/`, `/checkout`)
  • CSP `frame-ancestors` header for admin embedding
  • `build.sourcemap: "hidden"` and PLUGIN_WARNING filter
  • React Compiler with `target: "19"`
  • `pure: ["console.log"]` to strip in production
  • Full `dedupe` list including `@decocms/start` + `@decocms/apps` (not just TanStack/React)

Plus a documented section on what older site templates inline (and why this template doesn't), so users on older `@decocms/start` versions know what to add.

references/vite-config/README.md

The "post-migration minimal config" was missing `decoVitePlugin()` entirely. Without it, the client bundle crashes on transitively imported server modules — `Cannot read properties of undefined (reading 'AsyncLocalStorage')` and similar. The minimal config is now genuinely minimal but actually works, with a pointer to the full template for production sites.

references/post-migration-cleanup.md (new)

A dedicated reference distilling the cleanup work that surfaces on every real migration:

  1. Detect + delete unused `src/lib/*` shims (with a copy-paste detection script). Real-world data: baggagio had 11 generated shims and 0 used; casaevideo had 11 generated and 1 used.
  2. Drop `site-manual-chunks` and `deco-stub-meta-gen` inline plugins — both framework-provided in `@decocms/start >= 2.5.0`.
  3. Drop the `runtime.ts` `invoke` shim — `@decocms/start/sdk` exports both `invoke` (singleton) and `createAppInvoke` (typed factory).
  4. Drop site-local `withSiteGlobals` workaround — framework helper is now opt-in.
  5. Verify VTEX util imports point direct at `@decocms/apps/vtex/...`, not at dead `~/lib/vtex-*` shims (the migration script's stale `phase-cleanup.rewriteVtexUtilImports` was silently regressing them).
  6. Search for orphan `TODO: move into framework` comments and either migrate, file an issue, or delete.

Plus a verification checklist.

Why now

Each cleanup step has a corresponding shipped or in-flight PR validating it on real sites:

Cleanup item Validating PR(s)
1. Delete `src/lib/*` shims baggagio-tanstack#7
2. Drop inline vite plugins deco-start#108
3. Drop `runtime.ts` `invoke` baggagio-tanstack#6 + deco-start#103
4. Drop `withSiteGlobals` workaround baggagio-tanstack#5 + deco-start#102
5. VTEX import regression deco-start#107
6. Orphan `TODO` audit (no specific PR; cheap habit)

The checklist isn't speculative.

Scope discipline

Skill content only. No source / runtime / template-script changes. Plan tracker (`MIGRATION_TOOLING_PLAN.md`) intentionally not included — that's a session-scratch document, not the skill.

Test plan

  • CI passes (no code changes; just markdown)
  • Skim diff for any cross-reference links that broke
  • (Manual) Use the new template to scaffold a fresh Deco site and verify it boots

Made with Cursor

…checklist

Two stale areas in the deco-to-tanstack-migration skill, plus one
brand-new reference distilling battle-tested cleanup patterns.

## Changes

### `templates/vite-config.md` — drop ~80 lines of stub duplication

The old template inlined the entire `deco-server-only-stubs` plugin
(react-dom/server, node:async_hooks, node:stream, node:stream/web,
tanstack-head-scripts) — ~60 lines that exactly mirror what
`@decocms/start/vite`'s `decoVitePlugin()` already does.

The new template uses `decoVitePlugin()` and adds the production-grade
boilerplate that real sites actually need (and that the old version
omitted): VTEX dev proxy, CSP frame-ancestors header, build sourcemap,
PLUGIN_WARNING filter, react-compiler config, `pure: ["console.log"]`,
and the full `dedupe` list including `@decocms/start` + `@decocms/apps`.

### `references/vite-config/README.md` — fix "minimal" config that was broken

The "post-migration minimal config" was missing `decoVitePlugin()`
entirely. Without it, the client bundle crashes on transitively imported
server modules. Added the plugin + the minimum dedupe list, and
cross-referenced the full template.

### `references/post-migration-cleanup.md` — NEW

Dedicated reference distilling the cleanup work that surfaces on every
real migration:

1. Detect + delete unused `src/lib/*` shims (with a copy-paste detection
   script). Real-world data: baggagio-tanstack had 11 generated shims
   and 0 actual users; casaevideo had 11 generated and 1 used.
2. Drop the `site-manual-chunks` and `deco-stub-meta-gen` inline plugins
   that are now framework-provided in `@decocms/start >= 2.5.0`.
3. Drop the `runtime.ts` `invoke` shim — `@decocms/start/sdk` exports
   both `invoke` (singleton) and `createAppInvoke` (typed factory).
4. Drop site-local `withSiteGlobals` workaround — framework helper is
   now opt-in and tested.
5. Verify VTEX util imports point direct at `@decocms/apps/vtex/...`,
   not at dead `~/lib/vtex-*` shims (the migration script's stale
   `phase-cleanup.rewriteVtexUtilImports` was silently regressing
   them).
6. Search for orphan `TODO: move into framework` comments and either
   migrate, file an issue, or delete.

Plus a verification checklist.

## Why now

Validated in this session against three reference sites
(casaevideo-storefront, baggagio-tanstack, casaevideo). Each cleanup
step has a corresponding shipped or in-flight PR (#103/#106/#107/#108
on framework, #5/#6/#7 on baggagio-tanstack), so the checklist isn't
speculative.

## Scope discipline

This PR only edits skill content; no source/runtime changes. Both
`.agents/skills/` and `.cursor/skills/` copies stay in sync.

Made-with: Cursor
@vibe-dex
vibe-dex merged commit ee10b19 into main May 1, 2026
1 check passed
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant