expo-bbase 1.2.0 → 1.3.1
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/README.md +147 -48
- package/dist/index.js +1077 -230
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# expo-bbase
|
|
2
2
|
|
|
3
|
-
Expo SDK 54+ 脚手架 CLI
|
|
3
|
+
Expo SDK 54+ 脚手架 CLI 工具,支持交互式选择功能模块和 UI 模板一键生成 React Native 项目。
|
|
4
4
|
|
|
5
5
|
## 快速开始
|
|
6
6
|
|
|
@@ -8,13 +8,25 @@ Expo SDK 54+ 脚手架 CLI 工具,支持交互式选择功能模块一键生
|
|
|
8
8
|
npx expo-bbase my-app
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
创建项目时,你将看到两步交互选择:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
1. **UI 模板选择** — 选择项目初始页面结构
|
|
14
|
+
2. **功能模块选择** — 选择需要的功能模块
|
|
15
|
+
|
|
16
|
+
## UI 模板
|
|
17
|
+
|
|
18
|
+
### Login + Tabs(推荐)
|
|
19
|
+
|
|
20
|
+
开箱即用的完整 UI 结构,基于 [reactnative.reusables](https://reactnativereusables.com/) 组件:
|
|
21
|
+
|
|
22
|
+
- 🔐 **登录页** — SignInForm 组件(Card + Input + Label + Button + Separator)
|
|
23
|
+
- 🏠 **Home Tab** — Button 全变体展示(default/secondary/destructive/outline/ghost/link)+ AlertDialog 演示
|
|
24
|
+
- 📋 **List Tab** — Card 列表展示
|
|
25
|
+
- 👤 **Mine Tab** — 用户信息 Card + Sign Out 退出按钮
|
|
26
|
+
|
|
27
|
+
### Default
|
|
28
|
+
|
|
29
|
+
最基础的 Home + Explore 双 Tab 布局,适合从零开始自定义 UI。
|
|
18
30
|
|
|
19
31
|
## 可选模块
|
|
20
32
|
|
|
@@ -37,7 +49,7 @@ npx expo-bbase my-app
|
|
|
37
49
|
| Apple 登录 | expo-apple-authentication |
|
|
38
50
|
| WebView 容器 | react-native-webview + JS Bridge |
|
|
39
51
|
| 多语言 | i18next + react-i18next |
|
|
40
|
-
| 动画/手势 | Reanimated
|
|
52
|
+
| 动画/手势 | Reanimated 4 + Gesture Handler + Worklets |
|
|
41
53
|
|
|
42
54
|
### P2 扩展模块
|
|
43
55
|
| 模块 | 说明 |
|
|
@@ -47,70 +59,157 @@ npx expo-bbase my-app
|
|
|
47
59
|
| 用户权限管理 | 权限请求/检查封装 |
|
|
48
60
|
| Bottom Sheet | @gorhom/bottom-sheet |
|
|
49
61
|
| FlashList | @shopify/flash-list |
|
|
50
|
-
| reactnative.reusables UI |
|
|
62
|
+
| reactnative.reusables UI | 官方 rnr 组件(Button, Text, Input, Label, Card, Separator, AlertDialog) |
|
|
63
|
+
|
|
64
|
+
## CLI 命令
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# 创建新项目(交互式选择 UI 模板 + 模块)
|
|
68
|
+
npx expo-bbase <project-name>
|
|
69
|
+
npx expo-bbase create <name> # 同上
|
|
70
|
+
|
|
71
|
+
# 在已有项目中增量升级模块文件和依赖
|
|
72
|
+
npx expo-bbase upgrade [path] # path 默认为当前目录
|
|
73
|
+
|
|
74
|
+
# 在已有项目中添加新模块
|
|
75
|
+
npx expo-bbase add [path] # 交互式选择要添加的模块
|
|
76
|
+
npx expo-bbase add [path] -m network,state # 指定模块 ID
|
|
77
|
+
|
|
78
|
+
npx expo-bbase --version # 显示版本号
|
|
79
|
+
npx expo-bbase --help # 显示帮助信息
|
|
80
|
+
```
|
|
51
81
|
|
|
52
82
|
## 使用示例
|
|
53
83
|
|
|
84
|
+
### 创建 Login + Tabs 项目
|
|
85
|
+
|
|
54
86
|
```bash
|
|
55
|
-
# 创建项目
|
|
56
87
|
npx expo-bbase my-awesome-app
|
|
88
|
+
# → 选择 "Login + Tabs" 模板
|
|
89
|
+
# → 选择功能模块
|
|
90
|
+
# → cd my-awesome-app
|
|
91
|
+
# → npx expo start
|
|
92
|
+
# → App 启动后显示登录页,登录后进入 3 Tab 主页
|
|
93
|
+
```
|
|
57
94
|
|
|
58
|
-
|
|
59
|
-
cd my-awesome-app
|
|
95
|
+
### 创建默认项目
|
|
60
96
|
|
|
61
|
-
|
|
62
|
-
npx expo
|
|
97
|
+
```bash
|
|
98
|
+
npx expo-bbase my-awesome-app
|
|
99
|
+
# → 选择 "Default" 模板
|
|
100
|
+
# → 选择功能模块
|
|
101
|
+
# → cd my-awesome-app
|
|
102
|
+
# → npx expo start
|
|
63
103
|
```
|
|
64
104
|
|
|
65
|
-
|
|
105
|
+
### 增量升级
|
|
66
106
|
|
|
67
107
|
```bash
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
npx expo-bbase
|
|
71
|
-
|
|
108
|
+
# 在 expo-bbase 创建的项目目录下
|
|
109
|
+
cd my-awesome-app
|
|
110
|
+
npx expo-bbase upgrade
|
|
111
|
+
# → 自动读取 .expo-bbase.json,更新所有已安装模块的文件和依赖
|
|
72
112
|
```
|
|
73
113
|
|
|
74
|
-
|
|
114
|
+
### 添加新模块
|
|
75
115
|
|
|
76
116
|
```bash
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
# 开发模式(监听文件变化)
|
|
81
|
-
npm run dev
|
|
117
|
+
cd my-awesome-app
|
|
118
|
+
npx expo-bbase add
|
|
119
|
+
# → 交互式选择要添加的模块(已安装的模块不会出现)
|
|
82
120
|
|
|
83
|
-
#
|
|
84
|
-
|
|
121
|
+
# 或直接指定模块
|
|
122
|
+
npx expo-bbase add . -m bottom-sheet,flashlist
|
|
85
123
|
```
|
|
86
124
|
|
|
87
|
-
##
|
|
125
|
+
## 技术栈
|
|
126
|
+
|
|
127
|
+
生成的项目默认包含:
|
|
128
|
+
|
|
129
|
+
- **Expo SDK 54** + New Architecture
|
|
130
|
+
- **Expo Router v5** — 文件路由
|
|
131
|
+
- **NativeWind v4** — Tailwind CSS for React Native
|
|
132
|
+
- **TypeScript** — 类型安全
|
|
133
|
+
- **react-native-svg** — SVG 支持
|
|
134
|
+
|
|
135
|
+
所有依赖版本与 Expo SDK 54 的 `bundledNativeModules.json` 对齐。
|
|
136
|
+
|
|
137
|
+
## 项目结构(Login + Tabs 模板)
|
|
88
138
|
|
|
89
139
|
```
|
|
90
140
|
my-app/
|
|
91
|
-
├── app/
|
|
92
|
-
│ ├── _layout.tsx
|
|
141
|
+
├── app/ # Expo Router 页面
|
|
142
|
+
│ ├── _layout.tsx # 根布局 (Stack)
|
|
143
|
+
│ ├── login.tsx # 登录页
|
|
93
144
|
│ ├── (tabs)/
|
|
94
|
-
│ │ ├── _layout.tsx
|
|
95
|
-
│ │ ├──
|
|
96
|
-
│ │
|
|
145
|
+
│ │ ├── _layout.tsx # Tab 布局 (Home/List/Mine)
|
|
146
|
+
│ │ ├── home.tsx # Button & AlertDialog 展示
|
|
147
|
+
│ │ ├── list.tsx # Card 列表
|
|
148
|
+
│ │ └── mine.tsx # 个人中心 + 退出
|
|
97
149
|
│ └── +not-found.tsx
|
|
98
150
|
├── src/
|
|
99
|
-
│ ├── api/
|
|
100
|
-
│ ├── stores/
|
|
101
|
-
│ ├── storage/
|
|
102
|
-
│ ├──
|
|
103
|
-
│ ├──
|
|
104
|
-
│ ├──
|
|
105
|
-
│ ├──
|
|
106
|
-
│
|
|
107
|
-
├──
|
|
108
|
-
├──
|
|
109
|
-
├──
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
├──
|
|
113
|
-
└──
|
|
151
|
+
│ ├── api/ # 网络请求 (可选)
|
|
152
|
+
│ ├── stores/ # 状态管理 (可选)
|
|
153
|
+
│ ├── storage/ # 本地存储 (可选)
|
|
154
|
+
│ ├── components/
|
|
155
|
+
│ │ ├── ui/ # rnr UI 组件
|
|
156
|
+
│ │ │ ├── button.tsx
|
|
157
|
+
│ │ │ ├── text.tsx
|
|
158
|
+
│ │ │ ├── input.tsx
|
|
159
|
+
│ │ │ ├── label.tsx
|
|
160
|
+
│ │ │ ├── card.tsx
|
|
161
|
+
│ │ │ ├── separator.tsx
|
|
162
|
+
│ │ │ └── alert-dialog.tsx
|
|
163
|
+
│ │ └── SignInForm.tsx # 登录表单
|
|
164
|
+
│ ├── lib/
|
|
165
|
+
│ │ └── utils.ts # cn() 工具函数
|
|
166
|
+
│ ├── modules/ # 功能模块 (可选)
|
|
167
|
+
│ ├── hooks/ # 自定义 Hooks
|
|
168
|
+
│ ├── constants/ # 常量
|
|
169
|
+
│ └── types/ # 类型定义
|
|
170
|
+
├── global.css # NativeWind CSS 变量 (light/dark)
|
|
171
|
+
├── assets/ # 静态资源
|
|
172
|
+
├── app.json # Expo 配置
|
|
173
|
+
├── babel.config.js # Babel 配置 (NativeWind + Reanimated)
|
|
174
|
+
├── metro.config.js # Metro 配置 (withNativeWind)
|
|
175
|
+
├── tailwind.config.js # Tailwind 配置 (rnr 色板变量)
|
|
176
|
+
├── tsconfig.json # TypeScript 配置
|
|
177
|
+
├── .expo-bbase.json # CLI 状态文件
|
|
178
|
+
└── package.json # 项目依赖
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## 配置文件
|
|
182
|
+
|
|
183
|
+
### `.expo-bbase.json`
|
|
184
|
+
|
|
185
|
+
每个由 expo-bbase 创建的项目根目录下会生成此文件,记录已安装的模块和 CLI 版本:
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"projectName": "my-app",
|
|
190
|
+
"selectedModules": ["network", "state", "ui-reusables"],
|
|
191
|
+
"cliVersion": "1.3.0",
|
|
192
|
+
"uiTemplate": "login-tabs"
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
`upgrade` 和 `add` 命令依赖此文件判断项目状态。
|
|
197
|
+
|
|
198
|
+
## 开发
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# 克隆仓库
|
|
202
|
+
git clone https://github.com/dlgchg/expo-bbase.git
|
|
203
|
+
cd expo-bbase
|
|
204
|
+
|
|
205
|
+
# 安装依赖
|
|
206
|
+
npm install
|
|
207
|
+
|
|
208
|
+
# 开发模式(监听文件变化)
|
|
209
|
+
npm run dev
|
|
210
|
+
|
|
211
|
+
# 构建
|
|
212
|
+
npm run build
|
|
114
213
|
```
|
|
115
214
|
|
|
116
215
|
## License
|