From 553b6d114ea0b6e8c2a4b062ad9806403656cac0 Mon Sep 17 00:00:00 2001 From: Demis Bellot Date: Sun, 1 Nov 2026 01:35:31 +0800 Subject: [PATCH 1/4] Migrate MyApp.Client to the Vite+ toolchain Next.js keeps building the app (next dev/build/start unchanged). Vite+ (vite-plus 1.4.0) takes over the rest of the tooling: Vitest 5, Oxlint (type-aware, via tsgolint) and Oxfmt, configured in one vite.config.ts. npm scripts stay the entry points, so no global `vp` install is required. - vite-plus pinned with npm overrides for vite -> @voidzero-dev/vite-plus-core - vitest.config.ts merged into vite.config.ts; tests import from vite-plus/test - new check/lint/fmt/outdated/upgrade scripts; typecheck runs `vp check --no-fmt --no-lint` - lint: eslint:recommended + typescript-eslint recommended equivalents, plus react hooks and nextjs rules (the template had no ESLint before) - fix lint findings: unused imports/vars, `extends {}`, ValidateAuth hook naming/order in lib/auth.tsx; suppress useMetadata, swrClient.get() and appAuth() false positives without changing the shared APIs - remove postinstall.mjs (empty DBs are migrated on app startup), autoprefixer - replace npm-shrinkwrap.json with package-lock.json - drop tsconfig baseUrl (removed in TypeScript Go) - add seed tests (gateway, HelloApi component) - upgrade deps, incl. TypeScript 7, @vitejs/plugin-react 6, Next.js 16.4 Co-Authored-By: Claude Opus 5.5 --- MyApp.Client/.gitignore | 1 + MyApp.Client/AGENTS.md | 41 + MyApp.Client/app/posts/[slug]/page.tsx | 1 - MyApp.Client/components/intro.test.tsx | 16 + MyApp.Client/components/intro.tsx | 2 +- MyApp.Client/components/layout.tsx | 2 +- MyApp.Client/components/nav.tsx | 2 +- MyApp.Client/lib/auth.tsx | 23 +- MyApp.Client/lib/gateway.client.ts | 4 +- MyApp.Client/lib/gateway.test.ts | 26 + MyApp.Client/lib/gateway.ts | 5 +- MyApp.Client/lib/utils.test.ts | 9 +- ...{npm-shrinkwrap.json => package-lock.json} | 6801 +++++++++-------- MyApp.Client/package.json | 81 +- MyApp.Client/postinstall.mjs | 50 - MyApp.Client/tsconfig.json | 1 - MyApp.Client/vite.config.ts | 73 + MyApp.Client/vitest.config.ts | 18 - MyApp.Client/vitest.setup.ts | 5 +- 19 files changed, 4005 insertions(+), 3156 deletions(-) create mode 100644 MyApp.Client/AGENTS.md create mode 100644 MyApp.Client/components/intro.test.tsx create mode 100644 MyApp.Client/lib/gateway.test.ts rename MyApp.Client/{npm-shrinkwrap.json => package-lock.json} (61%) delete mode 100644 MyApp.Client/postinstall.mjs create mode 100644 MyApp.Client/vite.config.ts delete mode 100644 MyApp.Client/vitest.config.ts diff --git a/MyApp.Client/.gitignore b/MyApp.Client/.gitignore index 046716d..02ec697 100644 --- a/MyApp.Client/.gitignore +++ b/MyApp.Client/.gitignore @@ -33,3 +33,4 @@ yarn-error.log* # vercel .vercel +.vitest/ diff --git a/MyApp.Client/AGENTS.md b/MyApp.Client/AGENTS.md new file mode 100644 index 0000000..1af9261 --- /dev/null +++ b/MyApp.Client/AGENTS.md @@ -0,0 +1,41 @@ + + +# Using Vite+, the Unified Toolchain for the Web + +This project is using Vite+, a unified toolchain built on top of Vite, Rolldown, Vitest, tsdown, Oxlint, Oxfmt, and Vite Task. Vite+ wraps runtime management, package management, and frontend tooling in a single global CLI called `vp`. Vite+ is distinct from Vite, and it invokes Vite through `vp dev` and `vp build`. Run `vp help` to print a list of commands and `vp --help` for information about a specific command. + +Docs are local at `node_modules/vite-plus/docs` or online at https://viteplus.dev/guide/. + +## Built-in Commands vs Scripts + +`vp ` runs a built-in command. `vp run ` runs a `package.json` script or a `vite.config.ts` task. Scripts cannot overwrite built-ins, so `vp dev` and `vp run dev` may do different things. Check `package.json` and `vite.config.ts` first, and run `vp run ` when the project defines a script or task with that name. + +## Running Scripts + +Run TypeScript and JavaScript files with `vpx `, for example `vpx ./scripts/seed.ts --dry-run`. It handles enums, decorators, JSX, and tsconfig `paths`, so do not add `tsx` or `ts-node` to run scripts. `vpx --watch ` reruns the file when a file it uses changes, in place of `tsx watch`. `vp node ` runs plain Node.js. + +## Tool Versions + +Run `vp toolchain` to show versions and relationships in the active Vite+ +release. Add a tool name to select part of the graph. For example, run +`vp toolchain vite`. Use `--global` to ignore the local `vite-plus` package. Use +`vp why ` to show the package-manager dependency graph. + +## Review Checklist + +- [ ] Run `vp install` after pulling remote changes and before getting started. +- [ ] Run `vp check` and `vp test` to format, lint, type check and test changes. +- [ ] Check if there are `vite.config.ts` tasks or `package.json` scripts necessary for validation, run via `vp run