Skip to content

Commit b9ef57a

Browse files
committed
Chore: Chore Update
2 parents 05cb9eb + bcfe18d commit b9ef57a

130 files changed

Lines changed: 15198 additions & 835 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/rules/uni-app-patterns.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- 页面文件放在 [src/pages/](mdc:src/pages/) 目录下
55
- 使用约定式路由,文件名即路由路径
66
- 页面配置在仅需要在 宏`definePage` 中配置标题等内容即可,会自动生成到 `pages.json` 中
7+
- definePage的顺序在最上面
78

89
## 组件开发
910
- 组件文件放在 [src/components/](mdc:src/components/) 或者 [src/pages/xx/components/](mdc:src/pages/xx/components/) 目录下

.github/release.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/release-log.yml

Lines changed: 0 additions & 119 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v22

.trae/rules/project_rules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
- 页面文件放在 [src/pages/]目录下
6767
- 使用约定式路由,文件名即路由路径
6868
- 页面配置在仅需要在 宏`definePage` 中配置标题等内容即可,会自动生成到 `pages.json`
69+
- definePage的顺序在最上面
6970

7071
## 组件开发
7172
- 全局组件文件放在 `src/components/` 目录下

.vscode/vue3.code-snippets

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
" style: {",
2525
" navigationBarTitleText: '$1',",
2626
" },",
27+
"})",
28+
"defineOptions({",
29+
" name: '$2',",
30+
" options: { ",
31+
" virtualHost: true,",
32+
" },",
2733
"})",
2834
"</script>\n",
2935
"<template>",
@@ -34,33 +40,50 @@
3440
"</style>\n",
3541
],
3642
},
37-
"Print unibest style": {
43+
"Print unibest Vue3 ComPonents SFC": {
3844
"scope": "vue",
39-
"prefix": "st",
45+
"prefix": "v3c",
4046
"body": [
47+
"<script lang=\"ts\" setup>",
48+
"defineOptions({",
49+
" name: '$1',",
50+
" options: { ",
51+
" virtualHost: true,",
52+
" },",
53+
"})",
54+
"</script>\n",
55+
"<template>",
56+
" <view class=\"\">$3</view>",
57+
"</template>\n",
4158
"<style lang=\"scss\" scoped>",
42-
"//",
43-
"</style>\n"
59+
"//$4",
60+
"</style>\n",
4461
],
4562
},
46-
"Print unibest script": {
63+
"Print unibest style": {
4764
"scope": "vue",
48-
"prefix": "sc",
65+
"prefix": "st",
4966
"body": [
50-
"<script lang=\"ts\" setup>",
51-
"//$1",
52-
"</script>\n"
67+
"<style lang=\"scss\" scoped>",
68+
"//",
69+
"</style>\n"
5370
],
5471
},
5572
"Print unibest script with definePage": {
5673
"scope": "vue",
57-
"prefix": "scdp",
74+
"prefix": "sc",
5875
"body": [
5976
"<script lang=\"ts\" setup>",
6077
"definePage({",
6178
" style: {",
6279
" navigationBarTitleText: '$1',",
6380
" },",
81+
"})",
82+
"defineOptions({",
83+
" name: '$2',",
84+
" options: { ",
85+
" virtualHost: true,",
86+
" },",
6487
"})",
6588
"</script>\n"
6689
],

AGENTS.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# AGENTS.md - unibest Development Guide
2+
3+
## Project Overview
4+
5+
uniapp + Vue3 + TypeScript + Vite5 + UnoCSS template. Supports H5, WeChat Mini Program, App (Android/iOS/HarmonyOS).
6+
7+
## Architecture
8+
9+
```
10+
unibest 仓库 (refactor/monorepo 分支)
11+
└── packages/cli/ # CLI 脚手架工具
12+
└── 用户执行 pnpm create unibest 时,从 Git base 分支克隆模板
13+
```
14+
15+
**模板来源:**
16+
- 用户创建项目时,从 `https://gitee.com/feige996/unibest.git``base` 分支克隆
17+
- CLI 工具本身不包含模板代码
18+
19+
## Essential Commands
20+
21+
```bash
22+
# Development
23+
pnpm dev # H5 dev server
24+
pnpm dev:h5 # H5 with hot reload
25+
pnpm dev:mp # WeChat Mini Program
26+
pnpm dev:app # App development
27+
28+
# Build
29+
pnpm build # Build current platform
30+
pnpm build:h5 # H5 output (dist/build/h5)
31+
pnpm build:mp # WeChat MP (dist/build/mp-weixin)
32+
pnpm build:app # App output (dist/build/app)
33+
34+
# Lint & Type Check
35+
pnpm lint # ESLint
36+
pnpm lint:fix # ESLint auto-fix
37+
pnpm type-check # TypeScript check
38+
```
39+
40+
## Code Style
41+
42+
### TypeScript
43+
- Use explicit types for params and return values
44+
- Prefix interfaces with `I`: `IUserInfoRes`, `ILoginForm`
45+
- Use `import type` for types only
46+
47+
### Vue SFC
48+
```vue
49+
<script lang="ts" setup>
50+
defineOptions({ name: 'PageName' })
51+
definePage({ style: { navigationBarTitleText: 'Title' } })
52+
</script>
53+
54+
<template>
55+
<!-- content -->
56+
</template>
57+
58+
<style lang="scss" scoped>
59+
/* styles */
60+
</style>
61+
```
62+
- Order: template → script → style
63+
64+
### Imports
65+
- Use `@/` alias for src imports: `import { http } from '@/http/http'`
66+
- Group: external libs → Vue/UniApp → @/ → ../
67+
68+
### Naming
69+
| Type | Convention | Example |
70+
|------|------------|---------|
71+
| Components | PascalCase | `TabbarItem.vue` |
72+
| Pages | kebab-case | `login/index.vue` |
73+
| Stores | useXxxStore | `useUserStore` |
74+
| API functions | camelCase | `getUserInfo` |
75+
| Constants | UPPER_SNAKE_CASE | `VITE_SERVER_BASEURL` |
76+
77+
### Error Handling
78+
```typescript
79+
try {
80+
const res = await http.post('/auth/login', data)
81+
return res
82+
}
83+
catch (error) {
84+
uni.showToast({ title: 'Failed', icon: 'error' })
85+
throw error
86+
}
87+
```
88+
89+
### UnoCSS
90+
- Use utility classes: `flex justify-center items-center px-4 pt-safe`
91+
- Theme colors: `text-primary`, `bg-primary`
92+
- Safe areas: `pt-safe`, `pb-safe`, `p-safe`
93+
94+
### API Design
95+
```typescript
96+
// Always specify response type
97+
return http.get<IUserInfoRes>('/user/info')
98+
return http.post<IAuthLoginRes>('/auth/login', data)
99+
```
100+
101+
### Pinia Stores
102+
```typescript
103+
export const useUserStore = defineStore('user', () => {
104+
const userInfo = ref<IUserInfoRes>(initialState)
105+
const setUserInfo = (val: IUserInfoRes) => { ... }
106+
return { userInfo, setUserInfo }
107+
}, { persist: true })
108+
```
109+
110+
## File Structure
111+
```
112+
src/
113+
├── api/ # API definitions
114+
├── components/ # Vue components
115+
├── hooks/ # Composable hooks
116+
├── http/ # alova HTTP config
117+
├── pages/ # Page components
118+
├── store/ # Pinia stores
119+
├── types/ # TypeScript types
120+
└── utils/ # Utility functions
121+
```
122+
123+
## ESLint
124+
- Uses `@uni-helper/eslint-config`
125+
- `console.log` allowed
126+
- Run `pnpm lint:fix` before committing
127+
128+
## Important Notes
129+
- Auto-imports enabled for Vue APIs and uni-app APIs
130+
- Generated files: `src/service/`, `auto-import.d.ts`, `uni-pages.d.ts`
131+
- Pages auto-generated from `src/pages/`
132+
- App config in `manifest.config.ts`

0 commit comments

Comments
 (0)