CodePush Server source
CodePush Server is a CodePush progam server! microsoft CodePush cloud is slow in China, we can use this to build our's. I use qiniu to store the files, because it's simple and quick! Or you can use [local/s3/oss/tencentcloud] storage, just modify config.js file, it's simple configure.
- local storage bundle file in local machine
- qiniu storage bundle file in qiniu
- s3 storage bundle file in aws
- oss storage bundle file in aliyun
- tencentcloud storage bundle file in tencentcloud
- 苹果 App 允许使用热更新Apple's developer agreement, 为了不影响用户体验,规定必须使用静默更新。 Google Play 不能使用静默更新,必须弹框告知用户 App 有更新。中国的 android 市场必须采用静默更新(如果弹框提示,App 会被“请上传最新版本的二进制应用包”原因驳回)。
- react-native 不同平台 bundle 包不一样,在使用 code-push-server 的时候必须创建不同的应用来区分(eg. CodePushDemo-ios 和 CodePushDemo-android)
- react-native-code-push 只更新资源文件,不会更新 java 和 Objective C,所以 npm 升级依赖包版本的时候,如果依赖包使用的本地化实现, 这时候必须更改应用版本号(ios 修改 Info.plist 中的 CFBundleShortVersionString, android 修改 build.gradle 中的 versionName), 然后重新编译 app 发布到应用商店。
- 推荐使用 code-push release-react 命令发布应用,该命令合并了打包和发布命令(eg. code-push release-react CodePushDemo-ios ios -d Production)
- 每次向 App Store 提交新的版本时,也应该基于该提交版本同时向 code-push-server 发布一个初始版本。(因为后面每次向 code-push-server 发布版本时,code-puse-server 都会和初始版本比较,生成补丁版本)
$ code-push login http://api.code-push.com #登录- docker (recommend)
- manual operation
- account:
admin - password:
123456
code-push-server normal solution
- targetBinaryVersion support
*1.2.31.2/1.2.*1.2.3 - 1.2.7>=1.2.3 <1.2.7~1.2.3^1.2.3
use google diff-match-patch calculate text file diff patch
- support iOS and Android
- use
"react-native-code-push": "git+https://[email protected]/lisong/react-native-code-push.git"instead"react-native-code-push": "x.x.x"inpackage.json - change
apps.is_use_diff_textto1in mysql codepush database
MIT License read
如果还没有创建数据库,可以运行命令创建数据库
./bin/db init --dbhost "110.41.188.129" --dbport "3998" --dbuser "itgcb" --dbpassword "@%2018GcbIt"如果显示邮箱则已登录,否则,使用如下命令进行登录 :
code-push login http://localhost:3000创建了一个名为 test-android 的 android 系统应用,对应平台为 RN
code-push app add test-android android react-native查看当前已创建 app 应用列表
code-push app list查看已应用对应的 key 值
code-push deployment ls gcb-test -k发布
code-push release-react gcb-test ios -t "1.0.0" --des "测试热更新" -d Staging清空 app 的更新
code-push deployment clear gcb-test Staging