@coze-arch/cli 0.0.1-alpha.f74941 → 0.0.1-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +1 -1
- package/lib/__templates__/expo/app.json +1 -1
- package/lib/__templates__/expo/client/index.js +2 -1
- package/lib/__templates__/expo/client/scripts/install-missing-deps.js +36 -12
- package/lib/__templates__/expo/metro.config.js +15 -15
- package/lib/__templates__/expo/package.json +14 -5
- package/lib/__templates__/expo/pnpm-lock.yaml +335 -4
- package/lib/__templates__/nextjs/.babelrc +15 -0
- package/lib/__templates__/nextjs/README.md +341 -19
- package/lib/__templates__/nextjs/components.json +21 -0
- package/lib/__templates__/nextjs/package.json +48 -1
- package/lib/__templates__/nextjs/pnpm-lock.yaml +6399 -1356
- package/lib/__templates__/nextjs/scripts/dev.sh +2 -1
- package/lib/__templates__/nextjs/server.mjs +50 -0
- package/lib/__templates__/nextjs/src/app/globals.css +99 -8
- package/lib/__templates__/nextjs/src/app/layout.tsx +4 -0
- package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
- package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
- package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
- package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
- package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
- package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
- package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
- package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
- package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
- package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
- package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
- package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
- package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
- package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
- package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
- package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
- package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
- package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
- package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
- package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
- package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
- package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
- package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
- package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
- package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
- package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
- package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
- package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
- package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
- package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
- package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
- package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +56 -0
- package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
- package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
- package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
- package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +726 -0
- package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
- package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
- package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
- package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
- package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
- package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
- package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
- package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
- package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
- package/lib/__templates__/nextjs/template.config.js +1 -1
- package/lib/__templates__/templates.json +0 -38
- package/lib/__templates__/vite/template.config.js +1 -1
- package/lib/cli.js +19 -2
- package/package.json +2 -2
- package/lib/__templates__/react-rsbuild/.coze +0 -11
- package/lib/__templates__/react-rsbuild/.vscode/settings.json +0 -121
- package/lib/__templates__/react-rsbuild/README.md +0 -61
- package/lib/__templates__/react-rsbuild/_gitignore +0 -97
- package/lib/__templates__/react-rsbuild/_npmrc +0 -22
- package/lib/__templates__/react-rsbuild/package.json +0 -31
- package/lib/__templates__/react-rsbuild/pnpm-lock.yaml +0 -997
- package/lib/__templates__/react-rsbuild/rsbuild.config.ts +0 -13
- package/lib/__templates__/react-rsbuild/scripts/build.sh +0 -14
- package/lib/__templates__/react-rsbuild/scripts/dev.sh +0 -51
- package/lib/__templates__/react-rsbuild/scripts/start.sh +0 -15
- package/lib/__templates__/react-rsbuild/src/App.tsx +0 -60
- package/lib/__templates__/react-rsbuild/src/index.css +0 -21
- package/lib/__templates__/react-rsbuild/src/index.html +0 -12
- package/lib/__templates__/react-rsbuild/src/index.tsx +0 -16
- package/lib/__templates__/react-rsbuild/tailwind.config.js +0 -9
- package/lib/__templates__/react-rsbuild/template.config.js +0 -54
- package/lib/__templates__/react-rsbuild/tsconfig.json +0 -17
- package/lib/__templates__/rsbuild/.coze +0 -11
- package/lib/__templates__/rsbuild/.vscode/settings.json +0 -7
- package/lib/__templates__/rsbuild/README.md +0 -61
- package/lib/__templates__/rsbuild/_gitignore +0 -97
- package/lib/__templates__/rsbuild/_npmrc +0 -22
- package/lib/__templates__/rsbuild/package.json +0 -24
- package/lib/__templates__/rsbuild/pnpm-lock.yaml +0 -888
- package/lib/__templates__/rsbuild/rsbuild.config.ts +0 -12
- package/lib/__templates__/rsbuild/scripts/build.sh +0 -14
- package/lib/__templates__/rsbuild/scripts/dev.sh +0 -51
- package/lib/__templates__/rsbuild/scripts/start.sh +0 -15
- package/lib/__templates__/rsbuild/src/index.css +0 -21
- package/lib/__templates__/rsbuild/src/index.html +0 -12
- package/lib/__templates__/rsbuild/src/index.ts +0 -5
- package/lib/__templates__/rsbuild/src/main.ts +0 -65
- package/lib/__templates__/rsbuild/tailwind.config.js +0 -9
- package/lib/__templates__/rsbuild/template.config.js +0 -56
- package/lib/__templates__/rsbuild/tsconfig.json +0 -16
|
@@ -1,36 +1,358 @@
|
|
|
1
1
|
# <%= appName %>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
这是一个基于 [Next.js 16](https://nextjs.org) + [shadcn/ui](https://ui.shadcn.com) 的全栈应用项目,由扣子编程 CLI 创建。
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 快速开始
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### 启动开发服务器
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
11
|
-
# or
|
|
12
|
-
pnpm dev
|
|
13
|
-
# or
|
|
14
|
-
yarn dev
|
|
10
|
+
coze dev
|
|
15
11
|
```
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
启动后,在浏览器中打开 [http://localhost:<%= port %>](http://localhost:<%= port %>) 查看应用。
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
开发服务器支持热更新,修改代码后页面会自动刷新。
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
### 构建生产版本
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
```bash
|
|
20
|
+
coze build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 启动生产服务器
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
coze start
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 项目结构
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
src/
|
|
33
|
+
├── app/ # Next.js App Router 目录
|
|
34
|
+
│ ├── layout.tsx # 根布局组件
|
|
35
|
+
│ ├── page.tsx # 首页
|
|
36
|
+
│ ├── globals.css # 全局样式(包含 shadcn 主题变量)
|
|
37
|
+
│ └── [route]/ # 其他路由页面
|
|
38
|
+
├── components/ # React 组件目录
|
|
39
|
+
│ └── ui/ # shadcn/ui 基础组件(优先使用)
|
|
40
|
+
│ ├── button.tsx
|
|
41
|
+
│ ├── card.tsx
|
|
42
|
+
│ └── ...
|
|
43
|
+
├── lib/ # 工具函数库
|
|
44
|
+
│ └── utils.ts # cn() 等工具函数
|
|
45
|
+
└── hooks/ # 自定义 React Hooks(可选)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 核心开发规范
|
|
49
|
+
|
|
50
|
+
### 1. 组件开发
|
|
51
|
+
|
|
52
|
+
**优先使用 shadcn/ui 基础组件**
|
|
53
|
+
|
|
54
|
+
本项目已预装完整的 shadcn/ui 组件库,位于 `src/components/ui/` 目录。开发时应优先使用这些组件作为基础:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
// ✅ 推荐:使用 shadcn 基础组件
|
|
58
|
+
import { Button } from '@/components/ui/button';
|
|
59
|
+
import { Card, CardContent, CardHeader } from '@/components/ui/card';
|
|
60
|
+
import { Input } from '@/components/ui/input';
|
|
61
|
+
|
|
62
|
+
export default function MyComponent() {
|
|
63
|
+
return (
|
|
64
|
+
<Card>
|
|
65
|
+
<CardHeader>标题</CardHeader>
|
|
66
|
+
<CardContent>
|
|
67
|
+
<Input placeholder="输入内容" />
|
|
68
|
+
<Button>提交</Button>
|
|
69
|
+
</CardContent>
|
|
70
|
+
</Card>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**可用的 shadcn 组件清单**
|
|
76
|
+
|
|
77
|
+
- 表单:`button`, `input`, `textarea`, `select`, `checkbox`, `radio-group`, `switch`, `slider`
|
|
78
|
+
- 布局:`card`, `separator`, `tabs`, `accordion`, `collapsible`, `scroll-area`
|
|
79
|
+
- 反馈:`alert`, `alert-dialog`, `dialog`, `toast`, `sonner`, `progress`
|
|
80
|
+
- 导航:`dropdown-menu`, `menubar`, `navigation-menu`, `context-menu`
|
|
81
|
+
- 数据展示:`table`, `avatar`, `badge`, `hover-card`, `tooltip`, `popover`
|
|
82
|
+
- 其他:`calendar`, `command`, `carousel`, `resizable`, `sidebar`
|
|
83
|
+
|
|
84
|
+
详见 `src/components/ui/` 目录下的具体组件实现。
|
|
85
|
+
|
|
86
|
+
### 2. 路由开发
|
|
87
|
+
|
|
88
|
+
Next.js 使用文件系统路由,在 `src/app/` 目录下创建文件夹即可添加路由:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# 创建新路由 /about
|
|
92
|
+
src/app/about/page.tsx
|
|
93
|
+
|
|
94
|
+
# 创建动态路由 /posts/[id]
|
|
95
|
+
src/app/posts/[id]/page.tsx
|
|
96
|
+
|
|
97
|
+
# 创建路由组(不影响 URL)
|
|
98
|
+
src/app/(marketing)/about/page.tsx
|
|
99
|
+
|
|
100
|
+
# 创建 API 路由
|
|
101
|
+
src/app/api/users/route.ts
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**页面组件示例**
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
// src/app/about/page.tsx
|
|
108
|
+
import { Button } from '@/components/ui/button';
|
|
109
|
+
|
|
110
|
+
export const metadata = {
|
|
111
|
+
title: '关于我们',
|
|
112
|
+
description: '关于页面描述',
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export default function AboutPage() {
|
|
116
|
+
return (
|
|
117
|
+
<div>
|
|
118
|
+
<h1>关于我们</h1>
|
|
119
|
+
<Button>了解更多</Button>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**动态路由示例**
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
// src/app/posts/[id]/page.tsx
|
|
129
|
+
export default async function PostPage({
|
|
130
|
+
params,
|
|
131
|
+
}: {
|
|
132
|
+
params: Promise<{ id: string }>;
|
|
133
|
+
}) {
|
|
134
|
+
const { id } = await params;
|
|
135
|
+
|
|
136
|
+
return <div>文章 ID: {id}</div>;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**API 路由示例**
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
// src/app/api/users/route.ts
|
|
144
|
+
import { NextResponse } from 'next/server';
|
|
145
|
+
|
|
146
|
+
export async function GET() {
|
|
147
|
+
return NextResponse.json({ users: [] });
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export async function POST(request: Request) {
|
|
151
|
+
const body = await request.json();
|
|
152
|
+
return NextResponse.json({ success: true });
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 3. 依赖管理
|
|
157
|
+
|
|
158
|
+
**必须使用 pnpm 管理依赖**
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# ✅ 安装依赖
|
|
162
|
+
pnpm install
|
|
163
|
+
|
|
164
|
+
# ✅ 添加新依赖
|
|
165
|
+
pnpm add package-name
|
|
166
|
+
|
|
167
|
+
# ✅ 添加开发依赖
|
|
168
|
+
pnpm add -D package-name
|
|
169
|
+
|
|
170
|
+
# ❌ 禁止使用 npm 或 yarn
|
|
171
|
+
# npm install # 错误!
|
|
172
|
+
# yarn add # 错误!
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
项目已配置 `preinstall` 脚本,使用其他包管理器会报错。
|
|
176
|
+
|
|
177
|
+
### 4. 样式开发
|
|
178
|
+
|
|
179
|
+
**使用 Tailwind CSS v4**
|
|
180
|
+
|
|
181
|
+
本项目使用 Tailwind CSS v4 进行样式开发,并已配置 shadcn 主题变量。
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
// 使用 Tailwind 类名
|
|
185
|
+
<div className="flex items-center gap-4 p-4 rounded-lg bg-background">
|
|
186
|
+
<Button className="bg-primary text-primary-foreground">
|
|
187
|
+
主要按钮
|
|
188
|
+
</Button>
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
// 使用 cn() 工具函数合并类名
|
|
192
|
+
import { cn } from '@/lib/utils';
|
|
193
|
+
|
|
194
|
+
<div className={cn(
|
|
195
|
+
"base-class",
|
|
196
|
+
condition && "conditional-class",
|
|
197
|
+
className
|
|
198
|
+
)}>
|
|
199
|
+
内容
|
|
200
|
+
</div>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**主题变量**
|
|
204
|
+
|
|
205
|
+
主题变量定义在 `src/app/globals.css` 中,支持亮色/暗色模式:
|
|
206
|
+
|
|
207
|
+
- `--background`, `--foreground`
|
|
208
|
+
- `--primary`, `--primary-foreground`
|
|
209
|
+
- `--secondary`, `--secondary-foreground`
|
|
210
|
+
- `--muted`, `--muted-foreground`
|
|
211
|
+
- `--accent`, `--accent-foreground`
|
|
212
|
+
- `--destructive`, `--destructive-foreground`
|
|
213
|
+
- `--border`, `--input`, `--ring`
|
|
214
|
+
|
|
215
|
+
### 5. 表单开发
|
|
216
|
+
|
|
217
|
+
推荐使用 `react-hook-form` + `zod` 进行表单开发:
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import { useForm } from 'react-hook-form';
|
|
221
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
222
|
+
import * as z from 'zod';
|
|
223
|
+
import { Button } from '@/components/ui/button';
|
|
224
|
+
import { Input } from '@/components/ui/input';
|
|
225
|
+
|
|
226
|
+
const formSchema = z.object({
|
|
227
|
+
username: z.string().min(2, '用户名至少 2 个字符'),
|
|
228
|
+
email: z.string().email('请输入有效的邮箱'),
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
export default function MyForm() {
|
|
232
|
+
const form = useForm({
|
|
233
|
+
resolver: zodResolver(formSchema),
|
|
234
|
+
defaultValues: { username: '', email: '' },
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
const onSubmit = (data: z.infer<typeof formSchema>) => {
|
|
238
|
+
console.log(data);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<form onSubmit={form.handleSubmit(onSubmit)}>
|
|
243
|
+
<Input {...form.register('username')} />
|
|
244
|
+
<Input {...form.register('email')} />
|
|
245
|
+
<Button type="submit">提交</Button>
|
|
246
|
+
</form>
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### 6. 数据获取
|
|
252
|
+
|
|
253
|
+
**服务端组件(推荐)**
|
|
254
|
+
|
|
255
|
+
```tsx
|
|
256
|
+
// src/app/posts/page.tsx
|
|
257
|
+
async function getPosts() {
|
|
258
|
+
const res = await fetch('https://api.example.com/posts', {
|
|
259
|
+
cache: 'no-store', // 或 'force-cache'
|
|
260
|
+
});
|
|
261
|
+
return res.json();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export default async function PostsPage() {
|
|
265
|
+
const posts = await getPosts();
|
|
266
|
+
|
|
267
|
+
return (
|
|
268
|
+
<div>
|
|
269
|
+
{posts.map(post => (
|
|
270
|
+
<div key={post.id}>{post.title}</div>
|
|
271
|
+
))}
|
|
272
|
+
</div>
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**客户端组件**
|
|
278
|
+
|
|
279
|
+
```tsx
|
|
280
|
+
'use client';
|
|
281
|
+
|
|
282
|
+
import { useEffect, useState } from 'react';
|
|
283
|
+
|
|
284
|
+
export default function ClientComponent() {
|
|
285
|
+
const [data, setData] = useState(null);
|
|
286
|
+
|
|
287
|
+
useEffect(() => {
|
|
288
|
+
fetch('/api/data')
|
|
289
|
+
.then(res => res.json())
|
|
290
|
+
.then(setData);
|
|
291
|
+
}, []);
|
|
292
|
+
|
|
293
|
+
return <div>{JSON.stringify(data)}</div>;
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## 常见开发场景
|
|
298
|
+
|
|
299
|
+
### 添加新页面
|
|
300
|
+
|
|
301
|
+
1. 在 `src/app/` 下创建文件夹和 `page.tsx`
|
|
302
|
+
2. 使用 shadcn 组件构建 UI
|
|
303
|
+
3. 根据需要添加 `layout.tsx` 和 `loading.tsx`
|
|
304
|
+
|
|
305
|
+
### 创建业务组件
|
|
306
|
+
|
|
307
|
+
1. 在 `src/components/` 下创建组件文件(非 UI 组件)
|
|
308
|
+
2. 优先组合使用 `src/components/ui/` 中的基础组件
|
|
309
|
+
3. 使用 TypeScript 定义 Props 类型
|
|
310
|
+
|
|
311
|
+
### 添加全局状态
|
|
312
|
+
|
|
313
|
+
推荐使用 React Context 或 Zustand:
|
|
314
|
+
|
|
315
|
+
```tsx
|
|
316
|
+
// src/lib/store.ts
|
|
317
|
+
import { create } from 'zustand';
|
|
318
|
+
|
|
319
|
+
interface Store {
|
|
320
|
+
count: number;
|
|
321
|
+
increment: () => void;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export const useStore = create<Store>((set) => ({
|
|
325
|
+
count: 0,
|
|
326
|
+
increment: () => set((state) => ({ count: state.count + 1 })),
|
|
327
|
+
}));
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### 集成数据库
|
|
331
|
+
|
|
332
|
+
推荐使用 Prisma 或 Drizzle ORM,在 `src/lib/db.ts` 中配置。
|
|
24
333
|
|
|
25
|
-
|
|
334
|
+
## 技术栈
|
|
26
335
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
336
|
+
- **框架**: Next.js 16.1.1 (App Router)
|
|
337
|
+
- **UI 组件**: shadcn/ui (基于 Radix UI)
|
|
338
|
+
- **样式**: Tailwind CSS v4
|
|
339
|
+
- **表单**: React Hook Form + Zod
|
|
340
|
+
- **图标**: Lucide React
|
|
341
|
+
- **字体**: Geist Sans & Geist Mono
|
|
342
|
+
- **包管理器**: pnpm 9+
|
|
343
|
+
- **TypeScript**: 5.x
|
|
29
344
|
|
|
30
|
-
|
|
345
|
+
## 参考文档
|
|
31
346
|
|
|
32
|
-
|
|
347
|
+
- [Next.js 官方文档](https://nextjs.org/docs)
|
|
348
|
+
- [shadcn/ui 组件文档](https://ui.shadcn.com)
|
|
349
|
+
- [Tailwind CSS 文档](https://tailwindcss.com/docs)
|
|
350
|
+
- [React Hook Form](https://react-hook-form.com)
|
|
33
351
|
|
|
34
|
-
|
|
352
|
+
## 重要提示
|
|
35
353
|
|
|
36
|
-
|
|
354
|
+
1. **必须使用 pnpm** 作为包管理器
|
|
355
|
+
2. **优先使用 shadcn/ui 组件** 而不是从零开发基础组件
|
|
356
|
+
3. **遵循 Next.js App Router 规范**,正确区分服务端/客户端组件
|
|
357
|
+
4. **使用 TypeScript** 进行类型安全开发
|
|
358
|
+
5. **使用 `@/` 路径别名** 导入模块(已配置)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": true,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/app/globals.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"aliases": {
|
|
14
|
+
"components": "@/components",
|
|
15
|
+
"utils": "@/lib/utils",
|
|
16
|
+
"ui": "@/components/ui",
|
|
17
|
+
"lib": "@/lib",
|
|
18
|
+
"hooks": "@/hooks"
|
|
19
|
+
},
|
|
20
|
+
"iconLibrary": "lucide"
|
|
21
|
+
}
|
|
@@ -10,11 +10,56 @@
|
|
|
10
10
|
"start": "bash ./scripts/start.sh"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@hookform/resolvers": "^5.2.2",
|
|
14
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
15
|
+
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
16
|
+
"@radix-ui/react-aspect-ratio": "^1.1.8",
|
|
17
|
+
"@radix-ui/react-avatar": "^1.1.11",
|
|
18
|
+
"@radix-ui/react-checkbox": "^1.3.3",
|
|
19
|
+
"@radix-ui/react-collapsible": "^1.1.12",
|
|
20
|
+
"@radix-ui/react-context-menu": "^2.2.16",
|
|
21
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
22
|
+
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
23
|
+
"@radix-ui/react-hover-card": "^1.1.15",
|
|
24
|
+
"@radix-ui/react-label": "^2.1.8",
|
|
25
|
+
"@radix-ui/react-menubar": "^1.1.16",
|
|
26
|
+
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
27
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
28
|
+
"@radix-ui/react-progress": "^1.1.8",
|
|
29
|
+
"@radix-ui/react-radio-group": "^1.3.8",
|
|
30
|
+
"@radix-ui/react-scroll-area": "^1.2.10",
|
|
31
|
+
"@radix-ui/react-select": "^2.2.6",
|
|
32
|
+
"@radix-ui/react-separator": "^1.1.8",
|
|
33
|
+
"@radix-ui/react-slider": "^1.3.6",
|
|
34
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
35
|
+
"@radix-ui/react-switch": "^1.2.6",
|
|
36
|
+
"@radix-ui/react-tabs": "^1.1.13",
|
|
37
|
+
"@radix-ui/react-toggle": "^1.1.10",
|
|
38
|
+
"@radix-ui/react-toggle-group": "^1.1.11",
|
|
39
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
40
|
+
"class-variance-authority": "^0.7.1",
|
|
41
|
+
"clsx": "^2.1.1",
|
|
42
|
+
"cmdk": "^1.1.1",
|
|
43
|
+
"date-fns": "^4.1.0",
|
|
44
|
+
"embla-carousel-react": "^8.6.0",
|
|
45
|
+
"input-otp": "^1.4.2",
|
|
46
|
+
"lucide-react": "^0.468.0",
|
|
13
47
|
"next": "16.1.1",
|
|
48
|
+
"next-themes": "^0.4.6",
|
|
14
49
|
"react": "19.2.3",
|
|
15
|
-
"react-
|
|
50
|
+
"react-day-picker": "^9.13.0",
|
|
51
|
+
"react-dom": "19.2.3",
|
|
52
|
+
"react-hook-form": "^7.70.0",
|
|
53
|
+
"react-resizable-panels": "^4.2.0",
|
|
54
|
+
"recharts": "2.15.4",
|
|
55
|
+
"sonner": "^2.0.7",
|
|
56
|
+
"tailwind-merge": "^2.6.0",
|
|
57
|
+
"vaul": "^1.1.2",
|
|
58
|
+
"zod": "^4.3.5"
|
|
16
59
|
},
|
|
17
60
|
"devDependencies": {
|
|
61
|
+
"@react-dev-inspector/babel-plugin": "^2.0.1",
|
|
62
|
+
"@react-dev-inspector/middleware": "^2.0.1",
|
|
18
63
|
"@tailwindcss/postcss": "^4",
|
|
19
64
|
"@types/node": "^20",
|
|
20
65
|
"@types/react": "^19",
|
|
@@ -22,6 +67,8 @@
|
|
|
22
67
|
"eslint": "^9",
|
|
23
68
|
"eslint-config-next": "16.1.1",
|
|
24
69
|
"only-allow": "^1.2.2",
|
|
70
|
+
"react-dev-inspector": "^2.0.1",
|
|
71
|
+
"shadcn": "latest",
|
|
25
72
|
"tailwindcss": "^4",
|
|
26
73
|
"typescript": "^5"
|
|
27
74
|
},
|