@4399ywkf/cli 1.0.8 → 1.0.9
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.
- package/dist/templates/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/AppTheme.tsx +136 -0
- package/dist/templates/DIRECTORY_STRUCTURE.md +141 -0
- package/dist/templates/GlobalProvider/AppTheme.tsx +136 -0
- package/dist/templates/GlobalProvider/Locale.tsx +84 -0
- package/dist/templates/GlobalProvider/Query.tsx +12 -0
- package/dist/templates/GlobalProvider/StyleRegistry.tsx +9 -0
- package/dist/templates/GlobalProvider/index.tsx +23 -0
- package/dist/templates/Locale.tsx +55 -56
- package/dist/templates/Query.tsx +12 -0
- package/dist/templates/StyleRegistry.tsx +9 -0
- package/dist/templates/analyzeUnusedKeys.ts +506 -0
- package/dist/templates/app/.i18nrc.js +57 -0
- package/dist/templates/app/docs/DIRECTORY_STRUCTURE.md +141 -0
- package/dist/templates/app/docs/glossary.md +11 -0
- package/dist/templates/app/package.json.tpl +7 -15
- package/dist/templates/app/scripts/i18nWorkflow/analyzeUnusedKeys.ts +506 -0
- package/dist/templates/app/scripts/i18nWorkflow/cleanUnusedKeys.ts +344 -0
- package/dist/templates/app/scripts/i18nWorkflow/const.ts +18 -0
- package/dist/templates/app/scripts/i18nWorkflow/flattenLocaleKeys.ts +139 -0
- package/dist/templates/app/scripts/i18nWorkflow/genDefaultLocale.ts +19 -0
- package/dist/templates/app/scripts/i18nWorkflow/genDiff.ts +49 -0
- package/dist/templates/app/scripts/i18nWorkflow/i18nConfig.ts +7 -0
- package/dist/templates/app/scripts/i18nWorkflow/index.ts +11 -0
- package/dist/templates/app/scripts/i18nWorkflow/protectedPatterns.ts +91 -0
- package/dist/templates/app/scripts/i18nWorkflow/utils.ts +76 -0
- package/dist/templates/app/src/components/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/app/src/index.tsx +0 -4
- package/dist/templates/app/src/layout/GlobalProvider/AppTheme.tsx +136 -0
- package/dist/templates/app/src/layout/GlobalProvider/Locale.tsx +84 -0
- package/dist/templates/app/src/layout/GlobalProvider/Query.tsx +12 -0
- package/dist/templates/app/src/layout/GlobalProvider/StyleRegistry.tsx +9 -0
- package/dist/templates/app/src/layout/GlobalProvider/index.tsx +23 -0
- package/dist/templates/app/src/locales/utils.ts +23 -0
- package/dist/templates/app/src/pages/base/index.tsx +170 -79
- package/dist/templates/app/src/routes.tsx +2 -2
- package/dist/templates/app/tsconfig.json +19 -3
- package/dist/templates/base/index.tsx +170 -79
- package/dist/templates/cleanUnusedKeys.ts +344 -0
- package/dist/templates/components/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/const.ts +18 -0
- package/dist/templates/docs/DIRECTORY_STRUCTURE.md +141 -0
- package/dist/templates/docs/glossary.md +11 -0
- package/dist/templates/flattenLocaleKeys.ts +139 -0
- package/dist/templates/genDefaultLocale.ts +19 -0
- package/dist/templates/genDiff.ts +49 -0
- package/dist/templates/glossary.md +11 -0
- package/dist/templates/i18nConfig.ts +7 -0
- package/dist/templates/i18nWorkflow/analyzeUnusedKeys.ts +506 -0
- package/dist/templates/i18nWorkflow/cleanUnusedKeys.ts +344 -0
- package/dist/templates/i18nWorkflow/const.ts +18 -0
- package/dist/templates/i18nWorkflow/flattenLocaleKeys.ts +139 -0
- package/dist/templates/i18nWorkflow/genDefaultLocale.ts +19 -0
- package/dist/templates/i18nWorkflow/genDiff.ts +49 -0
- package/dist/templates/i18nWorkflow/i18nConfig.ts +7 -0
- package/dist/templates/i18nWorkflow/index.ts +11 -0
- package/dist/templates/i18nWorkflow/protectedPatterns.ts +91 -0
- package/dist/templates/i18nWorkflow/utils.ts +76 -0
- package/dist/templates/index.tsx +170 -79
- package/dist/templates/layout/GlobalProvider/AppTheme.tsx +136 -0
- package/dist/templates/layout/GlobalProvider/Locale.tsx +84 -0
- package/dist/templates/layout/GlobalProvider/Query.tsx +12 -0
- package/dist/templates/layout/GlobalProvider/StyleRegistry.tsx +9 -0
- package/dist/templates/layout/GlobalProvider/index.tsx +23 -0
- package/dist/templates/locales/utils.ts +23 -0
- package/dist/templates/package.json.tpl +7 -15
- package/dist/templates/pages/base/index.tsx +170 -79
- package/dist/templates/protectedPatterns.ts +91 -0
- package/dist/templates/routes.tsx +2 -2
- package/dist/templates/scripts/i18nWorkflow/analyzeUnusedKeys.ts +506 -0
- package/dist/templates/scripts/i18nWorkflow/cleanUnusedKeys.ts +344 -0
- package/dist/templates/scripts/i18nWorkflow/const.ts +18 -0
- package/dist/templates/scripts/i18nWorkflow/flattenLocaleKeys.ts +139 -0
- package/dist/templates/scripts/i18nWorkflow/genDefaultLocale.ts +19 -0
- package/dist/templates/scripts/i18nWorkflow/genDiff.ts +49 -0
- package/dist/templates/scripts/i18nWorkflow/i18nConfig.ts +7 -0
- package/dist/templates/scripts/i18nWorkflow/index.ts +11 -0
- package/dist/templates/scripts/i18nWorkflow/protectedPatterns.ts +91 -0
- package/dist/templates/scripts/i18nWorkflow/utils.ts +76 -0
- package/dist/templates/src/components/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/src/index.tsx +0 -4
- package/dist/templates/src/layout/GlobalProvider/AppTheme.tsx +136 -0
- package/dist/templates/src/layout/GlobalProvider/Locale.tsx +84 -0
- package/dist/templates/src/layout/GlobalProvider/Query.tsx +12 -0
- package/dist/templates/src/layout/GlobalProvider/StyleRegistry.tsx +9 -0
- package/dist/templates/src/layout/GlobalProvider/index.tsx +23 -0
- package/dist/templates/src/locales/utils.ts +23 -0
- package/dist/templates/src/pages/base/index.tsx +170 -79
- package/dist/templates/src/routes.tsx +2 -2
- package/dist/templates/tsconfig.json +19 -3
- package/dist/templates/type.ts +23 -24
- package/dist/templates/utils.ts +23 -0
- package/package.json +19 -21
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const SAFE_KEY = /^[^.[\]]+$/;
|
|
2
|
+
|
|
3
|
+
export const toLodashPath = (segments: Array<number | string>) => {
|
|
4
|
+
let path = '';
|
|
5
|
+
|
|
6
|
+
for (const segment of segments) {
|
|
7
|
+
if (typeof segment === 'number') {
|
|
8
|
+
path += `[${segment}]`;
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const key = segment;
|
|
13
|
+
const safe = SAFE_KEY.test(key);
|
|
14
|
+
if (safe) {
|
|
15
|
+
path += path ? `.${key}` : key;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
path += `[${JSON.stringify(key)}]`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return path;
|
|
23
|
+
};
|
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
"dev:test": "cross-env NODE_ENV=testDevelopment rspack serve --config config/rspack/rspack.dev.mjs",
|
|
9
9
|
"build:test": "cross-env NODE_ENV=test rspack build --config config/rspack/rspack.prod.mjs --mode production",
|
|
10
10
|
"build": "cross-env NODE_ENV=production rspack build --config config/rspack/rspack.prod.mjs --mode production",
|
|
11
|
-
"test": "jest",
|
|
12
11
|
"lint": "biome check",
|
|
13
|
-
"test:watch": "jest --watch",
|
|
14
|
-
"test:coverage": "jest --coverage",
|
|
15
12
|
"prepare": "husky install",
|
|
13
|
+
"i18n": "npm run workflow:i18n && lobe-i18n && prettier -c --write \"locales/**\"",
|
|
14
|
+
"workflow:i18n": "tsx ./scripts/i18nWorkflow/index.ts",
|
|
16
15
|
"test:ci": "jest --coverage --watchAll=false"
|
|
17
16
|
},
|
|
18
17
|
"engines": {
|
|
@@ -29,7 +28,7 @@
|
|
|
29
28
|
"@tanstack/react-query": "^5.80.6",
|
|
30
29
|
"ahooks": "^3.8.5",
|
|
31
30
|
"antd": "^6.1.1",
|
|
32
|
-
"antd-style": "^
|
|
31
|
+
"antd-style": "^4.0.0",
|
|
33
32
|
"clsx": "^2.1.1",
|
|
34
33
|
"copy-webpack-plugin": "^13.0.1",
|
|
35
34
|
"dayjs": "^1.11.13",
|
|
@@ -53,7 +52,6 @@
|
|
|
53
52
|
"resolve-accept-language": "^3.1.11",
|
|
54
53
|
"rtl-detect": "^1.1.2",
|
|
55
54
|
"rxjs": "^7.8.2",
|
|
56
|
-
"styled-components": "^5.3.11",
|
|
57
55
|
"tailwind-merge": "^3.3.0",
|
|
58
56
|
"tailwindcss": "^4.1.8",
|
|
59
57
|
"universal-cookie": "^8.0.1",
|
|
@@ -71,16 +69,13 @@
|
|
|
71
69
|
"@rspack/cli": "^1.1.8",
|
|
72
70
|
"@rspack/core": "^1.1.8",
|
|
73
71
|
"@svgr/webpack": "^7.0.0",
|
|
74
|
-
"@testing-library/jest-dom": "^6.6.3",
|
|
75
|
-
"@testing-library/react": "^16.3.0",
|
|
76
|
-
"@testing-library/user-event": "^14.6.1",
|
|
77
|
-
"@types/jest": "^29.5.14",
|
|
78
72
|
"@types/lodash-es": "^4.17.12",
|
|
79
73
|
"@types/node": "^22.9.0",
|
|
80
74
|
"@types/react": "^19.1.6",
|
|
81
75
|
"@types/react-dom": "^19.1.6",
|
|
82
76
|
"@types/react-resizable": "^3.0.8",
|
|
83
|
-
"@
|
|
77
|
+
"@prettier/sync": "^0.6.1",
|
|
78
|
+
"@lobehub/i18n-cli": "^1.26.0",
|
|
84
79
|
"assert": "^2.1.0",
|
|
85
80
|
"autoprefixer": "^10.4.20",
|
|
86
81
|
"axios": "^1.6.8",
|
|
@@ -88,6 +83,7 @@
|
|
|
88
83
|
"browserify-zlib": "^0.2.0",
|
|
89
84
|
"buffer": "^6.0.3",
|
|
90
85
|
"chokidar": "^4.0.3",
|
|
86
|
+
"consola": "^3.4.2",
|
|
91
87
|
"clean-webpack-plugin": "^4.0.0",
|
|
92
88
|
"cross-env": "^7.0.3",
|
|
93
89
|
"crypto-browserify": "^3.12.1",
|
|
@@ -100,10 +96,6 @@
|
|
|
100
96
|
"globals": "^16.3.0",
|
|
101
97
|
"html-webpack-plugin": "^5.6.3",
|
|
102
98
|
"husky": "^9.1.7",
|
|
103
|
-
"jest": "^29.7.0",
|
|
104
|
-
"jest-environment-jsdom": "30.0.0-beta.3",
|
|
105
|
-
"jiti": "^2.5.1",
|
|
106
|
-
"js-cookie": "^2.2.1",
|
|
107
99
|
"less": "^4.2.0",
|
|
108
100
|
"less-loader": "^12.2.0",
|
|
109
101
|
"lint-staged": "^16.1.6",
|
|
@@ -121,11 +113,11 @@
|
|
|
121
113
|
"stream-browserify": "^3.0.0",
|
|
122
114
|
"style-loader": "^3.3.4",
|
|
123
115
|
"terser-webpack-plugin": "^5.3.11",
|
|
124
|
-
"ts-jest": "^29.3.4",
|
|
125
116
|
"ts-loader": "^9.5.1",
|
|
126
117
|
"typescript": "^5.6.3",
|
|
127
118
|
"url": "^0.11.4",
|
|
128
119
|
"util": "^0.12.5",
|
|
120
|
+
"tsx": "^4.21.0",
|
|
129
121
|
"webpack-merge": "^6.0.1"
|
|
130
122
|
},
|
|
131
123
|
"lint-staged": {
|
|
@@ -11,14 +11,117 @@ import {
|
|
|
11
11
|
import React from "react";
|
|
12
12
|
import { createStyles } from "antd-style";
|
|
13
13
|
|
|
14
|
-
const { Title, Paragraph, Text
|
|
14
|
+
const { Title, Paragraph, Text } = Typography;
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const px = (value: number | string) =>
|
|
17
|
+
typeof value === "number" ? `${value}px` : value;
|
|
18
|
+
|
|
19
|
+
const useStyles = createStyles(({ token, css }) => ({
|
|
20
|
+
root: css`
|
|
18
21
|
width: 100%;
|
|
19
|
-
height:
|
|
22
|
+
min-height: 100vh;
|
|
23
|
+
padding: ${px(token.paddingLG)};
|
|
24
|
+
background: linear-gradient(180deg, ${token.colorFillTertiary}, ${token.colorPrimaryHover});
|
|
20
25
|
overflow: auto;
|
|
21
26
|
`,
|
|
27
|
+
container: css`
|
|
28
|
+
margin: 0 auto;
|
|
29
|
+
max-width: 960px;
|
|
30
|
+
`,
|
|
31
|
+
hero: css`
|
|
32
|
+
text-align: center;
|
|
33
|
+
margin-bottom: ${px(token.marginLG)};
|
|
34
|
+
`,
|
|
35
|
+
heroIcon: css`
|
|
36
|
+
font-size: 3.5rem;
|
|
37
|
+
color: ${token.colorPrimary};
|
|
38
|
+
animation: bounce 1.2s infinite alternate;
|
|
39
|
+
|
|
40
|
+
@keyframes bounce {
|
|
41
|
+
from {
|
|
42
|
+
transform: translateY(0);
|
|
43
|
+
}
|
|
44
|
+
to {
|
|
45
|
+
transform: translateY(-6px);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`,
|
|
49
|
+
tagSpace: css`
|
|
50
|
+
margin-top: ${px(token.marginMD)};
|
|
51
|
+
`,
|
|
52
|
+
featuresGrid: css`
|
|
53
|
+
display: grid;
|
|
54
|
+
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
|
55
|
+
gap: ${px(token.marginSM)};
|
|
56
|
+
margin-bottom: ${px(token.marginLG)};
|
|
57
|
+
`,
|
|
58
|
+
featureCard: css`
|
|
59
|
+
text-align: center;
|
|
60
|
+
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
transform: translateY(-6px);
|
|
64
|
+
box-shadow: ${token.boxShadowSecondary};
|
|
65
|
+
}
|
|
66
|
+
`,
|
|
67
|
+
quickLinkGrid: css`
|
|
68
|
+
display: grid;
|
|
69
|
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
70
|
+
gap: ${px(token.marginSM)};
|
|
71
|
+
`,
|
|
72
|
+
quickLink: css`
|
|
73
|
+
padding: ${px(token.paddingMD)};
|
|
74
|
+
border-radius: ${px(token.borderRadiusLG)};
|
|
75
|
+
background: ${token.colorBgContainer};
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
transition: background 0.2s ease;
|
|
78
|
+
|
|
79
|
+
&:hover {
|
|
80
|
+
background: ${token.colorBgElevated};
|
|
81
|
+
}
|
|
82
|
+
`,
|
|
83
|
+
footerActions: css`
|
|
84
|
+
margin-top: ${px(token.marginMD)};
|
|
85
|
+
text-align: center;
|
|
86
|
+
`,
|
|
87
|
+
cardTitle: css`
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
gap: ${px(token.marginXS)};
|
|
91
|
+
font-size: ${px(token.fontSizeHeading4)};
|
|
92
|
+
`,
|
|
93
|
+
codeBlock: css`
|
|
94
|
+
margin-top: ${px(token.marginXS)};
|
|
95
|
+
padding: ${px(token.paddingSM)};
|
|
96
|
+
background: ${token.colorFillAlter};
|
|
97
|
+
border-radius: ${px(token.borderRadiusLG)};
|
|
98
|
+
font-family: ${token.fontFamilyCode};
|
|
99
|
+
font-size: ${px(token.fontSizeSM)};
|
|
100
|
+
`,
|
|
101
|
+
stepLabel: css`
|
|
102
|
+
font-size: ${px(token.fontSizeBase)};
|
|
103
|
+
`,
|
|
104
|
+
quickLinkLabel: css`
|
|
105
|
+
font-size: ${px(token.fontSizeHeading2)};
|
|
106
|
+
margin-bottom: ${px(token.marginXS)};
|
|
107
|
+
`,
|
|
108
|
+
quickLinkDescription: css`
|
|
109
|
+
color: ${token.colorTextTertiary};
|
|
110
|
+
`,
|
|
111
|
+
panelCard: css`
|
|
112
|
+
margin-bottom: ${px(token.marginLG)};
|
|
113
|
+
background: ${token.colorBgElevated};
|
|
114
|
+
`,
|
|
115
|
+
featureIcon: css`
|
|
116
|
+
margin-bottom: ${px(token.marginMD)};
|
|
117
|
+
`,
|
|
118
|
+
footerParagraph: css`
|
|
119
|
+
margin-top: ${px(token.marginMD)};
|
|
120
|
+
color: ${token.colorTextTertiary};
|
|
121
|
+
`,
|
|
122
|
+
textCenterCard: css`
|
|
123
|
+
text-align: center;
|
|
124
|
+
`,
|
|
22
125
|
}));
|
|
23
126
|
|
|
24
127
|
export default function BasePage() {
|
|
@@ -28,17 +131,17 @@ export default function BasePage() {
|
|
|
28
131
|
|
|
29
132
|
const features = [
|
|
30
133
|
{
|
|
31
|
-
icon: <ThunderboltOutlined className=
|
|
134
|
+
icon: <ThunderboltOutlined className={styles.heroIcon} />,
|
|
32
135
|
title: "Rspack 构建",
|
|
33
136
|
description: "基于 Rspack 的极速构建体验,开发效率翻倍",
|
|
34
137
|
},
|
|
35
138
|
{
|
|
36
|
-
icon: <BulbOutlined className=
|
|
139
|
+
icon: <BulbOutlined className={styles.heroIcon} />,
|
|
37
140
|
title: "React 19",
|
|
38
141
|
description: "使用最新的 React 19 特性,享受并发渲染",
|
|
39
142
|
},
|
|
40
143
|
{
|
|
41
|
-
icon: <SettingOutlined className=
|
|
144
|
+
icon: <SettingOutlined className={styles.heroIcon} />,
|
|
42
145
|
title: "TypeScript",
|
|
43
146
|
description: "完整的 TypeScript 支持,类型安全有保障",
|
|
44
147
|
},
|
|
@@ -52,107 +155,94 @@ export default function BasePage() {
|
|
|
52
155
|
];
|
|
53
156
|
|
|
54
157
|
return (
|
|
55
|
-
<div
|
|
56
|
-
className={
|
|
57
|
-
styles.app,
|
|
58
|
-
"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-50 dark:from-gray-900 dark:to-gray-800 p-8"
|
|
59
|
-
)}
|
|
60
|
-
>
|
|
61
|
-
<div className="max-w-6xl mx-auto">
|
|
158
|
+
<div className={cx(styles.root)}>
|
|
159
|
+
<div className={styles.container}>
|
|
62
160
|
<Flex vertical gap={12}>
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<RocketOutlined className="text-6xl text-blue-500 animate-bounce" />
|
|
161
|
+
<section className={styles.hero}>
|
|
162
|
+
<div>
|
|
163
|
+
<RocketOutlined className={styles.heroIcon} />
|
|
67
164
|
</div>
|
|
68
|
-
<Title level={1}
|
|
165
|
+
<Title level={1} style={{ marginBottom: 16 }}>
|
|
69
166
|
🎉 恭喜!项目创建成功
|
|
70
167
|
</Title>
|
|
71
|
-
<Paragraph
|
|
168
|
+
<Paragraph>
|
|
72
169
|
你的项目已经准备就绪,现在可以开始开发了
|
|
73
170
|
</Paragraph>
|
|
74
|
-
<Space size="middle" className=
|
|
171
|
+
<Space size="middle" className={styles.tagSpace}>
|
|
75
172
|
<Tag color="blue">React 19</Tag>
|
|
76
173
|
<Tag color="green">TypeScript</Tag>
|
|
77
174
|
<Tag color="orange">Rspack</Tag>
|
|
78
175
|
<Tag color="purple">Ant Design</Tag>
|
|
79
176
|
<Tag color="cyan">Tailwind CSS</Tag>
|
|
80
177
|
</Space>
|
|
81
|
-
</
|
|
178
|
+
</section>
|
|
82
179
|
|
|
83
|
-
{
|
|
84
|
-
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
|
|
180
|
+
<div className={styles.featuresGrid}>
|
|
85
181
|
{features.map((feature, index) => (
|
|
86
182
|
<Card
|
|
87
183
|
key={index}
|
|
88
184
|
hoverable
|
|
89
|
-
className=
|
|
185
|
+
className={cx(styles.featureCard)}
|
|
186
|
+
bodyStyle={{ padding: 24 }}
|
|
90
187
|
>
|
|
91
|
-
<div className=
|
|
188
|
+
<div className={styles.featureIcon}>{feature.icon}</div>
|
|
92
189
|
<Title level={4}>{feature.title}</Title>
|
|
93
|
-
<Paragraph
|
|
94
|
-
{feature.description}
|
|
95
|
-
</Paragraph>
|
|
190
|
+
<Paragraph type="secondary">{feature.description}</Paragraph>
|
|
96
191
|
</Card>
|
|
97
192
|
))}
|
|
98
193
|
</div>
|
|
99
194
|
|
|
100
|
-
{/* 快速开始 */}
|
|
101
195
|
<Card
|
|
102
196
|
title={
|
|
103
|
-
<span className=
|
|
104
|
-
<BookOutlined
|
|
197
|
+
<span className={styles.cardTitle}>
|
|
198
|
+
<BookOutlined />
|
|
105
199
|
快速开始
|
|
106
200
|
</span>
|
|
107
201
|
}
|
|
108
|
-
className=
|
|
202
|
+
className={styles.panelCard}
|
|
109
203
|
>
|
|
110
|
-
<Space direction="vertical" size="large"
|
|
204
|
+
<Space direction="vertical" size="large">
|
|
111
205
|
<div>
|
|
112
|
-
<Text strong className=
|
|
206
|
+
<Text strong className={styles.stepLabel}>
|
|
113
207
|
1. 安装依赖
|
|
114
208
|
</Text>
|
|
115
|
-
<div className=
|
|
209
|
+
<div className={styles.codeBlock}>
|
|
116
210
|
<code>pnpm install</code>
|
|
117
211
|
</div>
|
|
118
212
|
</div>
|
|
119
213
|
<div>
|
|
120
|
-
<Text strong className=
|
|
214
|
+
<Text strong className={styles.stepLabel}>
|
|
121
215
|
2. 启动开发服务器
|
|
122
216
|
</Text>
|
|
123
|
-
<div className=
|
|
217
|
+
<div className={styles.codeBlock}>
|
|
124
218
|
<code>pnpm dev</code>
|
|
125
219
|
</div>
|
|
126
220
|
</div>
|
|
127
221
|
<div>
|
|
128
|
-
<Text strong className=
|
|
222
|
+
<Text strong className={styles.stepLabel}>
|
|
129
223
|
3. 构建生产版本
|
|
130
224
|
</Text>
|
|
131
|
-
<div className=
|
|
225
|
+
<div className={styles.codeBlock}>
|
|
132
226
|
<code>pnpm build</code>
|
|
133
227
|
</div>
|
|
134
228
|
</div>
|
|
135
229
|
</Space>
|
|
136
230
|
</Card>
|
|
137
231
|
|
|
138
|
-
{/* 快捷链接 */}
|
|
139
232
|
<Card
|
|
140
233
|
title={
|
|
141
|
-
<span className=
|
|
142
|
-
<GithubOutlined
|
|
234
|
+
<span className={styles.cardTitle}>
|
|
235
|
+
<GithubOutlined />
|
|
143
236
|
快捷链接
|
|
144
237
|
</span>
|
|
145
238
|
}
|
|
146
|
-
className=
|
|
239
|
+
className={styles.panelCard}
|
|
147
240
|
>
|
|
148
|
-
<div className=
|
|
241
|
+
<div className={styles.quickLinkGrid}>
|
|
149
242
|
{quickLinks.map((link, index) => (
|
|
150
|
-
<div
|
|
151
|
-
|
|
152
|
-
className=
|
|
153
|
-
>
|
|
154
|
-
<div className="text-2xl mb-2">{link.label}</div>
|
|
155
|
-
<Text className="text-sm text-gray-600 dark:text-gray-400">
|
|
243
|
+
<div key={index} className={styles.quickLink}>
|
|
244
|
+
<div className={styles.quickLinkLabel}>{link.label}</div>
|
|
245
|
+
<Text className={styles.quickLinkDescription}>
|
|
156
246
|
{link.description}
|
|
157
247
|
</Text>
|
|
158
248
|
</div>
|
|
@@ -160,34 +250,35 @@ export default function BasePage() {
|
|
|
160
250
|
</div>
|
|
161
251
|
</Card>
|
|
162
252
|
|
|
163
|
-
{
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
253
|
+
<Card className={cx(styles.panelCard, styles.textCenterCard)}>
|
|
254
|
+
<div className={styles.footerActions}>
|
|
255
|
+
<Space size="large" wrap>
|
|
256
|
+
<Button
|
|
257
|
+
type="primary"
|
|
258
|
+
size="large"
|
|
259
|
+
icon={<RocketOutlined />}
|
|
260
|
+
onClick={() => window.open("https://ant.design", "_blank")}
|
|
261
|
+
>
|
|
262
|
+
查看 Ant Design 文档
|
|
263
|
+
</Button>
|
|
264
|
+
<Button
|
|
265
|
+
size="large"
|
|
266
|
+
icon={<BookOutlined />}
|
|
267
|
+
onClick={() => window.open("https://react.dev", "_blank")}
|
|
268
|
+
>
|
|
269
|
+
React 文档
|
|
270
|
+
</Button>
|
|
271
|
+
<Button
|
|
272
|
+
size="large"
|
|
273
|
+
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
|
|
274
|
+
>
|
|
275
|
+
切换主题 ({theme === "dark" ? "🌙 暗色" : "☀️ 亮色"})
|
|
276
|
+
</Button>
|
|
277
|
+
</Space>
|
|
278
|
+
<Paragraph className={styles.footerParagraph}>
|
|
279
|
+
祝你开发愉快!如有问题,请查阅文档或联系技术支持 💪
|
|
280
|
+
</Paragraph>
|
|
281
|
+
</div>
|
|
191
282
|
</Card>
|
|
192
283
|
</Flex>
|
|
193
284
|
</div>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protected patterns for i18n keys
|
|
3
|
+
*
|
|
4
|
+
* Keys matching these patterns will be considered "used" even if not found in static analysis.
|
|
5
|
+
* This is useful for dynamically generated keys like:
|
|
6
|
+
* - t(`modelProvider.${providerId}.title`)
|
|
7
|
+
* - t('error.' + errorCode)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Files to ignore at file level (won't be scanned at all)
|
|
12
|
+
*/
|
|
13
|
+
export const IGNORED_FILES = [
|
|
14
|
+
'providers.ts', // Dynamically generated from DEFAULT_MODEL_PROVIDER_LIST
|
|
15
|
+
'models.ts', // Dynamically generated from LOBE_DEFAULT_MODEL_LIST
|
|
16
|
+
'auth.ts', // Auth-related dynamic keys
|
|
17
|
+
'authError.ts', // Auth error dynamic keys
|
|
18
|
+
'error.ts', // Error messages with dynamic codes
|
|
19
|
+
'migration.ts', // Migration-related dynamic keys
|
|
20
|
+
'subscription.ts',
|
|
21
|
+
'electron.ts', // Electron-specific dynamic keys
|
|
22
|
+
'editor.ts', // Editor-related dynamic keys
|
|
23
|
+
'changelog.ts', // Changelog dynamic keys
|
|
24
|
+
'ragEval.ts',
|
|
25
|
+
'plugin.ts',
|
|
26
|
+
'tools.ts',
|
|
27
|
+
'oauth.ts',
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Namespace patterns to protect (keys won't be marked as unused)
|
|
32
|
+
*/
|
|
33
|
+
export const PROTECTED_KEY_PATTERNS = [
|
|
34
|
+
// === Namespaces with extensive dynamic usage ===
|
|
35
|
+
'modelProvider', // t(`modelProvider.${providerId}.title`)
|
|
36
|
+
|
|
37
|
+
// Discover namespace has many dynamic keys
|
|
38
|
+
'discover', // t(`assistants.status.${statusKey}.subtitle`)
|
|
39
|
+
|
|
40
|
+
// Setting namespace with dynamic agent configurations
|
|
41
|
+
'setting', // t(`systemAgent.${key}.label`)
|
|
42
|
+
|
|
43
|
+
// Hotkey namespace uses dynamic key construction
|
|
44
|
+
'hotkey', // t(`${item.id}.desc`, { ns: 'hotkey' })
|
|
45
|
+
|
|
46
|
+
// Home namespace with dynamic starter keys
|
|
47
|
+
'home', // t(`starter.${key}`)
|
|
48
|
+
|
|
49
|
+
// Welcome namespace with returnObjects usage
|
|
50
|
+
'welcome', // t('welcomeMessages', { returnObjects: true })
|
|
51
|
+
|
|
52
|
+
// Chat namespace has dynamic input keys
|
|
53
|
+
'chat', // t(`input.${key}`)
|
|
54
|
+
|
|
55
|
+
// File namespace - used in hooks that receive t as parameter
|
|
56
|
+
'file', // TFunction<'file'> passed as parameter
|
|
57
|
+
|
|
58
|
+
// MarketAuth namespace - has Trans components with dynamic keys
|
|
59
|
+
'marketAuth', // <Trans i18nKey="authorize.footer.agreement" />
|
|
60
|
+
|
|
61
|
+
// Onboarding namespace - has various dynamic usage patterns
|
|
62
|
+
'onboarding', // Onboarding flow with complex Trans usage
|
|
63
|
+
'error',
|
|
64
|
+
'errors',
|
|
65
|
+
'consent.error',
|
|
66
|
+
'builtins',
|
|
67
|
+
|
|
68
|
+
// === Add your custom patterns here ===
|
|
69
|
+
// Examples:
|
|
70
|
+
// 'error.code', // Protects all error.code.* keys
|
|
71
|
+
// 'plugin.settings', // Protects all plugin.settings.* keys
|
|
72
|
+
// 'tool', // Protects entire 'tool' namespace
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* How to use:
|
|
77
|
+
*
|
|
78
|
+
* 1. IGNORED_FILES - Files to completely skip during analysis:
|
|
79
|
+
* Add filename with .ts extension (e.g., 'auth.ts')
|
|
80
|
+
* These files won't be scanned at all
|
|
81
|
+
*
|
|
82
|
+
* 2. PROTECTED_KEY_PATTERNS - Namespace/patterns to protect:
|
|
83
|
+
* - Full namespace: 'myNamespace' protects all keys under that namespace
|
|
84
|
+
* - Prefix pattern: 'namespace.prefix' protects keys starting with that prefix
|
|
85
|
+
* (e.g., 'error.code' protects 'error.code.NOT_FOUND', 'error.code.TIMEOUT', etc.)
|
|
86
|
+
*
|
|
87
|
+
* 3. After modifying this file:
|
|
88
|
+
* - Run `bun run workflow:i18n-analyze` to regenerate the report
|
|
89
|
+
* - Run `bun run workflow:i18n-clean` to preview cleanup (both use same config)
|
|
90
|
+
* - Check the console output for "Protected patterns" to verify your config
|
|
91
|
+
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { lazy } from "react";
|
|
2
2
|
import { createBrowserRouter, Navigate } from "react-router";
|
|
3
|
-
import
|
|
3
|
+
import GlobalProvider from "@/layout/GlobalProvider";
|
|
4
4
|
|
|
5
5
|
export const createRouter = (basename?: string) => {
|
|
6
6
|
return createBrowserRouter(
|
|
7
7
|
[
|
|
8
8
|
{
|
|
9
9
|
path: "",
|
|
10
|
-
element: <
|
|
10
|
+
element: <GlobalProvider />,
|
|
11
11
|
children: [
|
|
12
12
|
{
|
|
13
13
|
path: "/",
|