Repository navigation
fix(build): make tsc build clean (49 errors → 0) - #106
Merged
Merged
Conversation
Three independent issues that together broke `npm run build` on main: 1. **47× TS5097** in `scripts/**/*.ts` — relative imports ending in `.ts` (same shape as the consumer-facing fix in #105, just for scripts). Done with a one-shot regex replace: `from "./foo.ts"` → `from "./foo"`. 80 imports across 34 files; mechanical, no semantic change. 2. **TS2322** in `scripts/migrate/phase-analyze.ts:393` — `reExport` was declared as `{ is: false, target: undefined as string | undefined }` (target required) but `isReExport(content)` returns `{ is: boolean; target?: string }` (target optional). Aligned the variable type to the return type. 3. **TS2493** in `src/cms/sectionLoaders.test.ts:36` — `vi.fn(async (props) => props)` declared a 1-arg function, so `loader.mock.calls[0]` typed as a 1-tuple, but the test destructures `[calledProps, calledReq]`. Added the second `_req: Request` parameter to the mock signature. Why it was masked: The framework publishes raw TypeScript via `package.json` `exports` pointing at `./src/...` (verified — no `dist/` in the export map). Releases run `semantic-release` directly without `npm run build`, so the build break didn't gate publishing. But it polluted `npm run check`, broke `dist/` for anyone trying to use compiled output, and made the typecheck signal worthless ("89 errors, all pre-existing" was a recurring false alarm in this session). Verification: - `npm run build` exits 0 (was exit 2) - `npm run typecheck` exits 0 (was exit 2) - vitest: 104/104 pass - `dist/src/admin/meta.js` emits with extensionless imports Total: 35 files changed, +85/-82 (mostly 1-for-1 line replacements). Made-with: Cursor
vibe-dex
added a commit
that referenced
this pull request
May 1, 2026
…checklist (#109) 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
|
🎉 This PR is included in version 2.5.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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
`npm run build` and `npm run typecheck` were both exiting with code 2 on `main` due to 49 cumulative errors. Three independent issues; this PR fixes all three.
Why it was masked
The framework publishes raw TypeScript via `package.json` `exports` pointing at `./src/...` (verified — no `dist/` in the export map). Releases run `semantic-release` directly without `npm run build`, so the build break didn't gate publishing. But it:
Verification
```
$ npm run build
$ npm run typecheck
$ npx vitest run
Test Files 9 passed (9)
Tests 104 passed (104)
$ head -2 dist/src/admin/meta.js
import { djb2Hex } from "../sdk/djb2";
import { composeMeta } from "./schema";
```
Scope
35 files, +85/-82 (~1-for-1 replacements). One method behind the scripts/ replace: a one-shot Node script that walks `scripts/**/.ts` and applies the regex `/(from\s+["'])(.[^"']).ts(["'])/g → $1$2$3`. Only matches relative imports ending in `.ts`. Doesn't touch package imports, `.json`/`.css` imports, or comments.
Test plan
Made with Cursor