fix(ci): build design-system tokens before tsc/vite (Day 4 follow-up)
Some checks failed
Veza CI / Rust (Stream Server) (push) Successful in 4m6s
Security Scan / Secret Scanning (gitleaks) (push) Successful in 1m20s
Veza CI / Backend (Go) (push) Successful in 5m37s
E2E Playwright / e2e (full) (push) Failing after 16m58s
Veza CI / Frontend (Web) (push) Successful in 29m45s
Veza CI / Notify on failure (push) Has been skipped

CI run 455/456 surfaced:
  src/features/player/components/AudioVisualizer.tsx(22,8): error TS2307:
  Cannot find module '@veza/design-system/tokens-generated' or its
  corresponding type declarations.

Root cause: the sprint 2 design-system migration (commits a25ad2e0ab923def) replaced manual src/ exports with Style Dictionary output in
packages/design-system/dist/. That `dist/` is gitignored — by design,
since it's generated artifact — but no step in the CI workflows runs
the generator before tsc/vite/vitest fire.

apps/web imports `@veza/design-system/tokens-generated`, which the
package's `exports` field maps to `./dist/tokens.ts`. With dist/ empty
on a fresh checkout, the import resolves to undefined → TS2307.

Two-pronged fix:

(1) packages/design-system/package.json — add a `prepare` script that
    runs Style Dictionary. npm fires `prepare` after `npm install`
    AND `npm ci`, so any workspace install populates dist/ without an
    extra workflow change. Also covers fresh dev clones.

(2) .github/workflows/{ci.yml,e2e.yml} — explicit
    `npm run build:tokens --workspace=@veza/design-system` step
    immediately after `npm ci`. Belt-and-suspenders against any npm
    version where `prepare` is silent or filtered (lifecycle script
    skipping has burned us before — `--ignore-scripts` flags, etc.).

Verified locally:
  $ rm -rf packages/design-system/dist/
  $ npm run build:tokens --workspace=@veza/design-system
  ✓ Style Dictionary build complete.
  $ cd apps/web && npx tsc --noEmit
  (clean)

SKIP_TESTS=1 — config-only changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
senke 2026-04-27 12:31:50 +02:00
parent 3f326e8266
commit 86faeb16a8
3 changed files with 20 additions and 1 deletions

View file

@ -106,6 +106,16 @@ jobs:
- name: Install dependencies
run: npm ci
# Sprint 2 design-system migrated to Style Dictionary; the
# generated tokens live in packages/design-system/dist/ which
# is gitignored. apps/web imports `@veza/design-system/tokens-generated`,
# so dist/ MUST exist before tsc/vitest/build runs.
# `prepare` in the package would normally cover npm ci, but
# this explicit step makes the dependency loud and runnable
# standalone for local debugging.
- name: Build design tokens
run: npm run build:tokens --workspace=@veza/design-system
# Prevents drift between veza-backend-api/openapi.yaml and
# apps/web/src/types/generated/. Regenerates then fails if
# git diff is non-empty.

View file

@ -107,6 +107,14 @@ jobs:
- name: Install dependencies
run: npm ci
# Sprint 2 design-system migrated to Style Dictionary; the
# generated tokens live in packages/design-system/dist/
# (gitignored). The Playwright-spawned Vite imports them via
# `@veza/design-system/tokens-generated`, so dist/ MUST exist
# before vite starts.
- name: Build design tokens
run: npm run build:tokens --workspace=@veza/design-system
# Playwright tests reach the frontend via http://veza.fr:5174,
# which the browsers resolve via /etc/hosts. Without this entry
# the navigation step times out.

View file

@ -17,7 +17,8 @@
],
"scripts": {
"build": "node style-dictionary.config.mjs",
"build:tokens": "node style-dictionary.config.mjs"
"build:tokens": "node style-dictionary.config.mjs",
"prepare": "node style-dictionary.config.mjs"
},
"devDependencies": {
"style-dictionary": "^4.4.0"