@qlover/create-app 0.6.2 → 0.7.0

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 (81) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/templates/react-app/README.en.md +257 -0
  5. package/dist/templates/react-app/README.md +29 -231
  6. package/dist/templates/react-app/__tests__/__mocks__/I18nService.ts +13 -0
  7. package/dist/templates/react-app/__tests__/__mocks__/MockAppConfit.ts +48 -0
  8. package/dist/templates/react-app/__tests__/__mocks__/MockDialogHandler.ts +16 -0
  9. package/dist/templates/react-app/__tests__/__mocks__/MockLogger.ts +14 -0
  10. package/dist/templates/react-app/__tests__/__mocks__/createMockGlobals.ts +92 -0
  11. package/dist/templates/react-app/__tests__/setup/index.ts +51 -0
  12. package/dist/templates/react-app/__tests__/src/App.test.tsx +139 -0
  13. package/dist/templates/react-app/__tests__/src/base/cases/AppConfig.test.ts +288 -0
  14. package/dist/templates/react-app/__tests__/src/base/cases/AppError.test.ts +102 -0
  15. package/dist/templates/react-app/__tests__/src/base/cases/DialogHandler.test.ts +228 -0
  16. package/dist/templates/react-app/__tests__/src/base/cases/I18nKeyErrorPlugin.test.ts +207 -0
  17. package/dist/templates/react-app/__tests__/src/base/cases/InversifyContainer.test.ts +181 -0
  18. package/dist/templates/react-app/__tests__/src/base/cases/PublicAssetsPath.test.ts +61 -0
  19. package/dist/templates/react-app/__tests__/src/base/cases/RequestLogger.test.ts +199 -0
  20. package/dist/templates/react-app/__tests__/src/base/cases/RequestStatusCatcher.test.ts +192 -0
  21. package/dist/templates/react-app/__tests__/src/base/cases/RouterLoader.test.ts +235 -0
  22. package/dist/templates/react-app/__tests__/src/base/services/I18nService.test.ts +224 -0
  23. package/dist/templates/react-app/__tests__/src/core/IOC.test.ts +257 -0
  24. package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapsApp.test.ts +72 -0
  25. package/dist/templates/react-app/__tests__/src/main.integration.test.tsx +62 -0
  26. package/dist/templates/react-app/__tests__/src/main.test.tsx +46 -0
  27. package/dist/templates/react-app/__tests__/src/uikit/components/BaseHeader.test.tsx +88 -0
  28. package/dist/templates/react-app/config/app.router.ts +155 -0
  29. package/dist/templates/react-app/config/common.ts +9 -1
  30. package/dist/templates/react-app/docs/en/bootstrap.md +562 -0
  31. package/dist/templates/react-app/docs/en/development-guide.md +523 -0
  32. package/dist/templates/react-app/docs/en/env.md +482 -0
  33. package/dist/templates/react-app/docs/en/global.md +509 -0
  34. package/dist/templates/react-app/docs/en/i18n.md +268 -0
  35. package/dist/templates/react-app/docs/en/index.md +173 -0
  36. package/dist/templates/react-app/docs/en/ioc.md +424 -0
  37. package/dist/templates/react-app/docs/en/project-structure.md +434 -0
  38. package/dist/templates/react-app/docs/en/request.md +425 -0
  39. package/dist/templates/react-app/docs/en/router.md +404 -0
  40. package/dist/templates/react-app/docs/en/store.md +321 -0
  41. package/dist/templates/react-app/docs/en/test-guide.md +782 -0
  42. package/dist/templates/react-app/docs/en/theme.md +424 -0
  43. package/dist/templates/react-app/docs/en/typescript-guide.md +473 -0
  44. package/dist/templates/react-app/docs/zh/bootstrap.md +7 -0
  45. package/dist/templates/react-app/docs/zh/development-guide.md +523 -0
  46. package/dist/templates/react-app/docs/zh/env.md +24 -25
  47. package/dist/templates/react-app/docs/zh/global.md +28 -27
  48. package/dist/templates/react-app/docs/zh/i18n.md +268 -0
  49. package/dist/templates/react-app/docs/zh/index.md +173 -0
  50. package/dist/templates/react-app/docs/zh/ioc.md +44 -32
  51. package/dist/templates/react-app/docs/zh/project-structure.md +434 -0
  52. package/dist/templates/react-app/docs/zh/request.md +429 -0
  53. package/dist/templates/react-app/docs/zh/router.md +408 -0
  54. package/dist/templates/react-app/docs/zh/store.md +321 -0
  55. package/dist/templates/react-app/docs/zh/test-guide.md +782 -0
  56. package/dist/templates/react-app/docs/zh/theme.md +424 -0
  57. package/dist/templates/react-app/docs/zh/typescript-guide.md +473 -0
  58. package/dist/templates/react-app/package.json +9 -20
  59. package/dist/templates/react-app/src/base/cases/AppConfig.ts +16 -9
  60. package/dist/templates/react-app/src/base/cases/PublicAssetsPath.ts +7 -1
  61. package/dist/templates/react-app/src/base/services/I18nService.ts +15 -4
  62. package/dist/templates/react-app/src/base/services/RouteService.ts +43 -7
  63. package/dist/templates/react-app/src/core/bootstraps/BootstrapApp.ts +31 -10
  64. package/dist/templates/react-app/src/core/bootstraps/BootstrapsRegistry.ts +1 -1
  65. package/dist/templates/react-app/src/core/globals.ts +1 -3
  66. package/dist/templates/react-app/src/core/registers/RegisterCommon.ts +5 -3
  67. package/dist/templates/react-app/src/main.tsx +6 -1
  68. package/dist/templates/react-app/src/pages/404.tsx +0 -1
  69. package/dist/templates/react-app/src/pages/500.tsx +1 -1
  70. package/dist/templates/react-app/src/pages/base/RedirectPathname.tsx +3 -1
  71. package/dist/templates/react-app/src/styles/css/antd-themes/dark.css +3 -1
  72. package/dist/templates/react-app/src/styles/css/antd-themes/index.css +1 -1
  73. package/dist/templates/react-app/src/styles/css/antd-themes/pink.css +6 -1
  74. package/dist/templates/react-app/src/styles/css/page.css +1 -1
  75. package/dist/templates/react-app/src/uikit/components/BaseHeader.tsx +9 -2
  76. package/dist/templates/react-app/src/uikit/components/LocaleLink.tsx +5 -3
  77. package/dist/templates/react-app/src/uikit/hooks/useI18nGuard.ts +4 -6
  78. package/dist/templates/react-app/tsconfig.json +2 -1
  79. package/dist/templates/react-app/tsconfig.test.json +13 -0
  80. package/dist/templates/react-app/vite.config.ts +3 -2
  81. package/package.json +1 -1
