@chenhui996/gg-cli 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/template/zhiguan/.editorconfig +16 -0
  2. package/dist/template/zhiguan/.env +1 -0
  3. package/dist/template/zhiguan/.env.development +4 -0
  4. package/dist/template/zhiguan/.env.production +4 -0
  5. package/dist/template/zhiguan/.env.test +4 -0
  6. package/dist/template/zhiguan/.prettierignore +34 -0
  7. package/dist/template/zhiguan/.prettierrc +14 -0
  8. package/dist/template/zhiguan/README.md +183 -0
  9. package/dist/template/zhiguan/docs/Git/345/274/200/345/217/221/350/247/204/350/214/203.md +105 -0
  10. package/dist/template/zhiguan/docs/React/345/274/200/345/217/221/350/247/204/350/214/203.md +81 -0
  11. package/dist/template/zhiguan/docs/TypeScript/345/274/200/345/217/221/350/247/204/350/214/203.md +119 -0
  12. package/dist/template/zhiguan/docs//345/211/215/347/253/257/346/227/245/345/277/227/344/270/216/347/233/221/346/216/247/345/237/213/347/202/271/350/247/204/350/214/203.md +136 -0
  13. package/dist/template/zhiguan/docs//345/215/225/345/205/203/346/265/213/350/257/225/350/247/204/350/214/203.md +131 -0
  14. package/dist/template/zhiguan/docs//351/241/271/347/233/256/347/233/256/345/275/225/347/273/223/346/236/204/350/247/204/350/214/203.md +93 -0
  15. package/dist/template/zhiguan/eslint.config.js +27 -0
  16. package/dist/template/zhiguan/index.html +13 -0
  17. package/dist/template/zhiguan/package.json +60 -0
  18. package/dist/template/zhiguan/public/favicon.svg +1 -0
  19. package/dist/template/zhiguan/public/icons.svg +24 -0
  20. package/dist/template/zhiguan/src/api/user.ts +21 -0
  21. package/dist/template/zhiguan/src/assets/Frame 20.png +0 -0
  22. package/dist/template/zhiguan/src/assets/react.svg +1 -0
  23. package/dist/template/zhiguan/src/components/Chart/index.tsx +22 -0
  24. package/dist/template/zhiguan/src/components/ErrorBoundary/index.tsx +82 -0
  25. package/dist/template/zhiguan/src/layouts/BasicLayout.tsx +174 -0
  26. package/dist/template/zhiguan/src/main.tsx +38 -0
  27. package/dist/template/zhiguan/src/pages/404.test.tsx +20 -0
  28. package/dist/template/zhiguan/src/pages/404.tsx +32 -0
  29. package/dist/template/zhiguan/src/pages/about/index.tsx +8 -0
  30. package/dist/template/zhiguan/src/pages/calendar/index.tsx +8 -0
  31. package/dist/template/zhiguan/src/pages/dashboard/index.tsx +72 -0
  32. package/dist/template/zhiguan/src/pages/home/index.less +59 -0
  33. package/dist/template/zhiguan/src/pages/home/index.tsx +217 -0
  34. package/dist/template/zhiguan/src/pages/settings/index.tsx +8 -0
  35. package/dist/template/zhiguan/src/pages/workspace/index.tsx +8 -0
  36. package/dist/template/zhiguan/src/router/index.tsx +81 -0
  37. package/dist/template/zhiguan/src/setupTests.ts +1 -0
  38. package/dist/template/zhiguan/src/store/useCounterStore.ts +24 -0
  39. package/dist/template/zhiguan/src/style.less +3 -0
  40. package/dist/template/zhiguan/src/utils/request/index.ts +108 -0
  41. package/dist/template/zhiguan/src/vite-env.d.ts +12 -0
  42. package/dist/template/zhiguan/tsconfig.app.json +34 -0
  43. package/dist/template/zhiguan/tsconfig.json +7 -0
  44. package/dist/template/zhiguan/tsconfig.node.json +26 -0
  45. package/dist/template/zhiguan/vite.config.ts +77 -0
  46. package/package.json +1 -1
  47. package/dist/template/operations-tem/package-lock.json +0 -6413
