Skip to content

Drop the duplicate vite type generator and make CI run just check - #5

Merged
asg017 merged 1 commit into
keep-ruff-out-of-markdownfrom
drop-duplicate-vite-typegen
Sep 25, 2026
Merged

asg017 merged 1 commit into
keep-ruff-out-of-markdownfrom
drop-duplicate-vite-typegen

Conversation

@asg017

@asg017 asg017 commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator
🤖 Claude-generated PR description

Stacked on #4. This is the PR that makes just check green and puts both
quality gates in CI.

The problem

just check was red, on this branch and on main:

node_modules/vite/dist/node/index.d.ts: 37 × TS2580 Cannot find name 'Buffer'
                                        11 × TS2307 Cannot find module 'node:*'
                                         1 × TS2503 Cannot find namespace 'NodeJS'
vite.config.ts(3,55): error TS2307: Cannot find module 'fs'

frontend/package.json's check script ran svelte-check and
tsc -p tsconfig.node.json. The svelte-check half passed; the second half
type-checked vite.config.ts, which needed Node globals — and needed them only
because of an inline page-data-types vite plugin that imported fs and
json-schema-to-typescript.

That plugin duplicated just types-pagedata, which already generates the same
page-data types via the json2ts CLI. Two generators for one artifact, and the
redundant one was what made the type-check impossible without another dependency.

The fix is deletion

Rather than adding @types/node, the duplicate generator goes:

  • the page-data-types plugin (buildStart + handleHotUpdate) and its fs /
    json-schema-to-typescript imports are gone; plugins: [svelte()]
  • frontend/tsconfig.node.json deleted
  • check is now just svelte-check --tsconfig ./tsconfig.app.json

No @types/node was added. json-schema-to-typescript stays in
package.json — just types-pagedata shells out to its json2ts binary.
just types-pagedata is now the single generator, so the two can no longer
disagree.

Verified the removal took effect: .types.ts mtimes are unchanged across a
just frontend run, so the build no longer writes them at all.

CI now runs both gates

just check and just format-check added to .github/workflows/test.yml. CI
previously ran neither, which is how both drifted red unnoticed — and why #2 and
#4 were needed to make them simultaneously satisfiable first.

Verification

Check Before After
just check exit 2, 50 TS errors exit 0
just format-check GREEN (via #4) GREEN
just types-check-fresh GREEN GREEN
just telemetry-doc-check GREEN GREEN
just test 171 171, no tests deleted

uvx ty check → "All checks passed!"; svelte-check → 96 FILES 0 ERRORS.
just frontend builds and leaves the tree clean. Repo-wide grep confirms zero
remaining references to tsconfig.node or page-data-types.

One behaviour change

Editing a *_schema.json during just dev-with-hmr no longer regenerates types
as a side effect of the dev server. just types-watch is the recipe for that. No
documentation referenced the old behaviour.

Out of scope

publish.yml consolidation — the ticket floats it as optional; not done.

🤖 Generated with Claude Code

`just check` was red for everyone: the `check` npm script ran
`tsc -p tsconfig.node.json` over vite.config.ts, which needs Node globals,
so it failed on ~50 errors from vite's own .d.ts plus a "cannot find module
'fs'" on our own import. The tempting fix is `@types/node`, but the only
reason those Node globals were needed at all is a `page-data-types` vite
plugin that read `src/page_data/*_schema.json` and wrote `.types.ts` --
duplicating what `just types-pagedata` already does through the json2ts
CLI. Two generators for one artifact, and the redundant one was also the
one that could silently disagree with the committed types (it skipped the
prettier pass the Justfile recipe runs).

So delete it instead of typing it. `just types-pagedata` is now the single
generator, `tsconfig.node.json` has nothing left to check, and the `check`
script is just svelte-check. `json-schema-to-typescript` stays in
package.json -- the Justfile shells out to its json2ts binary. Editing a
schema during `just dev-with-hmr` no longer regenerates types as a side
effect of the dev server; `just types-watch` is the recipe for that.

None of this was caught because CI ran neither `just check` nor
`just format-check`, so add both, before the build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@asg017
asg017 force-pushed the drop-duplicate-vite-typegen branch from ceaffbd to 358d009 Compare September 25, 2026 17:30
@asg017
asg017 added this pull request to stack #19 September 25, 2026 18:17
@asg017
asg017 merged commit e41a250 into main Sep 25, 2026
15 checks passed
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.

1 participant