Skip to content

Migrate MyApp.Client to the Vite+ toolchain - #2

Merged
mythz merged 3 commits into
mainfrom
voidzero
Oct 31, 2026
Merged

mythz merged 3 commits into
mainfrom
voidzero

Conversation

@mythz

@mythz mythz commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Moves the React client from Vite 7 + ESLint + tsc to Vite+, VoidZero's unified toolchain:

Before After
Dev / build Vite 7, tsc -b && vite build vp dev / vp build (Vite 8, Rolldown)
Type check tsc -b vp check (Oxlint type-aware, TypeScript Go)
Lint ESLint 9 + 7 plugin packages (config failed to load on main) vp lint (Oxlint)
Format none vp fmt (Oxfmt)
Tests none vp test (Vitest 5), 5 seed tests

All tool config (lint, fmt, test) is in one vite.config.ts. The npm scripts are still the entry points, so the .NET integration (npm run build in the publish target, RunNodeProcess, the .esproj) is unchanged, and no global vp install is needed.

Commits

  1. Format MyApp.Client with Oxfmt: formatting only, listed in .git-blame-ignore-revs.
  2. Migrate MyApp.Client to the Vite+ toolchain:
    • vite-plus 1.4.0 with npm overrides
    • lint rules ported from the ESLint config
    • ESLint, the duplicate PostCSS config and postinstall.mjs removed (empty DBs are already migrated on app startup)
    • seed tests added
    • deps upgraded to latest, including TypeScript 7
    • package-lock.json committed
  3. Update CI and docs for Vite+, add VS Code workspace:
    • new client job in build.yml; setup-vp replaces setup-node in build-container.yml
    • AGENTS.md and README updated, including that dtos.ts is regenerated on .NET startup
    • MyApp.code-workspace added

Worth reviewing

  • Hook rule findings. The ESLint config never loaded, so these had never been reported. lib/auth.tsx got small fixes that don't change behaviour: the HOC's inner component is renamed to PascalCase, and shouldRedirect is now declared before the useEffect that uses it. appAuth() is a hook without a use prefix and is shared by 7 templates, so it keeps its name and the rule is suppressed per line. A rename across all templates is a separate change.
  • Lint warnings. Two rules that ESLint never ran (no-floating-promises, react/purity) are set to warnings. vp check passes with 12 warnings.
  • Bundle size is 584 kB, up from 513 kB. This isn't caused by Vite+: a fresh install of main's Vite 7 setup also produces 583 kB, because newer dependency versions resolve when there's no lockfile.
  • VS Code. Open MyApp.code-workspace rather than the folder. The Oxc extension only resolves vite-plus from a workspace root's node_modules.

Verified locally

  • npm ci, then npm run check, npm run test:run and npm run build all pass. Builds take about 190 ms, down from about 915 ms.
  • Type errors are still caught: a planted TS2322 fails vp check.
  • Running through .NET at https://localhost:5001:
    • the Vite client and React Refresh are served through the proxy
    • /api/Hello responds
    • the HMR websocket upgrades (101)
  • dotnet publish runs vp build and copies the output to wwwroot.
  • With an empty database, the app bootstraps the schema and seed data on startup, without postinstall.mjs.
  • Not done: clicking through the UI in a browser, and running the CI workflows on GitHub (this PR is their first run).

🤖 Generated with Claude Code

mythz and others added 3 commits October 31, 2026 20:27
Formatting-only change, no code changes, so it can be ignored in git blame
via .git-blame-ignore-revs. Uses the fmt settings added to vite.config.ts in
the following Vite+ migration commit (4-space indent, no semicolons, single
quotes, 160 char print width).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace Vite 7 + ESLint + tsc with Vite+ (vite-plus 1.4.0): Vite 8 (Rolldown),
Vitest 5, Oxlint (type-aware, via tsgolint) and Oxfmt, configured in one
vite.config.ts. npm scripts stay the entry points for the .NET build/dev
integration, so no global `vp` install is required.

- vite-plus pinned with npm overrides for vite -> @voidzero-dev/vite-plus-core
- lint rules ported from the ESLint config (which failed to load on main);
  `npm run check` replaces `tsc -b` in the build
- remove ESLint config + packages, duplicate PostCSS config, and
  postinstall.mjs (empty DBs are migrated on app startup)
- add test scripts and seed tests (utils, gateway, HelloApi)
- fix rules-of-hooks findings in lib/auth.tsx without changing behaviour or
  the shared appAuth() API
- upgrade deps to latest, incl. TypeScript 7 and @vitejs/plugin-react 6
- commit package-lock.json

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- build.yml: new client job (vp check, vp test run, vp build)
- build-container.yml: voidzero-dev/setup-vp replaces setup-node + npm install
- AGENTS.md / README.md: Vite+ commands; dtos.ts is regenerated on .NET
  startup, so `npm run dtos` is typically never needed
- MyApp.code-workspace: adds MyApp.Client as its own root so the Oxc
  extension resolves the local vite-plus; TypeScript 7 language server
- .git-blame-ignore-revs: ignore the Oxfmt formatting commit

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mythz
mythz merged commit 384471a into main Oct 31, 2026
4 checks passed
@mythz
mythz deleted the voidzero branch October 31, 2026 12:50
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