expo-bbase 1.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # expo-bbase
2
2
 
3
- Expo SDK 54+ 脚手架 CLI 工具,支持交互式选择功能模块一键生成 React Native 项目。
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
- - Expo SDK 54 + Expo Router v5
15
- - ✅ NativeWind v4 (Tailwind CSS)
16
- - TypeScript 开箱即用
17
- - ✅ 20+ 可选功能模块
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 3 + Gesture Handler |
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 | 预置 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 start
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
- ## CLI 选项
105
+ ### 增量升级
66
106
 
67
107
  ```bash
68
- npx expo-bbase <project-name> # 创建新项目
69
- npx expo-bbase create <name> # 等同于上面的命令
70
- npx expo-bbase --version # 显示版本号
71
- npx expo-bbase --help # 显示帮助信息
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
- npm install
79
-
80
- # 开发模式(监听文件变化)
81
- npm run dev
117
+ cd my-awesome-app
118
+ npx expo-bbase add
119
+ # → 交互式选择要添加的模块(已安装的模块不会出现)
82
120
 
83
- # 构建
84
- npm run build
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/ # Expo Router 页面
92
- │ ├── _layout.tsx
141
+ ├── app/ # Expo Router 页面
142
+ │ ├── _layout.tsx # 根布局 (Stack)
143
+ │ ├── login.tsx # 登录页
93
144
  │ ├── (tabs)/
94
- │ │ ├── _layout.tsx
95
- │ │ ├── index.tsx
96
- │ │ └── explore.tsx
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
- │ ├── modules/ # 功能模块 (可选)
103
- │ ├── components/ # 公共组件
104
- │ ├── hooks/ # 自定义 Hooks
105
- │ ├── constants/ # 常量
106
- └── types/ # 类型定义
107
- ├── assets/ # 静态资源
108
- ├── app.json # Expo 配置
109
- ├── babel.config.js # Babel 配置
110
- ├── metro.config.js # Metro 配置
111
- ├── tailwind.config.js # Tailwind 配置
112
- ├── tsconfig.json # TypeScript 配置
113
- └── package.json # 项目依赖
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
package/dist/index.js CHANGED
@@ -3515,10 +3515,8 @@ export {};
3515
3515
  "slug": "${projectName}",
3516
3516
  "version": "1.0.0",
3517
3517
  "orientation": "portrait",
3518
- "icon": "./assets/icon.png",
3519
3518
  "userInterfaceStyle": "light",
3520
3519
  "splash": {
3521
- "image": "./assets/splash.png",
3522
3520
  "resizeMode": "contain",
3523
3521
  "backgroundColor": "#ffffff"
3524
3522
  },
@@ -3527,15 +3525,8 @@ export {};
3527
3525
  "bundleIdentifier": "com.${projectName}.app"
3528
3526
  },
3529
3527
  "android": {
3530
- "adaptiveIcon": {
3531
- "foregroundImage": "./assets/adaptive-icon.png",
3532
- "backgroundColor": "#ffffff"
3533
- },
3534
3528
  "package": "com.${projectName}.app"
3535
3529
  },
3536
- "web": {
3537
- "favicon": "./assets/favicon.png"
3538
- },
3539
3530
  "plugins": [
3540
3531
  "expo-router",
3541
3532
  "expo-splash-screen"
@@ -3644,7 +3635,7 @@ module.exports = withNativeWind(config, { input: "./global.css" });
3644
3635
  ["babel-preset-expo", { jsxImportSource: "nativewind" }],
3645
3636
  "nativewind/babel",
3646
3637
  ],
3647
- plugins: ["react-native-reanimated/plugin"],
3638
+ plugins: [],
3648
3639
  };
3649
3640
  };
3650
3641
  `
@@ -4209,7 +4200,7 @@ function generateBasePackageJson(projectName) {
4209
4200
 
4210
4201
  // src/index.ts
4211
4202
  var import_execa = require("execa");
4212
- var CLI_VERSION = "1.3.0";
4203
+ var CLI_VERSION = "1.3.1";
4213
4204
  var CONFIG_FILE = ".expo-bbase.json";
4214
4205
  async function run() {
4215
4206
  const program = new import_commander.Command();