熱更新 codepush
- Code Push 熱更新使用詳細說明和教程
- React-Native 使用微軟的CodePush進行熱更新,繼續填坑
- react-native-android實戰:4 CodePush使用
- React Native 使用Code-Push 更新APP
步驟
-
npm install -g code-push-cli
安裝 cli.
code-push -v
查看版本信息:1.12.6-beta
-
code-push register
在瀏覽器打開的頁面選擇認證方式,認證成功后跳轉到 access key 頁面(圖一)。
復制 key 在命令行執行,注冊成功返回信息
Successfully logged-in. Your session file was written to C:\Users\BinG\AppData\Local.code-push.config. You can run the code-push logout command at any time to delete this file and terminate your session.
-
code-push app add <appName>
注冊 app 獲取 key
Successfully added the "zyxldsapp" app, along with the following default deployments:
┌────────────┬───────────────────────────────────────┐
│ Name │ Deployment Key │
├────────────┼───────────────────────────────────────┤
│ Production ││
├────────────┼───────────────────────────────────────┤
│ Staging │ │
└────────────┴───────────────────────────────────────┘
npm install --save react-native-code-push
安裝 React Native module for CodePushreact-native link react-native-code-push
圖二
rnpm link the plugin.修改 MainActivity.java 文件
new CodePush("deployment-key-here" , this , BuildCofig.DEBUG)
deployment-key-here 可以通過 code-push deployment ls zyxldsapp -k
命令查看
Staging 為測試階段,Production 為生產環境
當應用開發完成,可使用 code-push promote
命令從 Staging 遷移到 Production.
code-push release-react <appName> <platform>
CLI docs 發布更新
mandatory
-m 強制更新updateDialog
options
optionalIgnoreButtonLabel
Defaults to "Ignore"
optionalInstallButtonLabel
Defaults to "Install"
optionalUpdateMessage
Defaults to "An update is available. Would you like to install it?"
title
Defaults to"Update available"圖例