fix(ci): generate route tree before typecheck + enforce LF line endings

Two CI gaps surfaced on first push:

1. typecheck failed because tsc -b ran before vite build, but
   src/routeTree.gen.ts is only generated by the Vite plugin during
   build. tsc has nothing to typecheck against.

   Fix: install @tanstack/router-cli and chain `tsr generate` before
   tsc in the typecheck and build scripts. Now any environment that
   runs typecheck cold (CI, fresh clone) generates the route tree
   first.

   Also added a top-level `route-tree` script so the same command is
   reusable elsewhere if needed.

2. format:check would fail on Windows working trees because
   git autocrlf (default on Windows) checks files out with CRLF, but
   .prettierrc pins endOfLine: "lf". Locally the format:check
   intermittently passed/failed depending on whether files had been
   recently auto-formatted.

   Fix: .gitattributes with `* text=auto eol=lf` enforces LF in every
   working tree. Plus explicit overrides for binary blobs (images) and
   the route tree file. `git add --renormalize .` brought the index in
   line with the new policy; no actual file content changed.

CI on the next push should now see the same green gates the local
working tree shows.
This commit is contained in:
2026-05-02 18:54:55 +02:00
parent ac87a511a3
commit 79e50289fe
5 changed files with 165 additions and 14 deletions
+4 -2
View File
@@ -5,12 +5,13 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"build": "pnpm route-tree && tsc -b && vite build",
"preview": "vite preview",
"lint": "eslint .",
"typecheck": "tsc -b --noEmit",
"typecheck": "pnpm route-tree && tsc -b --noEmit",
"format": "prettier --write .",
"format:check": "prettier --check .",
"route-tree": "tsr generate",
"test": "echo \"no tests yet\" && exit 0"
},
"dependencies": {
@@ -33,6 +34,7 @@
"@eslint/js": "^10.0.1",
"@tailwindcss/vite": "^4.2.4",
"@tanstack/react-query-devtools": "^5.100.8",
"@tanstack/router-cli": "^1.166.40",
"@tanstack/router-devtools": "^1.166.13",
"@tanstack/router-plugin": "^1.167.32",
"@types/node": "^24.12.2",