You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: migrate to pnpm, Tailwind v4, Next 16, add Vitest
- Replace npm/package-lock with pnpm; allowBuilds for sharp in pnpm-workspace.yaml; pin packageManager.
- Upgrade Tailwind to v4 (CSS-first): drop tailwind.config.*, use @tailwindcss/postcss, @import "tailwindcss", @custom-variant dark for class-based dark mode.
- Upgrade to Next 16 + eslint-config-next 16; migrate ESLint to flat config (eslint.config.mjs); replace next lint with eslint.
- Add Vitest + Testing Library; mock swagger-ui-react; stub window.matchMedia for jsdom; cover version switching and dark-mode behavior.
- Refactor app/page.tsx: derive system theme via useSyncExternalStore + userOverride to satisfy react-hooks/set-state-in-effect.
- UI fixes: drop stray .swagger-ui class from outer wrapper (was bleeding Swagger's text colors onto controls); remove double-invert override on .scheme-container so "Servers" stays readable in dark mode; relabel selector to "phpMyFAQ Version"; match controls-header width to Swagger content.
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+
## Project
6
+
7
+
Static site that hosts the phpMyFAQ API documentation.
8
+
It renders `swagger-ui-react` against OpenAPI specs fetched at runtime from the `thorsten/phpMyFAQ` GitHub repo (branches `4.0`, `4.1`, `main`).
9
+
Deployed on Vercel — pushing to `main` triggers deployment.
10
+
11
+
## Commands
12
+
13
+
-`pnpm dev` — Next.js dev server on http://localhost:3000 (Turbopack)
14
+
-`pnpm build` — production build
15
+
-`pnpm start` — serve the production build
16
+
-`pnpm lint` — ESLint flat config (`eslint.config.mjs`), composing `eslint-config-next/core-web-vitals` and `eslint-config-next/typescript`. Note: Next 16 removed `next lint`, so this script invokes `eslint` directly.
17
+
-`pnpm test` — Vitest (jsdom + Testing Library). `pnpm test:watch` for watch mode. A single test: `pnpm test -- path/to/file.test.tsx -t "name"`. Test setup (`vitest.setup.ts`) stubs `window.matchMedia` (jsdom doesn't implement it) and resets the `dark` class on `<html>` between tests. `swagger-ui-react` is mocked in component tests to avoid pulling its CSS/runtime.
18
+
19
+
## Architecture
20
+
21
+
- Next.js 16 App Router (Turbopack default), React 19, TypeScript, Tailwind CSS 4 (CSS-first; no `tailwind.config.*` — configure via `@theme`/`@custom-variant` in `app/globals.css`). PostCSS uses `@tailwindcss/postcss`.
22
+
- The entire UI is a single client component: `app/page.tsx`. It owns version selection, dark-mode toggle, and renders `<SwaggerUI url={...}/>`. New API versions are added by extending the `apiUrls` map and the corresponding `<option>` entries there.
23
+
-`app/layout.tsx` and `app/globals.css` set up the global shell. Dark-mode styling for Swagger UI relies on the `.swagger-container-dark` / `.swagger-container-light` class wrappers plus the `dark` class on `<html>`.
24
+
- Security headers (`X-Frame-Options: DENY`, `X-Content-Type-Options: nosniff`, `Referrer-Policy: origin-when-cross-origin`) are configured in `next.config.mjs` and applied to all routes.
0 commit comments