feat(portal-shell): add graphql-codegen configuration

M1 Task 2: 配置 graphql-codegen 与 federation schema 预处理

- codegen.yml: schema 从 combined-schema.graphql 读取(federation 已剥离)

- scripts/normalize-schema.ts: 把 7 个子图的 extend type Query 合并为 type Query

- package.json: 新增 codegen/codegen:watch scripts + 4 个 codegen deps + tsx

- .gitignore: 忽略 src/lib/api/__generated__/

- documents 配置暂注释,Task 3 创建 operations 文件后启用
This commit is contained in:
SpecialX
2026-07-17 12:12:37 +08:00
parent 989603e318
commit 7c234947e1
6 changed files with 248 additions and 3 deletions

View File

@@ -10,7 +10,9 @@
"lint:tokens": "eslint -c .eslintrc.tokens.js src",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest"
"test:watch": "vitest",
"codegen": "tsx scripts/normalize-schema.ts && graphql-codegen --config codegen.yml",
"codegen:watch": "graphql-codegen --config codegen.yml --watch"
},
"dependencies": {
"@apollo/client": "^3.11.0",
@@ -25,6 +27,10 @@
"zustand": "^4.5.0"
},
"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",
"@testing-library/jest-dom": "^6.4.0",
"@testing-library/react": "^16.0.0",
"@types/node": "^22.0.0",
@@ -37,6 +43,7 @@
"jsdom": "^25.0.0",
"postcss": "^8.4.0",
"tailwindcss": "^3.4.0",
"tsx": "^4.0.0",
"typescript": "^5.6.0",
"vitest": "^2.0.0"
}