@4399ywkf/cli 1.0.7 → 1.0.8
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/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 +14 -18
- package/dist/templates/MainContentWrap.tsx +11 -15
- package/dist/templates/ThemeContext.tsx +27 -24
- 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/locales/zh-CN/common.json +3 -0
- package/dist/templates/app/package.json.tpl +1 -10
- 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/src/bootstrap/index.ts +34 -0
- package/dist/templates/app/src/config/env.ts +84 -0
- package/dist/templates/app/src/index.tsx +17 -51
- 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/micro/garfish.ts +53 -0
- package/dist/templates/app/src/pages/base/index.tsx +189 -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/base/index.tsx +189 -25
- package/dist/templates/bootstrap/index.ts +34 -0
- package/dist/templates/common.json +3 -0
- package/dist/templates/common.ts +3 -1
- 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/createDevtools.ts +7 -7
- package/dist/templates/default/common.ts +3 -1
- 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/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/global.d.ts +19 -0
- package/dist/templates/index.tsx +189 -25
- package/dist/templates/interceptors.ts +118 -0
- package/dist/templates/jwt/index.ts +4 -4
- 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/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 +1 -10
- package/dist/templates/page.tsx +21 -19
- package/dist/templates/pages/base/index.tsx +189 -25
- 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/src/bootstrap/index.ts +34 -0
- package/dist/templates/src/config/env.ts +84 -0
- package/dist/templates/src/index.tsx +17 -51
- 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/micro/garfish.ts +53 -0
- package/dist/templates/src/pages/base/index.tsx +189 -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/types/global.d.ts +19 -0
- package/dist/templates/utils/index.ts +3 -1
- package/dist/templates/zh-CN/common.json +3 -0
- package/package.json +1 -1
- 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,196 @@
|
|
|
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, Link } = Typography;
|
|
15
|
+
|
|
16
|
+
const useStyles = createStyles(({ css, token }) => ({
|
|
17
|
+
app: css`
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
overflow: auto;
|
|
21
|
+
`,
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export default function BasePage() {
|
|
25
|
+
const theme = useUserStore((state) => state.themeMode);
|
|
26
|
+
const setTheme = useUserStore((state) => state.setThemeMode);
|
|
27
|
+
const { styles, cx } = useStyles();
|
|
28
|
+
|
|
29
|
+
const features = [
|
|
30
|
+
{
|
|
31
|
+
icon: <ThunderboltOutlined className="text-4xl text-blue-500" />,
|
|
32
|
+
title: "Rspack 构建",
|
|
33
|
+
description: "基于 Rspack 的极速构建体验,开发效率翻倍",
|
|
17
34
|
},
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
{
|
|
36
|
+
icon: <BulbOutlined className="text-4xl text-yellow-500" />,
|
|
37
|
+
title: "React 19",
|
|
38
|
+
description: "使用最新的 React 19 特性,享受并发渲染",
|
|
20
39
|
},
|
|
21
|
-
|
|
22
|
-
|
|
40
|
+
{
|
|
41
|
+
icon: <SettingOutlined className="text-4xl text-green-500" />,
|
|
42
|
+
title: "TypeScript",
|
|
43
|
+
description: "完整的 TypeScript 支持,类型安全有保障",
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const quickLinks = [
|
|
48
|
+
{ label: "📖 文档", description: "查看完整文档" },
|
|
49
|
+
{ label: "🎨 组件库", description: "Ant Design 组件" },
|
|
50
|
+
{ label: "🔧 配置", description: "项目配置说明" },
|
|
51
|
+
{ label: "🚀 部署", description: "部署指南" },
|
|
52
|
+
];
|
|
23
53
|
|
|
24
|
-
export default function Base() {
|
|
25
|
-
const { styles } = useStyles();
|
|
26
54
|
return (
|
|
27
|
-
<div
|
|
28
|
-
|
|
29
|
-
|
|
55
|
+
<div
|
|
56
|
+
className={cx(
|
|
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">
|
|
62
|
+
<Flex vertical gap={12}>
|
|
63
|
+
{/* 头部欢迎区域 */}
|
|
64
|
+
<div className="text-center mb-12 animate-fade-in">
|
|
65
|
+
<div className="inline-block mb-4">
|
|
66
|
+
<RocketOutlined className="text-6xl text-blue-500 animate-bounce" />
|
|
67
|
+
</div>
|
|
68
|
+
<Title level={1} className="!mb-4">
|
|
69
|
+
🎉 恭喜!项目创建成功
|
|
70
|
+
</Title>
|
|
71
|
+
<Paragraph className="text-lg text-gray-600 dark:text-gray-300">
|
|
72
|
+
你的项目已经准备就绪,现在可以开始开发了
|
|
73
|
+
</Paragraph>
|
|
74
|
+
<Space size="middle" className="mt-4">
|
|
75
|
+
<Tag color="blue">React 19</Tag>
|
|
76
|
+
<Tag color="green">TypeScript</Tag>
|
|
77
|
+
<Tag color="orange">Rspack</Tag>
|
|
78
|
+
<Tag color="purple">Ant Design</Tag>
|
|
79
|
+
<Tag color="cyan">Tailwind CSS</Tag>
|
|
80
|
+
</Space>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
{/* 特性卡片 */}
|
|
84
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
|
|
85
|
+
{features.map((feature, index) => (
|
|
86
|
+
<Card
|
|
87
|
+
key={index}
|
|
88
|
+
hoverable
|
|
89
|
+
className="text-center transition-all duration-300 hover:shadow-xl dark:bg-gray-800"
|
|
90
|
+
>
|
|
91
|
+
<div className="mb-4">{feature.icon}</div>
|
|
92
|
+
<Title level={4}>{feature.title}</Title>
|
|
93
|
+
<Paragraph className="text-gray-600 dark:text-gray-400">
|
|
94
|
+
{feature.description}
|
|
95
|
+
</Paragraph>
|
|
96
|
+
</Card>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
{/* 快速开始 */}
|
|
101
|
+
<Card
|
|
102
|
+
title={
|
|
103
|
+
<span className="text-xl">
|
|
104
|
+
<BookOutlined className="mr-2" />
|
|
105
|
+
快速开始
|
|
106
|
+
</span>
|
|
107
|
+
}
|
|
108
|
+
className="mb-8 dark:bg-gray-800"
|
|
109
|
+
>
|
|
110
|
+
<Space direction="vertical" size="large" className="w-full">
|
|
111
|
+
<div>
|
|
112
|
+
<Text strong className="text-base">
|
|
113
|
+
1. 安装依赖
|
|
114
|
+
</Text>
|
|
115
|
+
<div className="mt-2 p-4 bg-gray-100 dark:bg-gray-900 rounded-lg font-mono text-sm">
|
|
116
|
+
<code>pnpm install</code>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
<div>
|
|
120
|
+
<Text strong className="text-base">
|
|
121
|
+
2. 启动开发服务器
|
|
122
|
+
</Text>
|
|
123
|
+
<div className="mt-2 p-4 bg-gray-100 dark:bg-gray-900 rounded-lg font-mono text-sm">
|
|
124
|
+
<code>pnpm dev</code>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<div>
|
|
128
|
+
<Text strong className="text-base">
|
|
129
|
+
3. 构建生产版本
|
|
130
|
+
</Text>
|
|
131
|
+
<div className="mt-2 p-4 bg-gray-100 dark:bg-gray-900 rounded-lg font-mono text-sm">
|
|
132
|
+
<code>pnpm build</code>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</Space>
|
|
136
|
+
</Card>
|
|
137
|
+
|
|
138
|
+
{/* 快捷链接 */}
|
|
139
|
+
<Card
|
|
140
|
+
title={
|
|
141
|
+
<span className="text-xl">
|
|
142
|
+
<GithubOutlined className="mr-2" />
|
|
143
|
+
快捷链接
|
|
144
|
+
</span>
|
|
145
|
+
}
|
|
146
|
+
className="mb-8 dark:bg-gray-800"
|
|
147
|
+
>
|
|
148
|
+
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
|
|
149
|
+
{quickLinks.map((link, index) => (
|
|
150
|
+
<div
|
|
151
|
+
key={index}
|
|
152
|
+
className="p-4 bg-gray-50 dark:bg-gray-900 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors"
|
|
153
|
+
>
|
|
154
|
+
<div className="text-2xl mb-2">{link.label}</div>
|
|
155
|
+
<Text className="text-sm text-gray-600 dark:text-gray-400">
|
|
156
|
+
{link.description}
|
|
157
|
+
</Text>
|
|
158
|
+
</div>
|
|
159
|
+
))}
|
|
160
|
+
</div>
|
|
161
|
+
</Card>
|
|
162
|
+
|
|
163
|
+
{/* 底部操作区 */}
|
|
164
|
+
<Card className="text-center dark:bg-gray-800">
|
|
165
|
+
<Space size="large" wrap>
|
|
166
|
+
<Button
|
|
167
|
+
type="primary"
|
|
168
|
+
size="large"
|
|
169
|
+
icon={<RocketOutlined />}
|
|
170
|
+
onClick={() => window.open("https://ant.design", "_blank")}
|
|
171
|
+
>
|
|
172
|
+
查看 Ant Design 文档
|
|
173
|
+
</Button>
|
|
174
|
+
<Button
|
|
175
|
+
size="large"
|
|
176
|
+
icon={<BookOutlined />}
|
|
177
|
+
onClick={() => window.open("https://react.dev", "_blank")}
|
|
178
|
+
>
|
|
179
|
+
React 文档
|
|
180
|
+
</Button>
|
|
181
|
+
<Button
|
|
182
|
+
size="large"
|
|
183
|
+
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
|
|
184
|
+
>
|
|
185
|
+
切换主题 ({theme === "dark" ? "🌙 暗色" : "☀️ 亮色"})
|
|
186
|
+
</Button>
|
|
187
|
+
</Space>
|
|
188
|
+
<Paragraph className="mt-6 text-gray-500 dark:text-gray-400">
|
|
189
|
+
祝你开发愉快!如有问题,请查阅文档或联系技术支持 💪
|
|
190
|
+
</Paragraph>
|
|
191
|
+
</Card>
|
|
192
|
+
</Flex>
|
|
193
|
+
</div>
|
|
30
194
|
</div>
|
|
31
195
|
);
|
|
32
196
|
}
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import React, { lazy } from "react";
|
|
2
2
|
import { createBrowserRouter, Navigate } from "react-router";
|
|
3
|
+
import MainContentWrap from "@/layout/MainContentWrap";
|
|
3
4
|
|
|
4
5
|
export const createRouter = (basename?: string) => {
|
|
5
|
-
return createBrowserRouter(
|
|
6
|
+
return createBrowserRouter(
|
|
7
|
+
[
|
|
8
|
+
{
|
|
9
|
+
path: "",
|
|
10
|
+
element: <MainContentWrap />,
|
|
11
|
+
children: [
|
|
12
|
+
{
|
|
13
|
+
path: "/",
|
|
14
|
+
element: <Navigate to="/base" replace />,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
path: "/base",
|
|
18
|
+
Component: lazy(() => import("@/pages/base")),
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
6
23
|
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
path: "/base",
|
|
12
|
-
Component: lazy(() => import("@/pages/base")),
|
|
13
|
-
},
|
|
14
|
-
], {
|
|
15
|
-
basename: basename || "/",
|
|
16
|
-
});
|
|
24
|
+
basename: basename || "/",
|
|
25
|
+
}
|
|
26
|
+
);
|
|
17
27
|
};
|
|
18
|
-
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Env } from "@/config/env";
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
__GARFISH__?: boolean;
|
|
6
|
+
Garfish?: {
|
|
7
|
+
channel: {
|
|
8
|
+
emit: (event: string, data: any) => void;
|
|
9
|
+
on: (event: string, handler: (data: any) => void) => void;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
namespace NodeJS {
|
|
15
|
+
interface ProcessEnv extends Env {}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { optionalDevtools } from
|
|
2
|
-
import type { devtools as _devtools } from
|
|
1
|
+
import { optionalDevtools } from "zustand-utils";
|
|
2
|
+
import type { devtools as _devtools } from "zustand/middleware";
|
|
3
3
|
|
|
4
|
-
import { isDev } from
|
|
4
|
+
import { isDev } from "@/config/env";
|
|
5
5
|
|
|
6
6
|
export const createDevtools =
|
|
7
7
|
(name: string): typeof _devtools =>
|
|
8
|
-
initializer => {
|
|
8
|
+
(initializer) => {
|
|
9
9
|
let showDevtools = false;
|
|
10
10
|
|
|
11
11
|
// check url to show devtools
|
|
12
|
-
if (typeof window !==
|
|
12
|
+
if (typeof window !== "undefined") {
|
|
13
13
|
const url = new URL(window.location.href);
|
|
14
|
-
const debug = url.searchParams.get(
|
|
14
|
+
const debug = url.searchParams.get("debug");
|
|
15
15
|
if (debug?.includes(name)) {
|
|
16
16
|
showDevtools = true;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
return optionalDevtools(showDevtools)(initializer, {
|
|
21
|
-
name: `LobeChat_${name}${isDev ?
|
|
21
|
+
name: `LobeChat_${name}${isDev ? "_DEV" : ""}`,
|
|
22
22
|
});
|
|
23
23
|
};
|
|
@@ -1,32 +1,196 @@
|
|
|
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, Link } = Typography;
|
|
15
|
+
|
|
16
|
+
const useStyles = createStyles(({ css, token }) => ({
|
|
17
|
+
app: css`
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
overflow: auto;
|
|
21
|
+
`,
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export default function BasePage() {
|
|
25
|
+
const theme = useUserStore((state) => state.themeMode);
|
|
26
|
+
const setTheme = useUserStore((state) => state.setThemeMode);
|
|
27
|
+
const { styles, cx } = useStyles();
|
|
28
|
+
|
|
29
|
+
const features = [
|
|
30
|
+
{
|
|
31
|
+
icon: <ThunderboltOutlined className="text-4xl text-blue-500" />,
|
|
32
|
+
title: "Rspack 构建",
|
|
33
|
+
description: "基于 Rspack 的极速构建体验,开发效率翻倍",
|
|
17
34
|
},
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
{
|
|
36
|
+
icon: <BulbOutlined className="text-4xl text-yellow-500" />,
|
|
37
|
+
title: "React 19",
|
|
38
|
+
description: "使用最新的 React 19 特性,享受并发渲染",
|
|
20
39
|
},
|
|
21
|
-
|
|
22
|
-
|
|
40
|
+
{
|
|
41
|
+
icon: <SettingOutlined className="text-4xl text-green-500" />,
|
|
42
|
+
title: "TypeScript",
|
|
43
|
+
description: "完整的 TypeScript 支持,类型安全有保障",
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const quickLinks = [
|
|
48
|
+
{ label: "📖 文档", description: "查看完整文档" },
|
|
49
|
+
{ label: "🎨 组件库", description: "Ant Design 组件" },
|
|
50
|
+
{ label: "🔧 配置", description: "项目配置说明" },
|
|
51
|
+
{ label: "🚀 部署", description: "部署指南" },
|
|
52
|
+
];
|
|
23
53
|
|
|
24
|
-
export default function Base() {
|
|
25
|
-
const { styles } = useStyles();
|
|
26
54
|
return (
|
|
27
|
-
<div
|
|
28
|
-
|
|
29
|
-
|
|
55
|
+
<div
|
|
56
|
+
className={cx(
|
|
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">
|
|
62
|
+
<Flex vertical gap={12}>
|
|
63
|
+
{/* 头部欢迎区域 */}
|
|
64
|
+
<div className="text-center mb-12 animate-fade-in">
|
|
65
|
+
<div className="inline-block mb-4">
|
|
66
|
+
<RocketOutlined className="text-6xl text-blue-500 animate-bounce" />
|
|
67
|
+
</div>
|
|
68
|
+
<Title level={1} className="!mb-4">
|
|
69
|
+
🎉 恭喜!项目创建成功
|
|
70
|
+
</Title>
|
|
71
|
+
<Paragraph className="text-lg text-gray-600 dark:text-gray-300">
|
|
72
|
+
你的项目已经准备就绪,现在可以开始开发了
|
|
73
|
+
</Paragraph>
|
|
74
|
+
<Space size="middle" className="mt-4">
|
|
75
|
+
<Tag color="blue">React 19</Tag>
|
|
76
|
+
<Tag color="green">TypeScript</Tag>
|
|
77
|
+
<Tag color="orange">Rspack</Tag>
|
|
78
|
+
<Tag color="purple">Ant Design</Tag>
|
|
79
|
+
<Tag color="cyan">Tailwind CSS</Tag>
|
|
80
|
+
</Space>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
{/* 特性卡片 */}
|
|
84
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
|
|
85
|
+
{features.map((feature, index) => (
|
|
86
|
+
<Card
|
|
87
|
+
key={index}
|
|
88
|
+
hoverable
|
|
89
|
+
className="text-center transition-all duration-300 hover:shadow-xl dark:bg-gray-800"
|
|
90
|
+
>
|
|
91
|
+
<div className="mb-4">{feature.icon}</div>
|
|
92
|
+
<Title level={4}>{feature.title}</Title>
|
|
93
|
+
<Paragraph className="text-gray-600 dark:text-gray-400">
|
|
94
|
+
{feature.description}
|
|
95
|
+
</Paragraph>
|
|
96
|
+
</Card>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
{/* 快速开始 */}
|
|
101
|
+
<Card
|
|
102
|
+
title={
|
|
103
|
+
<span className="text-xl">
|
|
104
|
+
<BookOutlined className="mr-2" />
|
|
105
|
+
快速开始
|
|
106
|
+
</span>
|
|
107
|
+
}
|
|
108
|
+
className="mb-8 dark:bg-gray-800"
|
|
109
|
+
>
|
|
110
|
+
<Space direction="vertical" size="large" className="w-full">
|
|
111
|
+
<div>
|
|
112
|
+
<Text strong className="text-base">
|
|
113
|
+
1. 安装依赖
|
|
114
|
+
</Text>
|
|
115
|
+
<div className="mt-2 p-4 bg-gray-100 dark:bg-gray-900 rounded-lg font-mono text-sm">
|
|
116
|
+
<code>pnpm install</code>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
<div>
|
|
120
|
+
<Text strong className="text-base">
|
|
121
|
+
2. 启动开发服务器
|
|
122
|
+
</Text>
|
|
123
|
+
<div className="mt-2 p-4 bg-gray-100 dark:bg-gray-900 rounded-lg font-mono text-sm">
|
|
124
|
+
<code>pnpm dev</code>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<div>
|
|
128
|
+
<Text strong className="text-base">
|
|
129
|
+
3. 构建生产版本
|
|
130
|
+
</Text>
|
|
131
|
+
<div className="mt-2 p-4 bg-gray-100 dark:bg-gray-900 rounded-lg font-mono text-sm">
|
|
132
|
+
<code>pnpm build</code>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</Space>
|
|
136
|
+
</Card>
|
|
137
|
+
|
|
138
|
+
{/* 快捷链接 */}
|
|
139
|
+
<Card
|
|
140
|
+
title={
|
|
141
|
+
<span className="text-xl">
|
|
142
|
+
<GithubOutlined className="mr-2" />
|
|
143
|
+
快捷链接
|
|
144
|
+
</span>
|
|
145
|
+
}
|
|
146
|
+
className="mb-8 dark:bg-gray-800"
|
|
147
|
+
>
|
|
148
|
+
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
|
|
149
|
+
{quickLinks.map((link, index) => (
|
|
150
|
+
<div
|
|
151
|
+
key={index}
|
|
152
|
+
className="p-4 bg-gray-50 dark:bg-gray-900 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors"
|
|
153
|
+
>
|
|
154
|
+
<div className="text-2xl mb-2">{link.label}</div>
|
|
155
|
+
<Text className="text-sm text-gray-600 dark:text-gray-400">
|
|
156
|
+
{link.description}
|
|
157
|
+
</Text>
|
|
158
|
+
</div>
|
|
159
|
+
))}
|
|
160
|
+
</div>
|
|
161
|
+
</Card>
|
|
162
|
+
|
|
163
|
+
{/* 底部操作区 */}
|
|
164
|
+
<Card className="text-center dark:bg-gray-800">
|
|
165
|
+
<Space size="large" wrap>
|
|
166
|
+
<Button
|
|
167
|
+
type="primary"
|
|
168
|
+
size="large"
|
|
169
|
+
icon={<RocketOutlined />}
|
|
170
|
+
onClick={() => window.open("https://ant.design", "_blank")}
|
|
171
|
+
>
|
|
172
|
+
查看 Ant Design 文档
|
|
173
|
+
</Button>
|
|
174
|
+
<Button
|
|
175
|
+
size="large"
|
|
176
|
+
icon={<BookOutlined />}
|
|
177
|
+
onClick={() => window.open("https://react.dev", "_blank")}
|
|
178
|
+
>
|
|
179
|
+
React 文档
|
|
180
|
+
</Button>
|
|
181
|
+
<Button
|
|
182
|
+
size="large"
|
|
183
|
+
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
|
|
184
|
+
>
|
|
185
|
+
切换主题 ({theme === "dark" ? "🌙 暗色" : "☀️ 亮色"})
|
|
186
|
+
</Button>
|
|
187
|
+
</Space>
|
|
188
|
+
<Paragraph className="mt-6 text-gray-500 dark:text-gray-400">
|
|
189
|
+
祝你开发愉快!如有问题,请查阅文档或联系技术支持 💪
|
|
190
|
+
</Paragraph>
|
|
191
|
+
</Card>
|
|
192
|
+
</Flex>
|
|
193
|
+
</div>
|
|
30
194
|
</div>
|
|
31
195
|
);
|
|
32
196
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "dayjs/locale/zh-cn";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import { ConfigProvider } from "antd";
|
|
4
|
+
import { env } from "@/config/env";
|
|
5
|
+
|
|
6
|
+
interface BootstrapConfig {
|
|
7
|
+
appName: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 应用启动前的初始化配置
|
|
12
|
+
*/
|
|
13
|
+
export function bootstrap(config: BootstrapConfig) {
|
|
14
|
+
const { appName } = config;
|
|
15
|
+
|
|
16
|
+
// 配置 dayjs 国际化
|
|
17
|
+
dayjs.locale("zh-cn");
|
|
18
|
+
|
|
19
|
+
// 配置 antd 静态方法的前缀
|
|
20
|
+
ConfigProvider.config({
|
|
21
|
+
prefixCls: appName,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
console.log(`✅ Application [${appName}] bootstrapped successfully`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 使用环境变量初始化应用
|
|
29
|
+
*/
|
|
30
|
+
export function bootstrapWithEnv() {
|
|
31
|
+
bootstrap({
|
|
32
|
+
appName: env.APP_NAME,
|
|
33
|
+
});
|
|
34
|
+
}
|
package/dist/templates/common.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
API_PREFIX="/api"
|
|
2
|
-
API_TIMEOUT=
|
|
2
|
+
API_TIMEOUT=60000
|
|
3
3
|
|
|
4
4
|
COOKIE_NAME='ywkf_jwt'
|
|
5
5
|
|
|
@@ -9,23 +9,6 @@ OUTPUT_PATH='dist'
|
|
|
9
9
|
BASENAME='/'
|
|
10
10
|
|
|
11
11
|
PUBLIC_PATH='/s{{{ name }}}/'
|
|
12
|
-
VERSION_NOTIFY_TIME=30000
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# Sentry 配置 - (官网)
|
|
16
|
-
# REACT_APP_SENTRY_DSN="https://95add4dc797c22aa2224494e4abd4d71@o4509466151878656.ingest.us.sentry.io/4509466153058304"
|
|
17
|
-
# SENTRY_PROJECT="javascript-react"
|
|
18
|
-
# SENTRY_ORG="test-x6m"
|
|
19
|
-
# SENTRY_AUTH_TOKEN="d477b94cfe375f5b4e4e88ac4fc15a8be8557652cea424710b6f7f19be4f0b3d"
|
|
20
|
-
# SENTRY_URL="https://test-x6m.sentry.io/"
|
|
21
12
|
|
|
22
13
|
# 帮助中心
|
|
23
|
-
HELP_CENTER_URL="https://im-support.gz4399.com/"
|
|
24
|
-
|
|
25
|
-
# 是否开启Sentry
|
|
26
|
-
SENTRY_ENABLED='{{SENTRY_ENABLED}}'
|
|
27
|
-
REACT_APP_SENTRY_DSN='{{SENTRY_DSN}}'
|
|
28
|
-
SENTRY_PROJECT='{{{ name }}}'
|
|
29
|
-
SENTRY_ORG="sentry"
|
|
30
|
-
SENTRY_AUTH_TOKEN="f13c66cd7a3629c8324cceb62fdb65aae1f337abbec4ebbadbe0a22447708994"
|
|
31
|
-
SENTRY_URL="https://sentry.gz4399.com/"
|
|
14
|
+
HELP_CENTER_URL="https://im-support.gz4399.com/"
|