@@ -23,6 +23,8 @@
23
23
  ### 3. 文件结构
24
24
 
25
25
  ```
26
+ config/
27
+ ├── common.ts # 全局变量名称配置
26
28
  src/
27
29
  ├── core/
28
30
  │ ├── globals.ts # 全局变量定义
@@ -105,8 +107,8 @@ const bootstrap = new Bootstrap({
105
107
  register: new IocRegisterImpl({ pathname, appConfig })
106
108
  },
107
109
  globalOptions: {
108
- sources: globals, // 全局变量源
109
- target: browserGlobalsName // 注入目标名称
110
+ sources: globals, // 全局变量源
111
+ target: browserGlobalsName // 注入目标名称
110
112
  }
111
113
  });
112
114
  ```
@@ -131,7 +133,7 @@ export class InjectGlobal implements BootstrapExecutorPlugin {
131
133
 
132
134
  onBefore(context: BootstrapContext): void {
133
135
  const { sources, target } = this.config;
134
-
136
+
135
137
  // 如果 target 是字符串,注入到 root 对象
136
138
  if (typeof target === 'string') {
137
139
  Object.assign(context.parameters.root!, {
@@ -192,13 +194,13 @@ window = {
192
194
  function someFunction() {
193
195
  // 访问全局日志器
194
196
  window.feGlobals.logger.info('这是一条日志');
195
-
197
+
196
198
  // 访问应用配置
197
199
  const appName = window.feGlobals.appConfig.appName;
198
-
200
+
199
201
  // 访问本地存储
200
202
  window.feGlobals.localStorage.set('key', 'value');
201
-
203
+
202
204
  // 访问对话框处理器
203
205
  window.feGlobals.dialogHandler.showMessage('Hello World');
204
206
  }
@@ -213,16 +215,12 @@ function MyComponent() {
213
215
  const handleClick = () => {
214
216
  // 使用全局日志器
215
217
  window.feGlobals.logger.info('用户点击了按钮');
216
-
218
+
217
219
  // 使用全局对话框
218
220
  window.feGlobals.dialogHandler.showMessage('操作成功');
219
221
  };
220
222
 
221
- return (
222
- <button onClick={handleClick}>
223
- 点击我
224
- </button>
225
- );
223
+ return <button onClick={handleClick}>点击我</button>;
226
224
  }
227
225
  ```
228
226
 
@@ -234,14 +232,14 @@ export class SomeService {
234
232
  async doSomething() {
235
233
  // 使用全局日志器记录操作
236
234
  window.feGlobals.logger.info('开始执行操作');
237
-
235
+
238
236
  try {
239
237
  // 业务逻辑
240
238
  const result = await this.performOperation();
241
-
239
+
242
240
  // 使用全局对话框显示结果
243
241
  window.feGlobals.dialogHandler.showMessage('操作完成');
244
-
242
+
245
243
  return result;
246
244
  } catch (error) {
247
245
  // 使用全局日志器记录错误
@@ -260,10 +258,10 @@ export function saveUserData(data: any) {
260
258
  try {
261
259
  // 使用全局存储
262
260
  window.feGlobals.localStorage.set('userData', data);
263
-
261
+
264
262
  // 使用全局日志器
265
263
  window.feGlobals.logger.info('用户数据已保存');
266
-
264
+
267
265
  return true;
268
266
  } catch (error) {
269
267
  window.feGlobals.logger.error('保存用户数据失败:', error);
@@ -324,7 +322,7 @@ if (window.feGlobals) {
324
322
  // 扩展可以访问应用的全局服务
325
323
  const appConfig = window.feGlobals.appConfig;
326
324
  const logger = window.feGlobals.logger;
327
-
325
+
328
326
  // 执行扩展逻辑
329
327
  logger.info('浏览器扩展已加载');
330
328
  }
@@ -337,10 +335,10 @@ if (window.feGlobals) {
337
335
  ```tsx
338
336
  // ✅ 好的设计:只暴露核心服务
339
337
  export const globals = {
340
- appConfig, // 应用配置
341
- logger, // 日志服务
342
- localStorage, // 存储服务
343
- dialogHandler, // 对话框服务
338
+ appConfig, // 应用配置
339
+ logger, // 日志服务
340
+ localStorage, // 存储服务
341
+ dialogHandler // 对话框服务
344
342
  // 其他核心服务...
345
343
  };
346
344
 
@@ -409,17 +407,19 @@ console.log('日志器:', window.feGlobals?.logger);
409
407
  ### 2. 常见问题
410
408
 
411
409
  **问题 1:全局变量未注入**
410
+
412
411
  ```tsx
413
412
  // 检查 Bootstrap 配置
414
413
  const bootstrap = new Bootstrap({
415
414
  globalOptions: {
416
- sources: globals, // 确保 sources 正确
417
- target: browserGlobalsName // 确保 target 正确
415
+ sources: globals, // 确保 sources 正确
416
+ target: browserGlobalsName // 确保 target 正确
418
417
  }
419
418
  });
420
419
  ```
421
420
 
422
421
  **问题 2:类型错误**
422
+
423
423
  ```tsx
424
424
  // 检查类型声明
425
425
  declare global {
@@ -430,6 +430,7 @@ declare global {
430
430
  ```
431
431
 
432
432
  **问题 3:全局变量被修改**
433
+
433
434
  ```tsx
434
435
  // 确保使用 Object.freeze
435
436
  Object.freeze(Object.assign({}, sources));
@@ -466,8 +467,8 @@ export const globals = {
466
467
  appConfig,
467
468
  logger,
468
469
  // 不要暴露 API 密钥、密码等敏感信息
469
- apiKey: 'secret_key', // 危险!
470
- password: 'password' // 危险!
470
+ apiKey: 'secret_key', // 危险!
471
+ password: 'password' // 危险!
471
472
  };
472
473
 
473
474
  // ✅ 只暴露必要的服务
@@ -507,4 +508,4 @@ export const browserGlobalsName = 'feGlobals'; // 而不是通用的 'globals'
507
508
  4. **第三方集成**:便于与第三方库集成
508
509
  5. **开发体验**:提升开发效率和调试体验
509
510
 
510
- 通过合理使用全局变量注入,可以让应用的核心服务在任何地方都能方便地访问,同时保持代码的整洁和类型安全。
511
+ 通过合理使用全局变量注入,可以让应用的核心服务在任何地方都能方便地访问,同时保持代码的整洁和类型安全。
@@ -0,0 +1,268 @@
1
+ # 国际化系统
2
+
3
+ ## 概述
4
+
5
+ 国际化系统采用基于标识符别名的方案,结合 i18next 和 TypeScript 注释,实现了一个类型安全、易维护的国际化解决方案。主要特点:
6
+
7
+ - **标识符别名**:使用常量而非字符串作为翻译键
8
+ - **TypeScript 注释**:通过注释自动生成翻译资源
9
+ - **类型安全**:完整的类型检查和自动补全
10
+ - **路由集成**:支持 URL 路径中的语言参数
11
+ - **自动生成**:自动从源码生成翻译文件
12
+ - **开发友好**:完整的开发工具支持
13
+
14
+ ## 核心概念
15
+
16
+ ### 1. 标识符别名
17
+
18
+ 使用常量替代字符串键值,提供更好的类型安全和维护性:
19
+
20
+ ```typescript
21
+ // config/Identifier/common.ts
22
+
23
+ /**
24
+ * @description Theme switcher default theme label
25
+ * @localZh 默认主题
26
+ * @localEn Default Theme
27
+ */
28
+ export const HEADER_THEME_DEFAULT = 'header.theme.default';
29
+
30
+ /**
31
+ * @description Theme switcher dark theme label
32
+ * @localZh 暗色主题
33
+ * @localEn Dark Theme
34
+ */
35
+ export const HEADER_THEME_DARK = 'header.theme.dark';
36
+ ```
37
+
38
+ ### 2. 自动生成配置
39
+
40
+ 在 `vite.config.ts` 中配置自动生成:
41
+
42
+ ```typescript
43
+ import ts2Locales from '@brain-toolkit/ts2locales/vite';
44
+
45
+ export default defineConfig({
46
+ plugins: [
47
+ ts2Locales({
48
+ locales: ['en', 'zh'],
49
+ options: [
50
+ {
51
+ source: './config/Identifier/common.ts',
52
+ target: './public/locales/{{lng}}/common.json'
53
+ },
54
+ {
55
+ source: './config/Identifier/error.ts',
56
+ target: './public/locales/{{lng}}/common.json'
57
+ }
58
+ ]
59
+ })
60
+ ]
61
+ });
62
+ ```
63
+
64
+ ### 3. i18n 服务配置
65
+
66
+ ```typescript
67
+ // config/i18n.ts
68
+ export default {
69
+ fallbackLng: 'en',
70
+ debug: false,
71
+ interpolation: {
72
+ escapeValue: false
73
+ },
74
+ ns: ['common'],
75
+ defaultNS: 'common',
76
+ backend: {
77
+ loadPath: '/locales/{{lng}}/{{ns}}.json'
78
+ },
79
+ supportedLngs: ['en', 'zh']
80
+ } as const;
81
+ ```
82
+
83
+ ## 使用方式
84
+
85
+ ### 1. 定义翻译键
86
+
87
+ ```typescript
88
+ // config/Identifier/page.ts
89
+
90
+ /**
91
+ * @description Home page title
92
+ * @localZh 首页
93
+ * @localEn Home
94
+ */
95
+ export const PAGE_HOME_TITLE = 'page.home.title';
96
+
97
+ /**
98
+ * @description Home page welcome message
99
+ * @localZh 欢迎来到我们的应用
100
+ * @localEn Welcome to our application
101
+ */
102
+ export const PAGE_HOME_WELCOME = 'page.home.welcome';
103
+ ```
104
+
105
+ ### 2. 在组件中使用
106
+
107
+ ```tsx
108
+ import { useTranslation } from 'react-i18next';
109
+ import * as i18nKeys from '@config/Identifier/page';
110
+
111
+ function HomePage() {
112
+ const { t } = useTranslation();
113
+
114
+ return (
115
+ <div>
116
+ <h1>{t(i18nKeys.PAGE_HOME_TITLE)}</h1>
117
+ <p>{t(i18nKeys.PAGE_HOME_WELCOME)}</p>
118
+ </div>
119
+ );
120
+ }
121
+ ```
122
+
123
+ ### 3. 带参数的翻译
124
+
125
+ ```typescript
126
+ /**
127
+ * @description Welcome user message
128
+ * @localZh 欢迎,{{name}}!
129
+ * @localEn Welcome, {{name}}!
130
+ */
131
+ export const USER_WELCOME = 'user.welcome';
132
+
133
+ function Welcome({ username }: { username: string }) {
134
+ const { t } = useTranslation();
135
+ return <h1>{t(i18nKeys.USER_WELCOME, { name: username })}</h1>;
136
+ }
137
+ ```
138
+
139
+ ### 4. 语言切换
140
+
141
+ ```tsx
142
+ import { IOC } from '@/core/IOC';
143
+ import { I18nService } from '@/base/services/I18nService';
144
+
145
+ function LanguageSwitcher() {
146
+ const i18nService = IOC(I18nService);
147
+ const currentLang = i18nService.getCurrentLanguage();
148
+
149
+ const handleChange = (lang: string) => {
150
+ i18nService.changeLanguage(lang);
151
+ };
152
+
153
+ return (
154
+ <select value={currentLang} onChange={(e) => handleChange(e.target.value)}>
155
+ <option value="zh">中文</option>
156
+ <option value="en">English</option>
157
+ </select>
158
+ );
159
+ }
160
+ ```
161
+
162
+ ## 最佳实践
163
+
164
+ ### 1. 标识符组织
165
+
166
+ - **命名规范**:
167
+
168
+ ```typescript
169
+ // 页面相关
170
+ PAGE_HOME_TITLE;
171
+ PAGE_ABOUT_DESCRIPTION;
172
+
173
+ // 功能模块相关
174
+ AUTH_LOGIN_BUTTON;
175
+ AUTH_LOGOUT_CONFIRM;
176
+
177
+ // 公共组件相关
178
+ COMMON_SUBMIT_BUTTON;
179
+ COMMON_CANCEL_BUTTON;
180
+ ```
181
+
182
+ - **文件组织**:
183
+ ```
184
+ config/
185
+ ├── Identifier/
186
+ │ ├── common.ts // 公共文本
187
+ │ ├── page.ts // 页面文本
188
+ │ ├── error.ts // 错误信息
189
+ │ └── auth.ts // 认证相关
190
+ ```
191
+
192
+ ### 2. 注释规范
193
+
194
+ ```typescript
195
+ /**
196
+ * @description 简短的描述,说明文本用途
197
+ * @localZh 中文翻译文本
198
+ * @localEn 英文翻译文本
199
+ */
200
+ ```
201
+
202
+ ### 3. 类型安全
203
+
204
+ ```typescript
205
+ // 使用类型导入确保键值存在
206
+ import * as i18nKeys from '@config/Identifier';
207
+
208
+ // 类型检查会捕获错误的键值
209
+ t(i18nKeys.NONEXISTENT_KEY); // TS 错误
210
+ ```
211
+
212
+ ### 4. 动态内容
213
+
214
+ ```typescript
215
+ /**
216
+ * @description File upload progress
217
+ * @localZh 已上传 {{count}} 个文件,共 {{total}} 个
218
+ * @localEn Uploaded {{count}} files out of {{total}}
219
+ */
220
+ export const UPLOAD_PROGRESS = 'upload.progress';
221
+
222
+ // 使用
223
+ t(i18nKeys.UPLOAD_PROGRESS, { count: 3, total: 10 });
224
+ ```
225
+
226
+ ## 工作流程
227
+
228
+ 1. **开发阶段**:
229
+ - 在 Identifier 文件中定义翻译键和注释
230
+ - 使用标识符别名在代码中引用翻译
231
+ - 运行开发服务器时自动生成翻译文件
232
+
233
+ 2. **构建阶段**:
234
+ - 自动检查翻译完整性
235
+ - 生成生产环境翻译文件
236
+ - 优化翻译资源加载
237
+
238
+ 3. **运行时**:
239
+ - 根据 URL 检测语言
240
+ - 按需加载翻译资源
241
+ - 响应语言切换事件
242
+
243
+ ## 常见问题
244
+
245
+ ### 1. 翻译未生效
246
+
247
+ 检查以下几点:
248
+
249
+ - 确保标识符正确导出
250
+ - 检查注释格式是否规范
251
+ - 验证翻译文件是否生成
252
+ - 确认语言检测正确
253
+
254
+ ### 2. 类型错误
255
+
256
+ 可能的解决方案:
257
+
258
+ - 检查标识符导入路径
259
+ - 确保使用正确的标识符
260
+ - 更新 TypeScript 类型定义
261
+
262
+ ### 3. 性能优化
263
+
264
+ 开发建议:
265
+
266
+ - 合理拆分翻译文件
267
+ - 使用翻译资源预加载
268
+ - 避免重复翻译键
@@ -0,0 +1,173 @@
1
+ # React 应用开发文档
2
+
3
+ ## 简介
4
+
5
+ 这是一个基于 React 18 的现代化前端应用模板,集成了完整的开发框架和工具链。本模板提供了一套完整的开发解决方案,包括状态管理、路由管理、国际化、主题系统等核心功能。
6
+
7
+ ### 主要特性
8
+
9
+ - 🚀 **现代化技术栈**:基于 React 18、TypeScript、Vite
10
+ - 🎨 **主题定制**:支持动态主题切换,深色模式
11
+ - 🌍 **国际化**:内置多语言支持
12
+ - 📦 **状态管理**:基于发布订阅的响应式状态管理
13
+ - 🔑 **认证系统**:完整的用户认证解决方案
14
+ - 🛠️ **开发工具**:ESLint、Prettier、TypeScript
15
+ - 📱 **响应式设计**:支持多端适配
16
+ - 🧪 **测试支持**:集成单元测试和组件测试
17
+
18
+ ## 快速开始
19
+
20
+ ```bash
21
+ # 安装依赖
22
+ npm install
23
+
24
+ # 启动开发服务器
25
+ npm run dev
26
+
27
+ # 构建生产版本
28
+ npm run build
29
+ ```
30
+
31
+ ## 文档导航
32
+
33
+ ### 架构指南
34
+
35
+ - [项目结构说明](./project-structure.md)
36
+ - [开发规范指南](./development-guide.md)
37
+ - [构建部署指南](./deployment.md)
38
+
39
+ ### 核心功能
40
+
41
+ - [路由开发指南](./router.md)
42
+ - [状态管理指南](./store.md)
43
+ - [国际化开发指南](./i18n.md)
44
+ - [主题开发指南](./theme.md)
45
+ - [请求系统指南](./request.md)
46
+
47
+ ### 组件开发
48
+
49
+ - [组件开发指南](./component-guide.md)
50
+ - [TypeScript 开发规范](./typescript-guide.md)
51
+ - [样式开发指南](./styling-guide.md)
52
+
53
+ ### 工具和测试
54
+
55
+ - [测试开发指南](./testing.md)
56
+ - [Git 工作流指南](./git-workflow.md)
57
+ - [性能优化指南](./performance.md)
58
+
59
+ ### 安全和最佳实践
60
+
61
+ - [安全开发指南](./security.md)
62
+ - [文档编写指南](./documentation.md)
63
+
64
+ ## 目录结构
65
+
66
+ ```
67
+ docs/zh/
68
+ ├── index.md # 本文档
69
+ ├── project-structure.md # 项目结构说明
70
+ ├── development-guide.md # 开发规范指南
71
+ ├── router.md # 路由开发指南
72
+ ├── store.md # 状态管理指南
73
+ ├── i18n.md # 国际化开发指南
74
+ ├── theme.md # 主题开发指南
75
+ └── ...
76
+ ```
77
+
78
+ ## 核心概念
79
+
80
+ ### 1. 启动流程
81
+
82
+ 应用采用插件化的启动流程:
83
+
84
+ ```
85
+ Bootstrap 初始化 → 加载插件 → 初始化服务 → 渲染应用
86
+ ```
87
+
88
+ ### 2. 状态管理
89
+
90
+ 基于发布订阅模式的响应式状态管理:
91
+
92
+ ```
93
+ Action 触发 → Store 更新 → 组件重渲染
94
+ ```
95
+
96
+ ### 3. 路由系统
97
+
98
+ 配置式路由管理:
99
+
100
+ ```
101
+ 路由配置 → 自动生成路由 → 代码分割 → 按需加载
102
+ ```
103
+
104
+ ### 4. 国际化
105
+
106
+ 基于 TypeScript 注释的自动国际化:
107
+
108
+ ```
109
+ 注释定义 → 自动生成资源 → 动态加载 → 语言切换
110
+ ```
111
+
112
+ ## 开发流程
113
+
114
+ 1. **需求分析**
115
+ - 理解业务需求
116
+ - 设计技术方案
117
+ - 评估开发周期
118
+
119
+ 2. **开发阶段**
120
+ - 遵循开发规范
121
+ - 编写单元测试
122
+ - 进行代码审查
123
+
124
+ 3. **测试阶段**
125
+ - 单元测试
126
+ - 集成测试
127
+ - 性能测试
128
+
129
+ 4. **部署上线**
130
+ - 构建优化
131
+ - 部署配置
132
+ - 监控告警
133
+
134
+ ## 常见问题
135
+
136
+ ### 1. 开发环境配置
137
+
138
+ - 确保 Node.js 版本 >= 16
139
+ - 使用推荐的 IDE 配置
140
+ - 安装必要的开发工具
141
+
142
+ ### 2. 构建相关
143
+
144
+ - 常见构建错误解决
145
+ - 性能优化建议
146
+ - 部署注意事项
147
+
148
+ ### 3. 开发相关
149
+
150
+ - 代码规范问题
151
+ - 类型系统使用
152
+ - 组件开发规范
153
+
154
+ ## 贡献指南
155
+
156
+ 1. Fork 项目
157
+ 2. 创建特性分支
158
+ 3. 提交变更
159
+ 4. 发起 Pull Request
160
+
161
+ ## 更新日志
162
+
163
+ 查看 [CHANGELOG.md](../../CHANGELOG.md) 了解详细的更新历史。
164
+
165
+ ## 支持和帮助
166
+
167
+ - 提交 Issue
168
+ - 查看 Wiki
169
+ - 参与讨论
170
+
171
+ ## 许可证
172
+
173
+ 本项目基于 [ISC 许可证](../../LICENSE) 开源。