Closes the source-side half of P0 #7 from .convoys/ship-readiness.md. The page-side sweep (Brief 2) follows in a separate commit. components/Layout.js: - Default user prop is now null (was hardcoded to { email: 'me@randallstillwell.com', role: 'user' }) - UserProfileDropdown renders a "Sign in" link to /login when user === null instead of the maintainer's email + auth-only menu items (Decision A1) - All user.* accesses guarded with optional chaining or null checks - useState hook stays above the new null-user early return to satisfy rules-of-hooks (boot-the-brief caught this on the first try; see AGENTS.md Gotcha #11.5) test/components/Layout.test.js (new): - First jsdom test in the repo (Decision D2) - 5 regression-lock assertions: no maintainer email ever rendered (prop omitted, prop=null), Sign-in link exists with href=/login, supplied email renders when prop is set, no "Guest" placeholder (locks A1 copy choice) - Mocks next/link, next/router (prefetch, replace, events, query), and theme-context.useTheme for jsdom safety under Next 16 package.json + package-lock.json: - Add jsdom@^29 and @testing-library/react@^16 to devDependencies - @testing-library/dom@^10 added explicitly (peer auto-install skipped it under npm 11; brief anticipated this fallback) vitest.config.js (deviation from brief — see PR description): - Add esbuild { loader: 'jsx', jsx: 'automatic' } so vitest can parse JSX in .js files. Required to import any React component written in the repo's Next.js pages-router .js convention (AGENTS.md Gotcha #9). The brief said "no change" to this file, but JSX-in-.js parsing is a hard prerequisite for the new test to import components/Layout.js — the alternatives (rename test to .test.jsx; rewrite test in React.createElement) either break the test glob or still hit the same Layout.js parse failure. Other tests are unaffected (they import non-JSX modules). Smoke output: see PR description. addresses: P0 #7 from .convoys/ship-readiness.md (last P0 ship-blocker) Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
1.1 KiB
JSON
44 lines
1.1 KiB
JSON
{
|
|
"name": "tcg-vault",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "next dev",
|
|
"build": "next build",
|
|
"start": "next start",
|
|
"lint": "eslint .",
|
|
"setup-db": "node scripts/setup-neon-db.js",
|
|
"import-popular": "node scripts/import-popular-sets.js",
|
|
"import-all": "node scripts/bulk-import-all.js",
|
|
"test": "vitest",
|
|
"test:run": "vitest run"
|
|
},
|
|
"dependencies": {
|
|
"@neondatabase/serverless": "^1.0.1",
|
|
"@upstash/ratelimit": "^2.0.8",
|
|
"@upstash/redis": "^1.38.0",
|
|
"@vercel/blob": "^1.1.1",
|
|
"@vercel/postgres": "^0.10.0",
|
|
"bcryptjs": "^3.0.2",
|
|
"dotenv": "^17.2.1",
|
|
"jsonwebtoken": "^9.0.2",
|
|
"next": "^16.2.6",
|
|
"node-fetch": "^3.3.2",
|
|
"react": "^18.3.1",
|
|
"react-dom": "^18.3.1",
|
|
"resend": "^4.7.0"
|
|
},
|
|
"devDependencies": {
|
|
"@testing-library/dom": "^10.4.1",
|
|
"@testing-library/react": "^16.3.2",
|
|
"autoprefixer": "^10.4.21",
|
|
"eslint": "^9.39.4",
|
|
"eslint-config-next": "^16.2.6",
|
|
"jsdom": "^29.1.1",
|
|
"postcss": "^8.5.6",
|
|
"tailwindcss": "^3.4.17",
|
|
"typescript": "^5.9.3",
|
|
"vitest": "^3.2.4"
|
|
}
|
|
}
|