Skip to content

fix(frontend-vite): generate routes before build and add a clean-clone CI build (D-0536) - #213

Merged
acamarata merged 1 commit into
mainfrom
dw1-nchat-1
Oct 25, 2026
Merged

acamarata merged 1 commit into
mainfrom
dw1-nchat-1

Conversation

@acamarata

Copy link
Copy Markdown
Collaborator

D-0536 (fixed)

frontend-vite/src/routes.generated.tsx is gitignored (*.generated.*) and nothing produced it, so vite build failed from a clean clone.

  • scripts/generate-routes.mjs (+ pure routes-lib.mjs) builds the table from the F-NCHAT-VITE-ROUTE header every src/pages/*Page.tsx already carries. Output carries a GENERATED BY ... DO NOT HAND EDIT marker. It runs as predev, prebuild, pretype-check, pretest.
  • Route sets compared with the previously hand-run output: identical (23 public, 83 protected, 107 pages incl. HomePage).
  • scripts/routes-lib.test.mjs (6 tests): every page declares a unique route, / exists, the public allowlist has no stale entry, rendered table is marked and split correctly, bad/duplicate headers are rejected.
  • New workflow .github/workflows/frontend-vite.yml: checks out nself-org/packages at the same pinned sha as the desktop workflows into the sibling path, installs both lockfiles, builds the five linked @nself/* packages (dist + d.ts), then pnpm --filter @nchat/frontend-vite build and test.
  • The 8 tsc errors from the row come from tsc falling through tsconfig paths (../../packages/@nself/*/dist/index.d.ts) into the sibling's raw src and applying this app's noUnusedLocals to it (3 at the pinned sha). Building the packages' dist first removes them, which is why the job has that step. No change to the app's strictness.
  • README documents the clean-clone build and the generator.

Left open from the row (a decision, not code): whether @nself/i18n should share the app's i18next. Finding recorded in the README: the app imports only @nself/i18n (no i18next/react-i18next import in src), so there is one i18n context today. The declared react-i18next dep in frontend-vite is unused; removing it touches the lockfile, so I left it.

Before/after (scratch clean layout <tmp>/nchat + <tmp>/packages@8a5cc53, packages dist built):

  • before (no generator): npx vite build -> Could not load .../src/routes.generated (imported by src/App.tsx)
  • after: pnpm build -> tsc clean, vite build built 107 lazy page chunks; pnpm test -> 6/6 passed
  • actionlint .github/workflows/frontend-vite.yml clean

D-0535 (no change: already resolved)

gh api repos/nself-org/nchat/dependabot/alerts?state=open returns 0. #473/#485 i18next-http-backend fixed (frontend ^4.0.2, locked 4.0.4), #482 postcss-selector-parser fixed (only 7.1.6 locked), #476-#481 otel instrumentations fixed (fe0db64 floors; @sentry/nextjs and @sentry/node are 11.9.0 in the lockfile), #474/#475 stream-json dismissed tolerable_risk with reason (detox -> bunyamin needs 1.x; re-entry D-1080), #484 sprintf-js withdrawn by GitHub (410).

D-0011 (no change: blocked)

Needs the owner's call (relicense AGPL, replace @signalapp/libsignal-client / ffmpeg-static, or accept and document). LICENSE is still plain MIT and both deps are still in frontend/package.json. Not touched, per the row.

…e CI build (D-0536)

routes.generated.tsx is gitignored and had no generator, so vite build
failed from a clean clone. Add scripts/generate-routes.mjs (reads each
page's F-NCHAT-VITE-ROUTE header), run it as pre-dev/build/type-check/test,
and add a frontend-vite workflow that checks out the sibling packages repo,
builds the linked @nself/* dist and builds + tests the app.
@github-actions

Copy link
Copy Markdown

PR Checks Summary

Check Status
Lint & Format ⏭️ skipped
Type Check ⏭️ skipped
Unit Tests ⏭️ skipped
Build ⏭️ skipped

✅ All checks passed! Ready for review.

@github-actions

Copy link
Copy Markdown

Security Scan Results: PASSED

Scanner Critical High
SAST 0 0
Dependencies 0 0

@acamarata
acamarata merged commit b1cba48 into main Oct 25, 2026
35 of 38 checks passed
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