From aad337234ea26181a36bed5025ab65456117fe61 Mon Sep 17 00:00:00 2001 From: Donkie Date: Thu, 30 Jul 2026 21:34:26 +0200 Subject: [PATCH] Compile paraglide before type-checking client_v2 The type check assumed $lib/paraglide existed, but it's gitignored output of the paraglide vite plugin, so it only appears once something runs vite. svelte-check doesn't, which left the job resolving ~40 imports of $lib/paraglide/{messages,runtime} against nothing on any fresh checkout -- CI every time, and a new clone locally. It went unnoticed because the job had been dying at exit 127 before it could get far enough to report, and because a working tree that has ever run dev or build has the directory sitting there. The compiler ships a CLI, so this costs a compile rather than a full vite build. Its flags live in a package.json script that `check` and the hook both call, leaving one copy to keep in sync with the plugin options in vite.config.ts. Claude-Session: https://claude.ai/code/session_01UB5KocsTBm9GL5x3Uuup5F --- client_v2/package.json | 5 +++-- lefthook.yml | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/client_v2/package.json b/client_v2/package.json index 5d0f8ea0..cd0ed774 100644 --- a/client_v2/package.json +++ b/client_v2/package.json @@ -12,8 +12,9 @@ "preview": "vite preview", "test": "vitest run", "test:watch": "vitest", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "paraglide": "paraglide-js compile --project ./project.inlang --outdir ./src/lib/paraglide --strategy localStorage preferredLanguage baseLocale", + "check": "npm run paraglide && svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "npm run paraglide && svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "format": "prettier --write .", "lint": "prettier --check . && eslint .", "lint:eslint": "eslint .", diff --git a/lefthook.yml b/lefthook.yml index 27ebd6a0..8049dbb5 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -36,8 +36,12 @@ pre-commit: stage_fixed: true - name: Run type check on client_v2 files root: "client_v2/" - # svelte-kit sync generates .svelte-kit/tsconfig.json, which svelte-check needs. - run: ./node_modules/.bin/svelte-kit sync && ./node_modules/.bin/svelte-check --tsconfig ./tsconfig.json + # Both prerequisites are gitignored generated code, absent on a fresh + # clone: paraglide compiles $lib/paraglide (normally done by the vite + # plugin, so a non-build check never triggers it), and svelte-kit sync + # generates .svelte-kit/tsconfig.json. npm run keeps the paraglide + # flags in package.json only, so they can't drift from vite.config.ts. + run: npm run paraglide && ./node_modules/.bin/svelte-kit sync && ./node_modules/.bin/svelte-check --tsconfig ./tsconfig.json # Same as pre-commit but no fixes ci: @@ -72,6 +76,6 @@ ci: run: ./node_modules/.bin/prettier --check . - name: Run type check on client_v2 files root: "client_v2/" - # svelte-kit sync generates .svelte-kit/tsconfig.json, which svelte-check needs. - run: ./node_modules/.bin/svelte-kit sync && ./node_modules/.bin/svelte-check --tsconfig ./tsconfig.json + # See the ci hook's copy of this job for why paraglide runs first. + run: npm run paraglide && ./node_modules/.bin/svelte-kit sync && ./node_modules/.bin/svelte-check --tsconfig ./tsconfig.json