expo-gaode-map 2.0.0-alpha.6 → 2.0.0

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/DEPLOY_DOCS.md ADDED
@@ -0,0 +1,209 @@
1
+ # 📚 文档网站部署指南
2
+
3
+ 本文档说明如何部署 expo-gaode-map 的文档网站到 GitHub Pages。
4
+
5
+ ## 🌟 项目结构
6
+
7
+ ```
8
+ expo-gaode-map/
9
+ ├── website/ # 文档网站目录
10
+ │ ├── docs/ # 文档源文件
11
+ │ │ ├── .vitepress/ # VitePress 配置
12
+ │ │ │ └── config.mts # 网站配置文件
13
+ │ │ ├── guide/ # 指南文档
14
+ │ │ ├── api/ # API 文档
15
+ │ │ ├── examples/ # 示例文档
16
+ │ │ └── index.md # 首页
17
+ │ ├── package.json # 依赖配置
18
+ │ └── README.md # 网站说明
19
+ └── .github/
20
+ └── workflows/
21
+ └── deploy-docs.yml # 自动部署配置
22
+ ```
23
+
24
+ ## 🚀 快速部署
25
+
26
+ ### 方式一:GitHub Actions 自动部署(推荐)
27
+
28
+ 1. **启用 GitHub Pages**
29
+
30
+ 进入你的 GitHub 仓库设置:
31
+ - 点击 `Settings` > `Pages`
32
+ - 在 **Source** 下选择 `GitHub Actions`
33
+
34
+ 2. **推送代码**
35
+
36
+ ```bash
37
+ git add .
38
+ git commit -m "Add documentation website"
39
+ git push origin main
40
+ ```
41
+
42
+ 3. **等待部署完成**
43
+
44
+ - 进入仓库的 `Actions` 标签页
45
+ - 查看 "Deploy Docs" 工作流的运行状态
46
+ - 部署成功后,访问: `https://<your-username>.github.io/expo-gaode-map/`
47
+
48
+ ### 方式二:本地构建后手动部署
49
+
50
+ 1. **安装依赖**
51
+
52
+ ```bash
53
+ cd website
54
+ npm install
55
+ ```
56
+
57
+ 2. **构建网站**
58
+
59
+ ```bash
60
+ npm run docs:build
61
+ ```
62
+
63
+ 3. **部署到 GitHub Pages**
64
+
65
+ ```bash
66
+ # 进入构建产物目录
67
+ cd docs/.vitepress/dist
68
+
69
+ # 初始化 git 仓库
70
+ git init
71
+ git add -A
72
+ git commit -m 'Deploy documentation'
73
+
74
+ # 推送到 gh-pages 分支
75
+ git push -f git@github.com:<your-username>/expo-gaode-map.git main:gh-pages
76
+
77
+ cd ../../../..
78
+ ```
79
+
80
+ 4. **配置 GitHub Pages**
81
+
82
+ - 进入 `Settings` > `Pages`
83
+ - Source 选择 `Deploy from a branch`
84
+ - Branch 选择 `gh-pages` 和 `/ (root)`
85
+
86
+ ## 🔧 配置说明
87
+
88
+ ### 修改 Base URL
89
+
90
+ 如果你的 GitHub 仓库名不是 `expo-gaode-map`,需要修改配置:
91
+
92
+ **文件:** `website/docs/.vitepress/config.mts`
93
+
94
+ ```ts
95
+ export default defineConfig({
96
+ base: '/your-repo-name/', // 修改为你的仓库名
97
+ // ...
98
+ })
99
+ ```
100
+
101
+ **文件:** `.github/workflows/deploy-docs.yml`
102
+
103
+ 确保工作流配置正确(当前配置已经是通用的,通常不需要修改)。
104
+
105
+ ### 自定义域名(可选)
106
+
107
+ 如果要使用自定义域名:
108
+
109
+ 1. 在 `website/docs/public/` 目录下创建 `CNAME` 文件
110
+ 2. 文件内容为你的域名,例如: `docs.yoursite.com`
111
+ 3. 在你的域名 DNS 设置中添加 CNAME 记录指向 `<username>.github.io`
112
+
113
+ ## 📝 本地开发
114
+
115
+ ### 启动开发服务器
116
+
117
+ ```bash
118
+ cd website
119
+ npm install
120
+ npm run docs:dev
121
+ ```
122
+
123
+ 访问 http://localhost:5173 查看文档。
124
+
125
+ ### 预览生产版本
126
+
127
+ ```bash
128
+ npm run docs:build
129
+ npm run docs:preview
130
+ ```
131
+
132
+ ## 🎨 自定义文档
133
+
134
+ ### 添加新页面
135
+
136
+ 1. 在相应目录下创建 `.md` 文件
137
+ 2. 在 `config.mts` 中添加导航和侧边栏配置
138
+ 3. 编写文档内容
139
+
140
+ ### 修改主题
141
+
142
+ VitePress 支持主题自定义,详见 [VitePress 文档](https://vitepress.dev/guide/custom-theme)。
143
+
144
+ ## ✅ 验证部署
145
+
146
+ 部署完成后,访问以下 URL 验证:
147
+
148
+ - **首页:** `https://<username>.github.io/expo-gaode-map/`
149
+ - **快速开始:** `https://<username>.github.io/expo-gaode-map/guide/getting-started`
150
+ - **API 文档:** `https://<username>.github.io/expo-gaode-map/api/`
151
+
152
+ ## 🐛 常见问题
153
+
154
+ ### 1. 页面样式丢失或 404
155
+
156
+ **问题:** 部署后页面样式丢失或资源 404
157
+
158
+ **解决方案:** 检查 `base` 配置是否正确设置为 `/your-repo-name/`
159
+
160
+ ### 2. GitHub Actions 部署失败
161
+
162
+ **问题:** Actions 工作流运行失败
163
+
164
+ **解决方案:**
165
+ - 检查 GitHub Pages 是否已启用
166
+ - 确保选择了 "GitHub Actions" 作为 Source
167
+ - 查看 Actions 日志获取详细错误信息
168
+
169
+ ### 3. 本地可以访问,部署后无法访问
170
+
171
+ **问题:** 本地开发正常,部署后无法访问
172
+
173
+ **解决方案:**
174
+ - 确认 GitHub Pages 设置正确
175
+ - 等待几分钟让 DNS 传播
176
+ - 清除浏览器缓存
177
+
178
+ ### 4. 中文路径问题
179
+
180
+ **问题:** 包含中文的文件名导致 URL 编码问题
181
+
182
+ **解决方案:** 使用英文文件名,在文档内容中使用中文标题
183
+
184
+ ## 📚 参考资源
185
+
186
+ - [VitePress 官方文档](https://vitepress.dev/)
187
+ - [GitHub Pages 文档](https://docs.github.com/en/pages)
188
+ - [GitHub Actions 文档](https://docs.github.com/en/actions)
189
+
190
+ ## 🤝 贡献文档
191
+
192
+ 欢迎改进文档!
193
+
194
+ 1. Fork 本仓库
195
+ 2. 创建特性分支
196
+ 3. 修改文档内容
197
+ 4. 提交 Pull Request
198
+
199
+ ## 📄 许可证
200
+
201
+ MIT
202
+
203
+ ---
204
+
205
+ **需要帮助?**
206
+
207
+ - 📝 [提交 Issue](https://github.com/TomWq/expo-gaode-map/issues)
208
+ - 💬 [参与讨论](https://github.com/TomWq/expo-gaode-map/discussions)
209
+ - 💬 加入 QQ 群: 952241387
package/PUBLISHING.md CHANGED
@@ -1,244 +1,262 @@
1
- # 发布到 NPM 指南
1
+ # 发布流程
2
2
 
3
- 本文档说明如何将 `expo-smartrefreshlayout` 发布到 npm。
3
+ 本文档说明如何发布 `expo-gaode-map` 的新版本。
4
4
 
5
- ## 📋 发布前检查清单
5
+ ## 发布前准备
6
6
 
7
- 在发布之前,请确保:
7
+ ### 1. 确保所有测试通过
8
8
 
9
- - [x] README.md 文档完整且准确
10
- - [x] package.json 配置正确
11
- - [x] 所有代码已提交到 Git
12
- - [ ] 构建成功无错误
13
- - [ ] 版本号已更新
14
- - [ ] 已有 npm 账号并已登录
9
+ ```bash
10
+ # 运行测试
11
+ npm test
12
+
13
+ # 运行 lint 检查
14
+ npm run lint
15
+ ```
16
+
17
+ ### 2. 更新版本号
15
18
 
16
- ## 🚀 发布步骤
19
+ 编辑 `package.json` 中的版本号,遵循 [语义化版本](https://semver.org/lang/zh-CN/) 规则:
17
20
 
18
- ### 1. 注册/登录 npm 账号
21
+ - **主版本号(Major)**: 不兼容的 API 修改
22
+ - **次版本号(Minor)**: 向下兼容的功能性新增
23
+ - **修订号(Patch)**: 向下兼容的问题修正
19
24
 
20
- 如果你还没有 npm 账号,需要先注册:
25
+ 或者使用 npm 命令自动更新版本号:
21
26
 
22
27
  ```bash
23
- # 注册账号(如果还没有)
24
- npm adduser
28
+ # 修订版本 (1.0.0 -> 1.0.1)
29
+ npm version patch
25
30
 
26
- # 或者登录已有账号
27
- npm login
31
+ # 次版本 (1.0.0 -> 1.1.0)
32
+ npm version minor
33
+
34
+ # 主版本 (1.0.0 -> 2.0.0)
35
+ npm version major
28
36
  ```
29
37
 
30
- 按照提示输入:
31
- - Username(用户名)
32
- - Password(密码)
33
- - Email(邮箱)
34
- - OTP(如果启用了双因素认证)
38
+ ### 3. 更新 CHANGELOG
35
39
 
36
- 验证是否登录成功:
37
- ```bash
38
- npm whoami
39
- ```
40
+ 在 `CHANGELOG.md` 中记录本次更新的内容:
40
41
 
41
- ### 2. 检查 .npmignore 文件
42
+ ```markdown
43
+ ## [版本号] - YYYY-MM-DD
42
44
 
43
- 确保 `.npmignore` 文件配置正确,避免发布不必要的文件。当前项目已配置。
45
+ ### Added (新增)
46
+ - 新功能描述
44
47
 
45
- ### 3. 清理并构建项目
48
+ ### Changed (变更)
49
+ - 变更内容描述
46
50
 
47
- ```bash
48
- # 清理之前的构建
49
- npm run clean
51
+ ### Fixed (修复)
52
+ - Bug 修复描述
50
53
 
51
- # 重新构建
52
- npm run build
54
+ ### Breaking Changes (破坏性变更)
55
+ - 不兼容的变更说明
53
56
  ```
54
57
 
55
- 构建完成后,会在 `build/` 目录生成编译后的文件。
58
+ ## 发布步骤
56
59
 
57
- ### 4. 测试构建结果
58
-
59
- 在发布前,建议先测试构建结果:
60
+ ### 1. 清理构建产物
60
61
 
61
62
  ```bash
62
- # 查看会被发布的文件列表
63
- npm pack --dry-run
63
+ npm run clean
64
+ ```
64
65
 
65
- # 或者创建一个本地 tarball 测试
66
- npm pack
66
+ ### 2. 构建项目
67
+
68
+ ```bash
69
+ # 构建主模块和 Config Plugin
70
+ npm run build
67
71
  ```
68
72
 
69
- 这会显示将要发布到 npm 的所有文件。
73
+ 这个命令会:
74
+ - 编译 TypeScript 源代码到 `build/` 目录
75
+ - 编译 Config Plugin 到 `plugin/build/` 目录
70
76
 
71
- ### 5. 更新版本号
77
+ ### 3. 验证构建产物
72
78
 
73
- 使用 npm version 命令更新版本号(这会自动创建 git tag):
79
+ 确认以下文件已生成:
74
80
 
75
81
  ```bash
76
- # 修复版本(0.1.0 -> 0.1.1)
77
- npm version patch
82
+ # 主模块构建产物
83
+ ls -la build/
78
84
 
79
- # 次要版本(0.1.0 -> 0.2.0)
80
- npm version minor
81
-
82
- # 主要版本(0.1.0 -> 1.0.0)
83
- npm version major
85
+ # Config Plugin 构建产物
86
+ ls -la plugin/build/
84
87
  ```
85
88
 
86
- 或者手动修改 `package.json` 中的 `version` 字段。
89
+ ### 4. 本地测试(可选但推荐)
87
90
 
88
- ### 6. 发布到 npm
91
+ 在发布前,可以在本地测试包:
89
92
 
90
93
  ```bash
91
- # 正式发布
92
- npm publish
94
+ # 打包到本地
95
+ npm pack
93
96
 
94
- # 如果是第一次发布公开包,需要添加 --access public
95
- npm publish --access public
97
+ # 会生成 expo-gaode-map-x.x.x.tgz 文件
98
+ # 在测试项目中安装:
99
+ # npm install /path/to/expo-gaode-map-x.x.x.tgz
96
100
  ```
97
101
 
98
- **注意**:
99
- - 首次发布必须使用 `--access public`,因为默认是私有包
100
- - 发布后无法撤销,只能发布新版本
101
- - 包名不能与已存在的包重复
102
+ ### 5. 发布到 npm
102
103
 
103
- ### 7. 验证发布
104
+ #### 发布稳定版本
104
105
 
105
- 发布成功后,可以:
106
-
107
- 1. 访问 npm 页面查看:
108
- ```
109
- https://www.npmjs.com/package/expo-smartrefreshlayout
110
- ```
106
+ ```bash
107
+ # 发布到 latest 标签(默认)
108
+ npm publish --tag latest
111
109
 
112
- 2. 尝试安装测试:
113
- ```bash
114
- # 在另一个项目中测试安装
115
- npm install expo-smartrefreshlayout
116
- ```
110
+ # 或使用快捷脚本
111
+ npm run publish:latest
112
+ ```
117
113
 
118
- 3. 查看包信息:
119
- ```bash
120
- npm info expo-smartrefreshlayout
121
- ```
114
+ #### 发布预发布版本
122
115
 
123
- ### 8. 提交代码到 Git
116
+ 如果是 alpha、beta 等预发布版本:
124
117
 
125
118
  ```bash
126
- # 添加所有更改
127
- git add .
128
-
129
- # 提交更改
130
- git commit -m "chore: publish version 0.1.0"
119
+ # 发布到 next 标签
120
+ npm publish --tag next
131
121
 
132
- # 推送到远程仓库(包括 tags)
133
- git push origin main --tags
122
+ # 或使用快捷脚本
123
+ npm run publish:next
134
124
  ```
135
125
 
136
- ## 🔄 发布新版本
126
+ 用户安装时:
127
+ ```bash
128
+ # 安装稳定版
129
+ npm install expo-gaode-map
137
130
 
138
- 当需要发布新版本时:
139
-
140
- 1. 修改代码并测试
141
- 2. 更新 README.md(如果有 API 变化)
142
- 3. 运行 `npm run build` 重新构建
143
- 4. 更新版本号:`npm version patch/minor/major`
144
- 5. 发布:`npm publish`
145
- 6. 推送到 Git:`git push origin main --tags`
131
+ # 安装预发布版
132
+ npm install expo-gaode-map@next
133
+ ```
146
134
 
147
- ## 📝 版本号规范(语义化版本)
135
+ ### 6. 创建 Git 标签
148
136
 
149
- 版本号格式:`主版本号.次版本号.修订号`(例如:1.2.3)
137
+ ```bash
138
+ # 创建标签
139
+ git tag -a v版本号 -m "Release v版本号"
150
140
 
151
- - **主版本号(Major)**:不兼容的 API 修改
152
- - **次版本号(Minor)**:向下兼容的功能性新增
153
- - **修订号(Patch)**:向下兼容的问题修正
141
+ # 推送标签到远程
142
+ git push origin v版本号
154
143
 
155
- 例如:
156
- - `0.1.0` -> `0.1.1`:修复 bug
157
- - `0.1.0` -> `0.2.0`:添加新功能
158
- - `0.1.0` -> `1.0.0`:重大更新,可能不兼容旧版本
144
+ # 或推送所有标签
145
+ git push --tags
146
+ ```
159
147
 
160
- ## ⚠️ 常见问题
148
+ ### 7. 创建 GitHub Release
161
149
 
162
- ### 1. 包名已存在
150
+ 1. 访问 GitHub 仓库的 Releases 页面
151
+ 2. 点击 "Create a new release"
152
+ 3. 选择刚创建的标签
153
+ 4. 填写 Release 标题和说明(可以从 CHANGELOG 复制)
154
+ 5. 点击 "Publish release"
163
155
 
164
- 如果提示包名已被占用,需要修改 `package.json` 中的 `name` 字段:
156
+ ## 完整发布命令(推荐)
165
157
 
166
- ```json
167
- {
168
- "name": "@your-username/expo-smartrefreshlayout"
169
- }
170
- ```
158
+ ```bash
159
+ # 1. 清理
160
+ npm run clean
171
161
 
172
- 使用 npm scope 可以避免命名冲突。
162
+ # 2. 构建(包含主模块和插件)
163
+ npm run build
173
164
 
174
- ### 2. 需要双因素认证(2FA)
165
+ # 3. 测试
166
+ npm test
167
+ npm run lint
175
168
 
176
- 如果账号启用了 2FA,发布时需要提供 OTP:
169
+ # 4. 发布到 npm
170
+ npm run publish:latest # 稳定版
171
+ # 或
172
+ npm run publish:next # 预发布版
177
173
 
178
- ```bash
179
- npm publish --otp=123456
174
+ # 5. 提交代码和标签
175
+ git add .
176
+ git commit -m "chore: release v版本号"
177
+ git tag -a v版本号 -m "Release v版本号"
178
+ git push origin main
179
+ git push origin v版本号
180
180
  ```
181
181
 
182
- ### 3. 构建失败
182
+ ## 发布文档网站(可选)
183
183
 
184
- 确保安装了所有依赖:
184
+ 如果更新了文档,也需要部署文档网站:
185
185
 
186
186
  ```bash
187
- npm install
187
+ cd website
188
188
  npm run build
189
+ # 然后根据你的部署方式部署 docs/.vitepress/dist 目录
189
190
  ```
190
191
 
191
- ### 4. 发布权限问题
192
+ ## 回滚版本
192
193
 
193
- 确保你已登录正确的 npm 账号:
194
+ 如果发布后发现问题,可以废弃某个版本:
194
195
 
195
196
  ```bash
196
- npm whoami
197
- npm login
197
+ # 废弃特定版本
198
+ npm deprecate expo-gaode-map@版本号 "这个版本有问题,请使用 x.x.x 版本"
199
+
200
+ # 取消发布(发布后24小时内)
201
+ npm unpublish expo-gaode-map@版本号
198
202
  ```
199
203
 
200
- ## 🎯 发布检查脚本
204
+ ## 发布检查清单
201
205
 
202
- 你可以创建一个脚本来自动化发布前检查:
206
+ - [ ] 更新版本号
207
+ - [ ] 更新 CHANGELOG.md
208
+ - [ ] 运行 `npm run clean`
209
+ - [ ] 运行 `npm run build`
210
+ - [ ] 运行 `npm test`
211
+ - [ ] 运行 `npm run lint`
212
+ - [ ] 确认 `build/` 目录有构建产物
213
+ - [ ] 确认 `plugin/build/` 目录有构建产物
214
+ - [ ] 本地测试 npm pack
215
+ - [ ] 发布到 npm
216
+ - [ ] 创建 Git 标签
217
+ - [ ] 推送标签到 GitHub
218
+ - [ ] 创建 GitHub Release
219
+ - [ ] 在测试项目中验证新版本
203
220
 
204
- ```bash
205
- #!/bin/bash
221
+ ## 注意事项
206
222
 
207
- echo "🔍 检查 Git 状态..."
208
- if [[ -n $(git status -s) ]]; then
209
- echo "❌ 有未提交的更改,请先提交"
210
- exit 1
211
- fi
223
+ 1. **Config Plugin 构建**: 确保 `plugin/build/` 目录包含在发布包中
224
+ 2. **`.npmignore` 配置**: 确认不需要的文件被排除
225
+ 3. **发布权限**: 确保你有 npm 包的发布权限
226
+ 4. **npm 登录**: 发布前确保已登录 `npm login`
227
+ 5. **双因素认证**: 如果启用了 2FA,准备好认证码
212
228
 
213
- echo "🧹 清理构建..."
214
- npm run clean
229
+ ## 常见问题
215
230
 
216
- echo "🔨 开始构建..."
217
- npm run build
231
+ ### 发布失败: 权限不足
218
232
 
219
- echo "✅ 构建成功!"
220
- echo "📦 预览将要发布的文件:"
221
- npm pack --dry-run
233
+ ```bash
234
+ # 检查登录状态
235
+ npm whoami
222
236
 
223
- echo ""
224
- echo "准备发布!请运行:"
225
- echo " npm version patch # 或 minor/major"
226
- echo " npm publish --access public"
237
+ # 重新登录
238
+ npm login
227
239
  ```
228
240
 
229
- ## 📚 相关资源
241
+ ### 构建产物不存在
230
242
 
231
- - [npm 官方文档](https://docs.npmjs.com/)
232
- - [语义化版本规范](https://semver.org/lang/zh-CN/)
233
- - [Expo Modules 文档](https://docs.expo.dev/modules/overview/)
243
+ ```bash
244
+ # 确保构建成功
245
+ npm run build
234
246
 
235
- ## 🎉 首次发布
247
+ # 检查 .npmignore 是否错误排除了构建产物
248
+ cat .npmignore
249
+ ```
236
250
 
237
- 如果这是首次发布,建议:
251
+ ### 版本已存在
238
252
 
239
- 1. 先发布 `0.1.0` 版本进行测试
240
- 2. 收集用户反馈
241
- 3. 修复问题后发布 `0.1.1`、`0.1.2` 等
242
- 4. 功能稳定后发布 `1.0.0` 正式版
253
+ ```bash
254
+ # 无法覆盖已发布的版本,需要更新版本号
255
+ npm version patch
256
+ ```
257
+
258
+ ## 相关链接
243
259
 
244
- 祝发布顺利!🚀
260
+ - [npm 发布文档](https://docs.npmjs.com/cli/v10/commands/npm-publish)
261
+ - [语义化版本规范](https://semver.org/lang/zh-CN/)
262
+ - [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/)
package/README.en.md CHANGED
@@ -32,29 +32,6 @@ yarn add expo-gaode-map
32
32
  pnpm add expo-gaode-map
33
33
  ```
34
34
 
35
- ### Try 2.0 Beta Version 🚀
36
-
37
- > ⚠️ **Important**: Version 2.0 contains breaking changes with significant API adjustments. See [Migration Guide](docs/MIGRATION.md)
38
-
39
- If you want to try the latest 2.0 alpha version (with improved architecture and better type support):
40
-
41
- ```bash
42
- npm install expo-gaode-map@next
43
- # or
44
- yarn add expo-gaode-map@next
45
- # or
46
- pnpm add expo-gaode-map@next
47
- ```
48
-
49
- **Major Changes in 2.0:**
50
- - ✅ Unified API calling method (`ExpoGaodeMapModule`)
51
- - ✅ Complete TypeScript type support
52
- - ✅ Removed unnecessary wrapper layers, direct native module calls
53
- - ⚠️ **Not backward compatible**, code updates required per [Migration Guide](docs/MIGRATION.md)
54
-
55
- **Version Comparison:**
56
- - `1.x` (Stable): `import { initSDK, start, stop } from 'expo-gaode-map'`
57
- - `2.0` (Beta): `import { ExpoGaodeMapModule } from 'expo-gaode-map'`
58
35
 
59
36
  ### Expo Projects
60
37
 
@@ -224,8 +201,7 @@ Includes:
224
201
  - [API Documentation](docs/API.en.md) - Complete API reference
225
202
  - [Usage Examples](docs/EXAMPLES.en.md) - Detailed code examples
226
203
  - [Initialization Guide](docs/INITIALIZATION.en.md) - SDK initialization and permission management
227
- - [Architecture Documentation](docs/ARCHITECTURE.en.md) - Project structure and file descriptions
228
- - [Migration Guide](docs/MIGRATION.md) - Migration guide from v1.x to v2.0
204
+ - [Architecture Documentation](docs/ARCHITECTURE.en.md) - Project structure and file
229
205
 
230
206
  ## 🎨 Advanced Usage
231
207