@4399ywkf/cli 1.0.7 → 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/HarmonyOS_Sans_Bold.woff2 +0 -0
- package/dist/templates/HarmonyOS_Sans_Medium.woff2 +0 -0
- package/dist/templates/HarmonyOS_Sans_Regular.woff2 +0 -0
- package/dist/templates/Locale.tsx +49 -54
- package/dist/templates/MainContentWrap.tsx +11 -15
- package/dist/templates/Query.tsx +12 -0
- package/dist/templates/StyleRegistry.tsx +9 -0
- package/dist/templates/ThemeContext.tsx +27 -24
- package/dist/templates/analyzeUnusedKeys.ts +506 -0
- package/dist/templates/app/.i18nrc.js +57 -0
- package/dist/templates/app/config/env/.env.public.tpl +2 -19
- package/dist/templates/app/config/jwt/index.ts +4 -4
- package/dist/templates/app/config/request/error-handler.ts +67 -0
- package/dist/templates/app/config/request/index.ts +127 -129
- package/dist/templates/app/config/request/interceptors.ts +118 -0
- package/dist/templates/app/config/request/token-manager.ts +23 -0
- package/dist/templates/app/config/request/types.ts +63 -0
- package/dist/templates/app/config/rspack/rspack.config.mjs +62 -61
- package/dist/templates/app/config/rspack/rspack.prod.mjs +41 -62
- package/dist/templates/app/docs/DIRECTORY_STRUCTURE.md +141 -0
- package/dist/templates/app/docs/glossary.md +11 -0
- package/dist/templates/app/locales/zh-CN/common.json +3 -0
- package/dist/templates/app/package.json.tpl +8 -25
- package/dist/templates/app/public/fonts/HarmonyOS_Sans_Bold.woff2 +0 -0
- package/dist/templates/app/public/fonts/HarmonyOS_Sans_Medium.woff2 +0 -0
- package/dist/templates/app/public/fonts/HarmonyOS_Sans_Regular.woff2 +0 -0
- package/dist/templates/app/react-app-env.d.ts +13 -8
- 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/bootstrap/index.ts +34 -0
- package/dist/templates/app/src/components/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/app/src/config/env.ts +84 -0
- package/dist/templates/app/src/index.tsx +13 -51
- 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/layout/Locale.tsx +14 -18
- package/dist/templates/app/src/layout/MainContentWrap.tsx +11 -15
- package/dist/templates/app/src/layout/ThemeContext.tsx +27 -24
- package/dist/templates/app/src/locales/default/common.ts +3 -1
- package/dist/templates/app/src/locales/utils.ts +23 -0
- package/dist/templates/app/src/micro/garfish.ts +53 -0
- package/dist/templates/app/src/pages/base/index.tsx +280 -25
- package/dist/templates/app/src/routes.tsx +21 -12
- package/dist/templates/app/src/types/global.d.ts +19 -0
- package/dist/templates/app/src/utils/index.ts +3 -1
- package/dist/templates/app/store/middleware/createDevtools.ts +7 -7
- package/dist/templates/app/tsconfig.json +19 -3
- package/dist/templates/base/index.tsx +280 -25
- package/dist/templates/bootstrap/index.ts +34 -0
- package/dist/templates/cleanUnusedKeys.ts +344 -0
- package/dist/templates/common.json +3 -0
- package/dist/templates/common.ts +3 -1
- package/dist/templates/components/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/config/env/.env.public.tpl +2 -19
- package/dist/templates/config/env.ts +84 -0
- package/dist/templates/config/jwt/index.ts +4 -4
- package/dist/templates/config/request/error-handler.ts +67 -0
- package/dist/templates/config/request/index.ts +127 -129
- package/dist/templates/config/request/interceptors.ts +118 -0
- package/dist/templates/config/request/token-manager.ts +23 -0
- package/dist/templates/config/request/types.ts +63 -0
- package/dist/templates/config/rspack/rspack.config.mjs +62 -61
- package/dist/templates/config/rspack/rspack.prod.mjs +41 -62
- package/dist/templates/const.ts +18 -0
- package/dist/templates/createDevtools.ts +7 -7
- package/dist/templates/default/common.ts +3 -1
- package/dist/templates/docs/DIRECTORY_STRUCTURE.md +141 -0
- package/dist/templates/docs/glossary.md +11 -0
- package/dist/templates/env/.env.public.tpl +2 -19
- package/dist/templates/env.ts +83 -2
- package/dist/templates/error-handler.ts +67 -0
- package/dist/templates/flattenLocaleKeys.ts +139 -0
- package/dist/templates/fonts/HarmonyOS_Sans_Bold.woff2 +0 -0
- package/dist/templates/fonts/HarmonyOS_Sans_Medium.woff2 +0 -0
- package/dist/templates/fonts/HarmonyOS_Sans_Regular.woff2 +0 -0
- package/dist/templates/garfish.ts +53 -0
- package/dist/templates/genDefaultLocale.ts +19 -0
- package/dist/templates/genDiff.ts +49 -0
- package/dist/templates/global.d.ts +19 -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 +280 -25
- package/dist/templates/interceptors.ts +118 -0
- package/dist/templates/jwt/index.ts +4 -4
- 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/layout/Locale.tsx +14 -18
- package/dist/templates/layout/MainContentWrap.tsx +11 -15
- package/dist/templates/layout/ThemeContext.tsx +27 -24
- package/dist/templates/locales/default/common.ts +3 -1
- package/dist/templates/locales/utils.ts +23 -0
- package/dist/templates/locales/zh-CN/common.json +3 -0
- package/dist/templates/micro/garfish.ts +53 -0
- package/dist/templates/middleware/createDevtools.ts +7 -7
- package/dist/templates/package.json.tpl +8 -25
- package/dist/templates/page.tsx +21 -19
- package/dist/templates/pages/base/index.tsx +280 -25
- package/dist/templates/protectedPatterns.ts +91 -0
- package/dist/templates/public/fonts/HarmonyOS_Sans_Bold.woff2 +0 -0
- package/dist/templates/public/fonts/HarmonyOS_Sans_Medium.woff2 +0 -0
- package/dist/templates/public/fonts/HarmonyOS_Sans_Regular.woff2 +0 -0
- package/dist/templates/react-app-env.d.ts +13 -8
- package/dist/templates/request/error-handler.ts +67 -0
- package/dist/templates/request/index.ts +127 -129
- package/dist/templates/request/interceptors.ts +118 -0
- package/dist/templates/request/token-manager.ts +23 -0
- package/dist/templates/request/types.ts +63 -0
- package/dist/templates/routes.tsx +21 -12
- package/dist/templates/rspack/rspack.config.mjs +62 -61
- package/dist/templates/rspack/rspack.prod.mjs +41 -62
- package/dist/templates/rspack.config.mjs +62 -61
- package/dist/templates/rspack.prod.mjs +41 -62
- 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/bootstrap/index.ts +34 -0
- package/dist/templates/src/components/AntdStaticMethods/index.tsx +20 -0
- package/dist/templates/src/config/env.ts +84 -0
- package/dist/templates/src/index.tsx +13 -51
- 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/layout/Locale.tsx +14 -18
- package/dist/templates/src/layout/MainContentWrap.tsx +11 -15
- package/dist/templates/src/layout/ThemeContext.tsx +27 -24
- package/dist/templates/src/locales/default/common.ts +3 -1
- package/dist/templates/src/locales/utils.ts +23 -0
- package/dist/templates/src/micro/garfish.ts +53 -0
- package/dist/templates/src/pages/base/index.tsx +280 -25
- package/dist/templates/src/routes.tsx +21 -12
- package/dist/templates/src/types/global.d.ts +19 -0
- package/dist/templates/src/utils/index.ts +3 -1
- package/dist/templates/store/middleware/createDevtools.ts +7 -7
- package/dist/templates/token-manager.ts +23 -0
- package/dist/templates/tsconfig.json +19 -3
- package/dist/templates/type.ts +23 -24
- package/dist/templates/types/global.d.ts +19 -0
- package/dist/templates/utils/index.ts +3 -1
- package/dist/templates/utils.ts +23 -0
- package/dist/templates/zh-CN/common.json +3 -0
- package/package.json +19 -21
- package/dist/templates/app/config/sentry/sentry.config.ts +0 -188
- package/dist/templates/app/src/hooks/useRouteTitle.tsx +0 -36
- package/dist/templates/app/src/hooks/useSentry.ts +0 -92
- package/dist/templates/app/src/pages/base/layout.tsx +0 -6
- package/dist/templates/app/src/pages/base/page.tsx +0 -25
- package/dist/templates/app/src/utils/env.ts +0 -3
- package/dist/templates/app/src/utils/format.ts +0 -21
- package/dist/templates/app/src/utils/getMicroApp.ts +0 -39
- package/dist/templates/app/src/utils/sentry.ts +0 -187
- package/dist/templates/app/src/utils/sentryDecorators.ts +0 -34
- package/dist/templates/app/src/utils/updateVersion.ts +0 -186
- package/dist/templates/base/layout.tsx +0 -6
- package/dist/templates/base/page.tsx +0 -25
- package/dist/templates/config/public/404.png +0 -0
- package/dist/templates/config/public/favicon.ico +0 -0
- package/dist/templates/config/public/images/banner_market_modal.webp +0 -0
- package/dist/templates/config/public/images/chatmode_chat_dark.webp +0 -0
- package/dist/templates/config/public/images/chatmode_chat_light.webp +0 -0
- package/dist/templates/config/public/images/chatmode_docs_dark.webp +0 -0
- package/dist/templates/config/public/images/chatmode_docs_light.webp +0 -0
- package/dist/templates/config/public/images/empty_topic_dark.webp +0 -0
- package/dist/templates/config/public/images/empty_topic_light.webp +0 -0
- package/dist/templates/config/public/images/screenshot_background.webp +0 -0
- package/dist/templates/config/public/images/theme_auto.webp +0 -0
- package/dist/templates/config/public/images/theme_dark.webp +0 -0
- package/dist/templates/config/public/images/theme_light.webp +0 -0
- package/dist/templates/config/public/index.html +0 -29
- package/dist/templates/config/sentry/sentry.config.ts +0 -188
- package/dist/templates/format.ts +0 -21
- package/dist/templates/getMicroApp.ts +0 -39
- package/dist/templates/hooks/useRouteTitle.tsx +0 -36
- package/dist/templates/hooks/useSentry.ts +0 -92
- package/dist/templates/layout.tsx +0 -6
- package/dist/templates/pages/base/layout.tsx +0 -6
- package/dist/templates/pages/base/page.tsx +0 -25
- package/dist/templates/sentry/sentry.config.ts +0 -188
- package/dist/templates/sentry.config.ts +0 -188
- package/dist/templates/sentry.ts +0 -187
- package/dist/templates/sentryDecorators.ts +0 -34
- package/dist/templates/src/hooks/useRouteTitle.tsx +0 -36
- package/dist/templates/src/hooks/useSentry.ts +0 -92
- package/dist/templates/src/pages/base/layout.tsx +0 -6
- package/dist/templates/src/pages/base/page.tsx +0 -25
- package/dist/templates/src/utils/env.ts +0 -3
- package/dist/templates/src/utils/format.ts +0 -21
- package/dist/templates/src/utils/getMicroApp.ts +0 -39
- package/dist/templates/src/utils/sentry.ts +0 -187
- package/dist/templates/src/utils/sentryDecorators.ts +0 -34
- package/dist/templates/src/utils/updateVersion.ts +0 -186
- package/dist/templates/updateVersion.ts +0 -186
- package/dist/templates/useRouteTitle.tsx +0 -36
- package/dist/templates/useSentry.ts +0 -92
- package/dist/templates/utils/env.ts +0 -3
- package/dist/templates/utils/format.ts +0 -21
- package/dist/templates/utils/getMicroApp.ts +0 -39
- package/dist/templates/utils/sentry.ts +0 -187
- package/dist/templates/utils/sentryDecorators.ts +0 -34
- package/dist/templates/utils/updateVersion.ts +0 -186
- /package/dist/templates/app/{config/public → public}/404.png +0 -0
- /package/dist/templates/app/{config/public → public}/favicon.ico +0 -0
- /package/dist/templates/app/{config/public → public}/images/banner_market_modal.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/chatmode_chat_dark.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/chatmode_chat_light.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/chatmode_docs_dark.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/chatmode_docs_light.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/empty_topic_dark.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/empty_topic_light.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/screenshot_background.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/theme_auto.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/theme_dark.webp +0 -0
- /package/dist/templates/app/{config/public → public}/images/theme_light.webp +0 -0
- /package/dist/templates/app/{config/public → public}/index.html +0 -0
|
@@ -1,32 +1,287 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { useUserStore } from "@store/user";
|
|
2
|
+
import { Button, Card, Space, Typography, Tag, Flex } from "antd";
|
|
3
|
+
import {
|
|
4
|
+
RocketOutlined,
|
|
5
|
+
ThunderboltOutlined,
|
|
6
|
+
BulbOutlined,
|
|
7
|
+
GithubOutlined,
|
|
8
|
+
BookOutlined,
|
|
9
|
+
SettingOutlined,
|
|
10
|
+
} from "@ant-design/icons";
|
|
11
|
+
import React from "react";
|
|
12
|
+
import { createStyles } from "antd-style";
|
|
13
|
+
|
|
14
|
+
const { Title, Paragraph, Text } = Typography;
|
|
15
|
+
|
|
16
|
+
const px = (value: number | string) =>
|
|
17
|
+
typeof value === "number" ? `${value}px` : value;
|
|
18
|
+
|
|
19
|
+
const useStyles = createStyles(({ token, css }) => ({
|
|
20
|
+
root: css`
|
|
21
|
+
width: 100%;
|
|
22
|
+
min-height: 100vh;
|
|
23
|
+
padding: ${px(token.paddingLG)};
|
|
24
|
+
background: linear-gradient(180deg, ${token.colorFillTertiary}, ${token.colorPrimaryHover});
|
|
25
|
+
overflow: auto;
|
|
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
|
+
`,
|
|
125
|
+
}));
|
|
126
|
+
|
|
127
|
+
export default function BasePage() {
|
|
128
|
+
const theme = useUserStore((state) => state.themeMode);
|
|
129
|
+
const setTheme = useUserStore((state) => state.setThemeMode);
|
|
130
|
+
const { styles, cx } = useStyles();
|
|
131
|
+
|
|
132
|
+
const features = [
|
|
133
|
+
{
|
|
134
|
+
icon: <ThunderboltOutlined className={styles.heroIcon} />,
|
|
135
|
+
title: "Rspack 构建",
|
|
136
|
+
description: "基于 Rspack 的极速构建体验,开发效率翻倍",
|
|
17
137
|
},
|
|
18
|
-
|
|
19
|
-
|
|
138
|
+
{
|
|
139
|
+
icon: <BulbOutlined className={styles.heroIcon} />,
|
|
140
|
+
title: "React 19",
|
|
141
|
+
description: "使用最新的 React 19 特性,享受并发渲染",
|
|
20
142
|
},
|
|
21
|
-
|
|
22
|
-
}
|
|
143
|
+
{
|
|
144
|
+
icon: <SettingOutlined className={styles.heroIcon} />,
|
|
145
|
+
title: "TypeScript",
|
|
146
|
+
description: "完整的 TypeScript 支持,类型安全有保障",
|
|
147
|
+
},
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
const quickLinks = [
|
|
151
|
+
{ label: "📖 文档", description: "查看完整文档" },
|
|
152
|
+
{ label: "🎨 组件库", description: "Ant Design 组件" },
|
|
153
|
+
{ label: "🔧 配置", description: "项目配置说明" },
|
|
154
|
+
{ label: "🚀 部署", description: "部署指南" },
|
|
155
|
+
];
|
|
23
156
|
|
|
24
|
-
export default function Base() {
|
|
25
|
-
const { styles } = useStyles();
|
|
26
157
|
return (
|
|
27
|
-
<div className={styles.
|
|
28
|
-
|
|
29
|
-
|
|
158
|
+
<div className={cx(styles.root)}>
|
|
159
|
+
<div className={styles.container}>
|
|
160
|
+
<Flex vertical gap={12}>
|
|
161
|
+
<section className={styles.hero}>
|
|
162
|
+
<div>
|
|
163
|
+
<RocketOutlined className={styles.heroIcon} />
|
|
164
|
+
</div>
|
|
165
|
+
<Title level={1} style={{ marginBottom: 16 }}>
|
|
166
|
+
🎉 恭喜!项目创建成功
|
|
167
|
+
</Title>
|
|
168
|
+
<Paragraph>
|
|
169
|
+
你的项目已经准备就绪,现在可以开始开发了
|
|
170
|
+
</Paragraph>
|
|
171
|
+
<Space size="middle" className={styles.tagSpace}>
|
|
172
|
+
<Tag color="blue">React 19</Tag>
|
|
173
|
+
<Tag color="green">TypeScript</Tag>
|
|
174
|
+
<Tag color="orange">Rspack</Tag>
|
|
175
|
+
<Tag color="purple">Ant Design</Tag>
|
|
176
|
+
<Tag color="cyan">Tailwind CSS</Tag>
|
|
177
|
+
</Space>
|
|
178
|
+
</section>
|
|
179
|
+
|
|
180
|
+
<div className={styles.featuresGrid}>
|
|
181
|
+
{features.map((feature, index) => (
|
|
182
|
+
<Card
|
|
183
|
+
key={index}
|
|
184
|
+
hoverable
|
|
185
|
+
className={cx(styles.featureCard)}
|
|
186
|
+
bodyStyle={{ padding: 24 }}
|
|
187
|
+
>
|
|
188
|
+
<div className={styles.featureIcon}>{feature.icon}</div>
|
|
189
|
+
<Title level={4}>{feature.title}</Title>
|
|
190
|
+
<Paragraph type="secondary">{feature.description}</Paragraph>
|
|
191
|
+
</Card>
|
|
192
|
+
))}
|
|
193
|
+
</div>
|
|
194
|
+
|
|
195
|
+
<Card
|
|
196
|
+
title={
|
|
197
|
+
<span className={styles.cardTitle}>
|
|
198
|
+
<BookOutlined />
|
|
199
|
+
快速开始
|
|
200
|
+
</span>
|
|
201
|
+
}
|
|
202
|
+
className={styles.panelCard}
|
|
203
|
+
>
|
|
204
|
+
<Space direction="vertical" size="large">
|
|
205
|
+
<div>
|
|
206
|
+
<Text strong className={styles.stepLabel}>
|
|
207
|
+
1. 安装依赖
|
|
208
|
+
</Text>
|
|
209
|
+
<div className={styles.codeBlock}>
|
|
210
|
+
<code>pnpm install</code>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
<div>
|
|
214
|
+
<Text strong className={styles.stepLabel}>
|
|
215
|
+
2. 启动开发服务器
|
|
216
|
+
</Text>
|
|
217
|
+
<div className={styles.codeBlock}>
|
|
218
|
+
<code>pnpm dev</code>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
<div>
|
|
222
|
+
<Text strong className={styles.stepLabel}>
|
|
223
|
+
3. 构建生产版本
|
|
224
|
+
</Text>
|
|
225
|
+
<div className={styles.codeBlock}>
|
|
226
|
+
<code>pnpm build</code>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
</Space>
|
|
230
|
+
</Card>
|
|
231
|
+
|
|
232
|
+
<Card
|
|
233
|
+
title={
|
|
234
|
+
<span className={styles.cardTitle}>
|
|
235
|
+
<GithubOutlined />
|
|
236
|
+
快捷链接
|
|
237
|
+
</span>
|
|
238
|
+
}
|
|
239
|
+
className={styles.panelCard}
|
|
240
|
+
>
|
|
241
|
+
<div className={styles.quickLinkGrid}>
|
|
242
|
+
{quickLinks.map((link, index) => (
|
|
243
|
+
<div key={index} className={styles.quickLink}>
|
|
244
|
+
<div className={styles.quickLinkLabel}>{link.label}</div>
|
|
245
|
+
<Text className={styles.quickLinkDescription}>
|
|
246
|
+
{link.description}
|
|
247
|
+
</Text>
|
|
248
|
+
</div>
|
|
249
|
+
))}
|
|
250
|
+
</div>
|
|
251
|
+
</Card>
|
|
252
|
+
|
|
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>
|
|
282
|
+
</Card>
|
|
283
|
+
</Flex>
|
|
284
|
+
</div>
|
|
30
285
|
</div>
|
|
31
286
|
);
|
|
32
287
|
}
|
|
@@ -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
|
+
*/
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
// typings.d.ts
|
|
2
|
-
declare module
|
|
3
|
-
declare module
|
|
4
|
-
declare module
|
|
5
|
-
declare module
|
|
6
|
-
declare module
|
|
7
|
-
declare module
|
|
8
|
-
declare module
|
|
2
|
+
declare module "*.css";
|
|
3
|
+
declare module "*.less";
|
|
4
|
+
declare module "*.png";
|
|
5
|
+
declare module "*.jpeg";
|
|
6
|
+
declare module "*.jpg";
|
|
7
|
+
declare module "*.scss";
|
|
8
|
+
declare module "*.woff";
|
|
9
|
+
declare module "*.woff2";
|
|
10
|
+
declare module "*.ttf";
|
|
11
|
+
declare module "*.eot";
|
|
12
|
+
declare module "*.otf";
|
|
13
|
+
declare module "*.svg" {
|
|
9
14
|
export function ReactComponent(
|
|
10
|
-
props: React.SVGProps<SVGSVGElement
|
|
15
|
+
props: React.SVGProps<SVGSVGElement>
|
|
11
16
|
): React.ReactElement;
|
|
12
17
|
const url: string;
|
|
13
18
|
export default url;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { message as antdMessage } from "antd";
|
|
2
|
+
import type { AxiosError } from "axios";
|
|
3
|
+
import type { RequestConfig, ApiResponse } from "./types";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 错误处理器
|
|
7
|
+
*/
|
|
8
|
+
export class ErrorHandler {
|
|
9
|
+
/**
|
|
10
|
+
* 处理请求错误
|
|
11
|
+
*/
|
|
12
|
+
handle(error: any, config?: RequestConfig): void {
|
|
13
|
+
const messageConfig = config?.message;
|
|
14
|
+
|
|
15
|
+
// 如果明确禁用错误提示
|
|
16
|
+
if (messageConfig?.showError === false) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const axiosError = error as AxiosError<ApiResponse>;
|
|
21
|
+
let errorMessage = messageConfig?.errorMessage;
|
|
22
|
+
|
|
23
|
+
// 如果没有自定义错误消息,使用默认逻辑
|
|
24
|
+
if (!errorMessage) {
|
|
25
|
+
if (axiosError.response) {
|
|
26
|
+
const { status, data } = axiosError.response;
|
|
27
|
+
|
|
28
|
+
// 优先使用后端返回的消息
|
|
29
|
+
errorMessage = data?.message;
|
|
30
|
+
|
|
31
|
+
// 如果后端没有返回消息,使用默认消息
|
|
32
|
+
if (!errorMessage) {
|
|
33
|
+
errorMessage = this.getDefaultErrorMessage(status);
|
|
34
|
+
}
|
|
35
|
+
} else if (axiosError.request) {
|
|
36
|
+
errorMessage = "网络错误,请检查您的网络连接";
|
|
37
|
+
} else {
|
|
38
|
+
errorMessage = axiosError.message || "请求失败";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 显示错误提示
|
|
43
|
+
antdMessage.error(errorMessage);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 获取默认错误消息
|
|
48
|
+
*/
|
|
49
|
+
private getDefaultErrorMessage(status: number): string {
|
|
50
|
+
const errorMessages: Record<number, string> = {
|
|
51
|
+
400: "请求参数错误",
|
|
52
|
+
401: "未授权,请重新登录",
|
|
53
|
+
403: "拒绝访问",
|
|
54
|
+
404: "请求的资源不存在",
|
|
55
|
+
405: "请求方法不允许",
|
|
56
|
+
408: "请求超时",
|
|
57
|
+
500: "服务器内部错误",
|
|
58
|
+
502: "网关错误",
|
|
59
|
+
503: "服务暂时不可用",
|
|
60
|
+
504: "网关超时",
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return errorMessages[status] || `请求失败 (${status})`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const errorHandler = new ErrorHandler();
|