From c258035f6a3cebf2f222292f46416c8c915fa2d7 Mon Sep 17 00:00:00 2001 From: MyPrototypeWhat Date: Tue, 14 Oct 2025 14:43:49 +0800 Subject: [PATCH] chore: enhance type checking and update UI package configuration - Added a new typecheck command for the UI package in package.json to ensure type safety. - Updated tsconfig.web.json to include UI paths for better module resolution. - Modified the type-check command in the UI package to specify the tsconfig.json file. - Adjusted the include paths in the UI tsconfig.json to focus on specific component directories. --- package.json | 3 ++- packages/ui/package.json | 2 +- packages/ui/tsconfig.json | 2 +- tsconfig.web.json | 9 ++++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index dc8d1ccf3..589041a15 100644 --- a/package.json +++ b/package.json @@ -50,9 +50,10 @@ "generate:icons": "electron-icon-builder --input=./build/logo.png --output=build", "analyze:renderer": "VISUALIZER_RENDERER=true yarn build", "analyze:main": "VISUALIZER_MAIN=true yarn build", - "typecheck": "concurrently -n \"node,web\" -c \"cyan,magenta\" \"npm run typecheck:node\" \"npm run typecheck:web\"", + "typecheck": "concurrently -n \"node,web,ui\" -c \"cyan,magenta,green\" \"npm run typecheck:node\" \"npm run typecheck:web\" \"npm run typecheck:ui\"", "typecheck:node": "tsgo --noEmit -p tsconfig.node.json --composite false", "typecheck:web": "tsgo --noEmit -p tsconfig.web.json --composite false", + "typecheck:ui": "cd packages/ui && npm run type-check", "check:i18n": "dotenv -e .env -- tsx scripts/check-i18n.ts", "sync:i18n": "dotenv -e .env -- tsx scripts/sync-i18n.ts", "update:i18n": "dotenv -e .env -- tsx scripts/update-i18n.ts", diff --git a/packages/ui/package.json b/packages/ui/package.json index b4f9b26ae..63283eab0 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -13,7 +13,7 @@ "test": "vitest run", "test:watch": "vitest", "lint": "eslint src --ext .ts,.tsx --fix", - "type-check": "tsc --noEmit", + "type-check": "tsc --noEmit -p tsconfig.json --composite false", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build" }, diff --git a/packages/ui/tsconfig.json b/packages/ui/tsconfig.json index 4ec6b07ed..9ddce41db 100644 --- a/packages/ui/tsconfig.json +++ b/packages/ui/tsconfig.json @@ -24,5 +24,5 @@ "target": "ES2020" }, "exclude": ["node_modules", "dist", "**/*.test.*", "**/__tests__/**"], - "include": ["src/**/*", "stories/**/*"] + "include": ["src/**/*", "stories/components/**/*"] } diff --git a/tsconfig.web.json b/tsconfig.web.json index 1a6b38d95..5a60828a7 100644 --- a/tsconfig.web.json +++ b/tsconfig.web.json @@ -9,8 +9,7 @@ "packages/mcp-trace/**/*", "packages/aiCore/src/**/*", "src/main/integration/cherryai/index.js", - "packages/extension-table-plus/**/*", - "packages/ui/**/*" + "packages/extension-table-plus/**/*" ], "compilerOptions": { "composite": true, @@ -30,7 +29,11 @@ "@cherrystudio/ai-core/*": ["./packages/aiCore/src/*"], "@cherrystudio/ai-core": ["./packages/aiCore/src/index.ts"], "@cherrystudio/extension-table-plus": ["./packages/extension-table-plus/src/index.ts"], - "@cherrystudio/ui": ["./packages/ui/src/index.ts"] + "@cherrystudio/ui": ["./packages/ui/src/index.ts"], + "@/components/*": ["./packages/ui/src/components/*"], + "@/utils/*": ["./packages/ui/src/utils/*"], + "@/types": ["./packages/ui/src/types/index.ts"], + "@/hooks/*": ["./packages/ui/src/hooks/*"] }, "experimentalDecorators": true, "emitDecoratorMetadata": true,