ARCHITECTURE.md §10 P1-8: three structural checks wired into CI to prevent regressions identified in the §1.3 audit. Scripts (apps/portal-shell/scripts/): - check-route-table.ts: scans src/app/shell/**/page.tsx, parses route-permissions.ts (EXACT/PREFIX/DASHBOARD/PUBLIC_ROUTES), fails if any actual /shell/* route is unregistered. Reports ghost entries (EXACT declarations without page.tsx) as informational. - check-page-count.ts: asserts total page.tsx >= 13 and per-category minimums (dashboards/login/root/forbidden/catch-all/dev-templates). - check-codegen.ts: runs pnpm run codegen, fails if any output with skipDocumentsValidation:false has operations referencing non-existent schema fields (currently enforces dashboard-types.ts output from P1-7). npm scripts: check:routes / check:pages / check:codegen / check:all CI: .github/workflows/ci.yml quality-ts job — new "Portal-shell structural checks (P1-8)" step between typecheck and test. Acceptance (ARCHITECTURE.md §10 P1-8 — "CI 对预埋违规报红"): - Route violation: planted /shell/test-violation/page.tsx → check:routes exits 1 with "unregistered route" error; reverted → PASS - Codegen violation: planted non_existent_field in GetTeacherDashboard → check:codegen exits 1 with "Cannot query field" error; reverted → PASS - Page count: baseline=13, deleting any page.tsx triggers FAIL - Clean state: all 3 checks PASS (10 routes, 28 EXACT, 24 ghost entries informational, 13 pages, codegen 3 outputs SUCCESS) Refs: ARCHITECTURE.md §5.3, §10 P1-8, §11.6, §11.7 红线 #5
83 lines
2.7 KiB
JSON
83 lines
2.7 KiB
JSON
{
|
|
"name": "@edu/portal-shell",
|
|
"version": "0.2.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "next dev -p 4010",
|
|
"build": "next build",
|
|
"start": "next start -p 4010",
|
|
"lint": "eslint src",
|
|
"lint:tokens": "eslint -c .eslintrc.tokens.js src",
|
|
"typecheck": "tsc --noEmit",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"codegen": "tsx scripts/normalize-schema.ts && graphql-codegen --config codegen.yml",
|
|
"codegen:watch": "graphql-codegen --config codegen.yml --watch",
|
|
"generate-pq-manifest": "tsx scripts/generate-pq-manifest.ts",
|
|
"check:routes": "tsx scripts/check-route-table.ts",
|
|
"check:pages": "tsx scripts/check-page-count.ts",
|
|
"check:codegen": "tsx scripts/check-codegen.ts",
|
|
"check:all": "pnpm run check:routes && pnpm run check:pages && pnpm run check:codegen",
|
|
"prebuild": "pnpm run codegen && pnpm run generate-pq-manifest"
|
|
},
|
|
"dependencies": {
|
|
"@apollo/client": "^3.11.0",
|
|
"@edu/hooks": "workspace:*",
|
|
"@edu/ui-components": "workspace:*",
|
|
"@edu/ui-tokens": "workspace:*",
|
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
"@radix-ui/react-collapsible": "^1.1.12",
|
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
"@radix-ui/react-scroll-area": "^1.2.10",
|
|
"@radix-ui/react-separator": "^1.1.8",
|
|
"@radix-ui/react-slot": "^1.2.4",
|
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
"@tailwindcss/typography": "^0.5.16",
|
|
"class-variance-authority": "^0.7.1",
|
|
"clsx": "^2.1.1",
|
|
"crypto-hash": "^4.0.1",
|
|
"graphql": "^16.8.0",
|
|
"jose": "^5.9.6",
|
|
"lucide-react": "^0.562.0",
|
|
"msw": "2.7.0",
|
|
"next": "^16.0.10",
|
|
"next-intl": "^4.13.2",
|
|
"next-themes": "^0.4.6",
|
|
"react": "^19.2.1",
|
|
"react-dom": "^19.2.1",
|
|
"sonner": "^2.0.7",
|
|
"swr": "^2.2.0",
|
|
"tailwind-merge": "^3.4.0",
|
|
"tailwindcss-animate": "^1.0.7",
|
|
"zod": "^3.23.8",
|
|
"zustand": "^5.0.9"
|
|
},
|
|
"devDependencies": {
|
|
"@graphql-codegen/cli": "^5.0.0",
|
|
"@graphql-codegen/typescript": "^4.0.0",
|
|
"@graphql-codegen/typescript-document-nodes": "^4.0.0",
|
|
"@graphql-codegen/typescript-operations": "^4.0.0",
|
|
"@tailwindcss/postcss": "^4.0.0",
|
|
"@testing-library/jest-dom": "^6.4.0",
|
|
"@testing-library/react": "^16.0.0",
|
|
"@types/node": "^22.0.0",
|
|
"@types/react": "^19.0.0",
|
|
"@types/react-dom": "^19.0.0",
|
|
"@vitejs/plugin-react": "^4.3.0",
|
|
"eslint": "^9.0.0",
|
|
"eslint-config-prettier": "^9.1.0",
|
|
"jsdom": "^25.0.0",
|
|
"tailwindcss": "^4.0.0",
|
|
"tsx": "^4.0.0",
|
|
"typescript": "^5.6.0",
|
|
"vitest": "^2.0.0"
|
|
},
|
|
"msw": {
|
|
"workerDirectory": [
|
|
"public"
|
|
]
|
|
}
|
|
} |