@@ -0,0 +1,217 @@
1
+ import { Input, Tag, Card, Row, Col, List, Button, Typography, Space } from 'antd';
2
+ import {
3
+ ArrowUpOutlined,
4
+ AppstoreOutlined,
5
+ SettingOutlined,
6
+ SafetyCertificateOutlined,
7
+ AuditOutlined,
8
+ WalletOutlined,
9
+ DatabaseOutlined,
10
+ PaperClipOutlined,
11
+ } from '@ant-design/icons';
12
+ import './index.less';
13
+
14
+ const { Title, Text } = Typography;
15
+
16
+ // --- Components ---
17
+
18
+ /**
19
+ * 欢迎语组件 (WelcomeHeader)
20
+ * 展示用户个性化问候语和任务概览
21
+ */
22
+ const WelcomeHeader = () => (
23
+ <div className="welcome-header">
24
+ <Title level={2}>下午好,你有3件待办任务...</Title>
25
+ </div>
26
+ );
27
+
28
+ /**
29
+ * 搜索区域组件 (SearchSection)
30
+ * 包含搜索框和快捷操作标签 (Tag)
31
+ * 样式位于 ./index.less
32
+ */
33
+ const SearchSection = () => (
34
+ <div className="search-section">
35
+ {/* 搜索输入框 */}
36
+ <div className="search-box">
37
+ <PaperClipOutlined className="search-icon" />
38
+ <Input
39
+ bordered={false}
40
+ placeholder="输入您想查询的数据、指令或功能,例如:帮我分析一下NVDA的最新财报..."
41
+ className="search-input"
42
+ />
43
+ <Button type="primary" shape="circle" icon={<ArrowUpOutlined />} className="search-btn" />
44
+ </div>
45
+
46
+ {/* 快捷标签 */}
47
+ <div className="search-tags">
48
+ <Tag className="tag-item">分析财报</Tag>
49
+ <Tag className="tag-item">查询头寸</Tag>
50
+ <Tag className="tag-item">压力测试</Tag>
51
+ </div>
52
+ </div>
53
+ );
54
+
55
+ /**
56
+ * 常用功能组件 (QuickActions)
57
+ * 使用 Grid 布局展示应用的核心功能入口
58
+ * 每个卡片包含:图标、标题和背景色
59
+ */
60
+ const QuickActions = () => {
61
+ // 功能入口配置数据
62
+ const actions = [
63
+ {
64
+ title: '工作空间',
65
+ icon: <AppstoreOutlined style={{ fontSize: 24, color: '#4F46E5' }} />,
66
+ color: '#EEF2FF',
67
+ },
68
+ {
69
+ title: '规则配置',
70
+ icon: <SettingOutlined style={{ fontSize: 24, color: '#0EA5E9' }} />,
71
+ color: '#F0F9FF',
72
+ },
73
+ {
74
+ title: '事后风控',
75
+ icon: <SafetyCertificateOutlined style={{ fontSize: 24, color: '#F59E0B' }} />,
76
+ color: '#FFFBEB',
77
+ },
78
+ {
79
+ title: '交易审批',
80
+ icon: <AuditOutlined style={{ fontSize: 24, color: '#10B981' }} />,
81
+ color: '#ECFDF5',
82
+ },
83
+ {
84
+ title: '证券池管理',
85
+ icon: <WalletOutlined style={{ fontSize: 24, color: '#3B82F6' }} />,
86
+ color: '#EFF6FF',
87
+ },
88
+ {
89
+ title: '数据审批',
90
+ icon: <DatabaseOutlined style={{ fontSize: 24, color: '#06B6D4' }} />,
91
+ color: '#ECFEFF',
92
+ },
93
+ ];
94
+
95
+ return (
96
+ <div style={{ maxWidth: 1000, margin: '0 auto 48px' }}>
97
+ <div
98
+ style={{
99
+ display: 'flex',
100
+ justifyContent: 'space-between',
101
+ marginBottom: 16,
102
+ padding: '0 8px',
103
+ }}
104
+ >
105
+ <Text type="secondary">常用功能</Text>
106
+ <Button type="link" size="small" style={{ color: '#999' }}>
107
+ 更多
108
+ </Button>
109
+ </div>
110
+ <Row gutter={[16, 16]}>
111
+ {actions.map((action) => (
112
+ <Col span={4} key={action.title}>
113
+ <Card
114
+ hoverable
115
+ bordered={false}
116
+ bodyStyle={{
117
+ padding: '24px 12px',
118
+ display: 'flex',
119
+ flexDirection: 'column',
120
+ alignItems: 'center',
121
+ justifyContent: 'center',
122
+ gap: 12,
123
+ }}
124
+ style={{ boxShadow: '0 2px 8px rgba(0,0,0,0.02)' }}
125
+ >
126
+ <div
127
+ style={{
128
+ width: 48,
129
+ height: 48,
130
+ borderRadius: 12,
131
+ background: action.color,
132
+ display: 'flex',
133
+ alignItems: 'center',
134
+ justifyContent: 'center',
135
+ }}
136
+ >
137
+ {action.icon}
138
+ </div>
139
+ <Text style={{ fontSize: 13, fontWeight: 500 }}>{action.title}</Text>
140
+ </Card>
141
+ </Col>
142
+ ))}
143
+ </Row>
144
+ </div>
145
+ );
146
+ };
147
+
148
+ /**
149
+ * 待办任务组件 (TaskList)
150
+ * 展示用户今日待办事项,支持紧急程度标记
151
+ */
152
+ const TaskList = () => {
153
+ // 模拟任务数据
154
+ const tasks = [
155
+ { time: '16:30', content: '确认:交易对手方授信额度调整', tag: '紧急', tagColor: '#EF4444' },
156
+ { time: '17:00', content: '复核:昨日异常交易流水', tag: '', tagColor: '' },
157
+ { time: '17:12', content: '复核:昨日异常交易流水', tag: '', tagColor: '' },
158
+ ];
159
+
160
+ return (
161
+ <div style={{ maxWidth: 1000, margin: '0 auto' }}>
162
+ <Text type="secondary" style={{ marginBottom: 16, display: 'block', paddingLeft: 8 }}>
163
+ 待办任务
164
+ </Text>
165
+ <List
166
+ dataSource={tasks}
167
+ renderItem={(item) => (
168
+ <List.Item
169
+ style={{
170
+ background: '#fff',
171
+ borderRadius: 12,
172
+ marginBottom: 12,
173
+ padding: '20px 24px',
174
+ border: '1px solid #f0f0f0',
175
+ display: 'flex',
176
+ alignItems: 'center',
177
+ }}
178
+ >
179
+ <div style={{ display: 'flex', alignItems: 'center', flex: 1 }}>
180
+ <Text type="secondary" style={{ width: 60, marginRight: 16 }}>
181
+ {item.time}
182
+ </Text>
183
+ <Text style={{ fontSize: 15, fontWeight: 500 }}>{item.content}</Text>
184
+ </div>
185
+
186
+ <Space size={16}>
187
+ {item.tag && (
188
+ <Tag
189
+ color={item.tagColor}
190
+ style={{ borderRadius: 4, border: 'none', marginRight: 0 }}
191
+ >
192
+ {item.tag}
193
+ </Tag>
194
+ )}
195
+ <Button type="link" size="small">
196
+ 处理
197
+ </Button>
198
+ </Space>
199
+ </List.Item>
200
+ )}
201
+ />
202
+ </div>
203
+ );
204
+ };
205
+
206
+ // --- Main Page ---
207
+
208
+ export default function Home() {
209
+ return (
210
+ <div className="home-page">
211
+ <WelcomeHeader />
212
+ <SearchSection />
213
+ <QuickActions />
214
+ <TaskList />
215
+ </div>
216
+ );
217
+ }
@@ -0,0 +1,8 @@
1
+ export default function Settings() {
2
+ return (
3
+ <div>
4
+ <h2>Settings Page</h2>
5
+ <p>This is a modern React template generated by gg-cli.</p>
6
+ </div>
7
+ );
8
+ }
@@ -0,0 +1,8 @@
1
+ export default function Workspace() {
2
+ return (
3
+ <div>
4
+ <h2>Workspace Page</h2>
5
+ <p>This is a modern React template generated by gg-cli.</p>
6
+ </div>
7
+ );
8
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * 路由配置 (React Router Data API)
3
+ * 采用对象配置模式,便于管理和扩展
4
+ */
5
+ import { lazy, Suspense, type ComponentType, type LazyExoticComponent } from 'react';
6
+ import { createBrowserRouter } from 'react-router-dom';
7
+ import { Spin } from 'antd';
8
+ import BasicLayout from '@/layouts/BasicLayout';
9
+
10
+ // 路由懒加载配置
11
+ const Home = lazy(() => import('@/pages/home'));
12
+ const About = lazy(() => import('@/pages/about'));
13
+ const Dashboard = lazy(() => import('@/pages/dashboard'));
14
+ const Workspace = lazy(() => import('@/pages/workspace'));
15
+ const Calendar = lazy(() => import('@/pages/calendar'));
16
+ const Settings = lazy(() => import('@/pages/settings'));
17
+ const NotFound = lazy(() => import('@/pages/404'));
18
+
19
+ // 全局 Loading 组件
20
+ const Loading = () => (
21
+ <div
22
+ style={{
23
+ display: 'flex',
24
+ justifyContent: 'center',
25
+ alignItems: 'center',
26
+ height: '100%',
27
+ minHeight: 400,
28
+ }}
29
+ >
30
+ <Spin size="large" />
31
+ </div>
32
+ );
33
+
34
+ // 包装懒加载组件,统一添加 Suspense
35
+ function withSuspense(Component: LazyExoticComponent<ComponentType<any>>) {
36
+ return (
37
+ <Suspense fallback={<Loading />}>
38
+ <Component />
39
+ </Suspense>
40
+ );
41
+ }
42
+
43
+ export const router = createBrowserRouter([
44
+ {
45
+ path: '/',
46
+ // 根布局:BasicLayout (包含侧边栏和 Header)
47
+ element: <BasicLayout />,
48
+ // 子路由:渲染在 BasicLayout 的 <Outlet /> 中
49
+ children: [
50
+ {
51
+ index: true, // 默认子路由 (首页)
52
+ element: withSuspense(Home),
53
+ },
54
+ {
55
+ path: 'dashboard',
56
+ element: withSuspense(Dashboard),
57
+ },
58
+ {
59
+ path: 'about',
60
+ element: withSuspense(About),
61
+ },
62
+ {
63
+ path: 'workspace',
64
+ element: withSuspense(Workspace),
65
+ },
66
+ {
67
+ path: 'calendar',
68
+ element: withSuspense(Calendar),
69
+ },
70
+ {
71
+ path: 'settings',
72
+ element: withSuspense(Settings),
73
+ },
74
+ // 404 页面配置
75
+ {
76
+ path: '*',
77
+ element: withSuspense(NotFound),
78
+ },
79
+ ],
80
+ },
81
+ ]);
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,24 @@
1
+ import { create } from 'zustand';
2
+
3
+ // 1. 定义状态接口
4
+ interface CounterState {
5
+ count: number;
6
+ increment: () => void;
7
+ decrement: () => void;
8
+ }
9
+
10
+ /**
11
+ * 全局计数器状态 (Zustand Store)
12
+ * 这是一个简单的状态管理示例,演示如何使用 Zustand
13
+ *
14
+ * @example
15
+ * // 在组件中使用
16
+ * const { count, increment } = useCounterStore()
17
+ */
18
+ export const useCounterStore = create<CounterState>()((set) => ({
19
+ // 初始状态
20
+ count: 0,
21
+ // 修改状态的方法 (Action)
22
+ increment: () => set((state) => ({ count: state.count + 1 })),
23
+ decrement: () => set((state) => ({ count: state.count - 1 })),
24
+ }));
@@ -0,0 +1,3 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * 通用网络请求工具 (Axios Encapsulation)
3
+ * 封装了全局请求拦截、响应处理和错误统一处理
4
+ */
5
+ import axios, { type AxiosRequestConfig, type AxiosResponse } from 'axios';
6
+
7
+ // 定义通用的后端响应结构
8
+ export interface BaseResponse<T = unknown> {
9
+ code: number; // 业务状态码 (0/200: 成功, 其他: 失败)
10
+ data: T; // 业务数据
11
+ message: string; // 提示信息
12
+ }
13
+
14
+ // 创建 Axios 实例的工厂函数
15
+ function createRequest(config: AxiosRequestConfig) {
16
+ const instance = axios.create(config);
17
+
18
+ // 请求拦截器
19
+ instance.interceptors.request.use(
20
+ (reqConfig) => {
21
+ // 在发送请求之前做些什么,例如添加 token
22
+ const token = localStorage.getItem('token');
23
+ if (token && reqConfig.headers) {
24
+ reqConfig.headers.Authorization = `Bearer ${token}`;
25
+ }
26
+ return reqConfig;
27
+ },
28
+ (error) => {
29
+ return Promise.reject(error);
30
+ },
31
+ );
32
+
33
+ // 响应拦截器
34
+ instance.interceptors.response.use(
35
+ (response: AxiosResponse<BaseResponse>) => {
36
+ const { data } = response;
37
+ // 根据自定义的 code 判断请求是否成功 (假设 0 或 200 为成功)
38
+ if (data.code === 0 || data.code === 200) {
39
+ return data.data as any; // 拆包返回 data
40
+ } else {
41
+ // 处理业务错误,例如提示用户
42
+ console.error(data.message || '请求失败');
43
+ return Promise.reject(new Error(data.message || '请求失败'));
44
+ }
45
+ },
46
+ (error) => {
47
+ // 处理 HTTP 错误,例如 401, 404, 500 等
48
+ if (error.response) {
49
+ const status = error.response.status;
50
+ switch (status) {
51
+ case 401:
52
+ console.error('未授权,请重新登录');
53
+ // 执行登出逻辑等
54
+ break;
55
+ case 403:
56
+ console.error('拒绝访问');
57
+ break;
58
+ case 404:
59
+ console.error('请求地址错误');
60
+ break;
61
+ case 500:
62
+ console.error('服务器内部错误');
63
+ break;
64
+ default:
65
+ console.error(`请求错误: ${status}`);
66
+ }
67
+ } else {
68
+ console.error('网络连接异常,请稍后再试!');
69
+ }
70
+ return Promise.reject(error);
71
+ },
72
+ );
73
+
74
+ // 返回封装好的请求方法对象
75
+ return {
76
+ /**
77
+ * 发送 GET 请求
78
+ * @param url 请求地址
79
+ * @param config Axios 配置
80
+ */
81
+ get: <T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T> => {
82
+ return instance.get(url, config);
83
+ },
84
+ /**
85
+ * 发送 POST 请求
86
+ * @param url 请求地址
87
+ * @param data 请求体数据
88
+ * @param config Axios 配置
89
+ */
90
+ post: <T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T> => {
91
+ return instance.post(url, data, config);
92
+ },
93
+ put: <T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T> => {
94
+ return instance.put(url, data, config);
95
+ },
96
+ delete: <T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T> => {
97
+ return instance.delete(url, config);
98
+ },
99
+ };
100
+ }
101
+
102
+ // 导出默认 request 实例
103
+ // 可以直接 import { request } from '@/utils/request' 使用
104
+ export const request = createRequest({
105
+ // 从环境变量 VITE_API_BASE_URL 获取基础地址,默认为 /api
106
+ baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
107
+ timeout: 10000, // 超时时间 10s
108
+ });
@@ -0,0 +1,12 @@
1
+ /// <reference types="vitest" />
2
+ /// <reference types="vite/client" />
3
+
4
+ interface ImportMetaEnv {
5
+ readonly VITE_ENV: string;
6
+ readonly VITE_API_BASE_URL: string;
7
+ readonly VITE_APP_TITLE: string;
8
+ }
9
+
10
+ interface ImportMeta {
11
+ readonly env: ImportMetaEnv;
12
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
+ "target": "ES2023",
5
+ "useDefineForClassFields": true,
6
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
7
+ "module": "ESNext",
8
+ "types": ["vite/client", "node"],
9
+ "skipLibCheck": true,
10
+
11
+ /* Bundler mode */
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "moduleDetection": "force",
16
+ "noEmit": true,
17
+ "jsx": "react-jsx",
18
+
19
+ /* Path Aliases */
20
+ "baseUrl": ".",
21
+ "paths": {
22
+ "@/*": ["src/*"]
23
+ },
24
+
25
+ /* Linting */
26
+ "strict": true,
27
+ "noUnusedLocals": true,
28
+ "noUnusedParameters": true,
29
+ "erasableSyntaxOnly": true,
30
+ "noFallthroughCasesInSwitch": true,
31
+ "noUncheckedSideEffectImports": true
32
+ },
33
+ "include": ["src"]
34
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ]
7
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "ES2023",
5
+ "lib": ["ES2023"],
6
+ "module": "ESNext",
7
+ "types": ["node"],
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "erasableSyntaxOnly": true,
22
+ "noFallthroughCasesInSwitch": true,
23
+ "noUncheckedSideEffectImports": true
24
+ },
25
+ "include": ["vite.config.ts"]
26
+ }
@@ -0,0 +1,77 @@
1
+ import { defineConfig } from 'vitest/config'
2
+ import react, { reactCompilerPreset } from '@vitejs/plugin-react'
3
+ import babel from '@rolldown/plugin-babel'
4
+ import path from 'path'
5
+ import { visualizer } from 'rollup-plugin-visualizer'
6
+
7
+ // https://vite.dev/config/
8
+ export default defineConfig({
9
+ plugins: [
10
+ react(),
11
+ babel({ presets: [reactCompilerPreset()] }),
12
+ process.env.ANALYZE === 'true' && visualizer({
13
+ open: true,
14
+ gzipSize: true,
15
+ brotliSize: true,
16
+ filename: 'dist/stats.html',
17
+ }),
18
+ ],
19
+ resolve: {
20
+ alias: {
21
+ '@': path.resolve(__dirname, './src'),
22
+ },
23
+ },
24
+ // 生产环境打包配置
25
+ build: {
26
+ // 消除打包大小超过 500kb 警告
27
+ chunkSizeWarningLimit: 2000,
28
+ minify: 'terser',
29
+ terserOptions: {
30
+ compress: {
31
+ drop_console: process.env.NODE_ENV === 'production',
32
+ drop_debugger: process.env.NODE_ENV === 'production',
33
+ },
34
+ },
35
+ rollupOptions: {
36
+ output: {
37
+ // 静态资源分类打包
38
+ chunkFileNames: 'assets/js/[name]-[hash].js',
39
+ entryFileNames: 'assets/js/[name]-[hash].js',
40
+ assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
41
+ // 手动分包策略
42
+ manualChunks(id) {
43
+ // 1. 将 react 核心全家桶打包到一起
44
+ if (id.includes('node_modules/react') || id.includes('node_modules/react-dom') || id.includes('node_modules/react-router-dom')) {
45
+ return 'vendor-react';
46
+ }
47
+ // 2. 将 echarts 单独打包 (体积较大)
48
+ if (id.includes('node_modules/echarts') || id.includes('node_modules/zrender')) {
49
+ return 'vendor-echarts';
50
+ }
51
+ // 3. 将 antd 和图标单独打包
52
+ if (id.includes('node_modules/antd') || id.includes('node_modules/@ant-design')) {
53
+ return 'vendor-antd';
54
+ }
55
+ },
56
+ },
57
+ },
58
+ },
59
+ css: {
60
+ preprocessorOptions: {
61
+ less: {
62
+ javascriptEnabled: true,
63
+ },
64
+ },
65
+ },
66
+ // Vitest 测试配置
67
+ test: {
68
+ environment: 'jsdom',
69
+ globals: true,
70
+ setupFiles: './src/setupTests.ts',
71
+ coverage: {
72
+ provider: 'v8',
73
+ reporter: ['text', 'json', 'html'],
74
+ exclude: ['node_modules/', 'src/setupTests.ts', 'dist/'],
75
+ },
76
+ },
77
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chenhui996/gg-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "一个轻量级的现代前端脚手架工具,公网测试",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",