Skip to content

Commit 1bd88a0

Browse files
authored
Merge pull request #5 from xuwening/master
增加iOS增量模块npm安装方式
2 parents cad7906 + 49bc07b commit 1bd88a0

3 files changed

Lines changed: 78 additions & 0 deletions

File tree

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,56 @@
11
# LDReactNativeDiffUpdate
22
React native增量更新,支持多入口多业务。
3+
4+
## 增量更新实现机制
5+
6+
目前增量更新采用native实现,后续会暴露功能接口,供js控制更新流程。
7+
8+
为了更好的用户体验,所有业务包进行工程内置,增量包后台下载合并操作,App下次启动更新生效(后续增加立即生效功能)。
9+
10+
增量算法采用bsdiff差异算法。
11+
12+
## 安装和使用
13+
14+
#### iOS安装增量更新
15+
16+
工程根目录执行:
17+
18+
`npm install --save react-native-diff-update`
19+
`react-native link react-native-DebugServerHost`
20+
21+
打开工程可以看到`LLibraries``LDRNDiffUpdate`就是增量更新模块。
22+
23+
24+
#### iOS使用
25+
26+
首先进行相关配置,配置信息在`LDRNBundleList.m`文件中,核心设置有:
27+
28+
```
29+
appKey //应用唯一标识
30+
rnVersion //当前工程使用的React Native版本
31+
originBundles //工程内置的业务bundle
32+
originBundlesHash //业务bundle的md5 (可选)
33+
entryJSName //bundle入口文件名称
34+
patchFileName //补丁bundle入口文件名称
35+
versionUrl //版本请求接口地址
36+
```
37+
38+
配置好信息后,在自己的需要加载bundle的`viewController`中引入头文件`#import "LDRNDiffUpdate.h"`,然后指定jsBundle文件名即可:
39+
40+
```OC
41+
NSURL *jsCodeLocation = [LDRNDiffUpdate jsBundleUrl:@"LDBusinessEntry"];
42+
```
43+
44+
45+
#### android安装增量更新
46+
47+
#### android相关配置
48+
49+
## 接口说明
50+
51+
#### 版本请求接口
52+
53+
## 安全
54+
55+
56+

js/index.js

Whitespace-only changes.

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "react-native-diff-update",
3+
"version": "1.0.0",
4+
"description": "React native增量更新,支持多入口多业务。",
5+
"main": "js/index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/xuwening/LDReactNativeDiffUpdate.git"
12+
},
13+
"keywords": [
14+
"react-native",
15+
"diff",
16+
"hot update"
17+
],
18+
"author": "leadeon",
19+
"license": "MIT",
20+
"bugs": {
21+
"url": "https://github.com/xuwening/LDReactNativeDiffUpdate/issues"
22+
},
23+
"homepage": "https://github.com/xuwening/LDReactNativeDiffUpdate#readme"
24+
}

0 commit comments

Comments
 (0)