React Native 热更新

CodePush是微软提供的热更新服务,现已开源。本文介绍了搭建code-push-server的步骤,包括安装、初始化数据库、修改配置、启动服务等,还说明了安装客户端的方法。此外,详细阐述了CODE PUSH的相关操作,如登录、注册APP、发布bundle、查看、回滚和清除等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CodePush 是微软提供的一套用于热更新 React Native 和 Cordova 应用的服务。现在已经开源,可以依据源代码自己搭建一套属于自己的code push server,可以通过npm安装。

  • 安装code-push-server
    1. git clone https://github.com/lisong/code-push-server.git
    2. cd code-push-server
    3. npm install
    4. 初始化数据库
    5. 修改config.js配置
  • 启动code-push-server
    • 切换到work账户,nohup /home/work/code-push-server/bin/www &
    • 在浏览器中打开 http://127.0.0.1:3000,到此服务器端到配置就完成了。
    • 使用admin/123456登录,获取access_token。
  • 安装code-push客户端
    1. npm install -g code-push-cli,等待运行完即可。

                                                  CODE PUSH 相关操作


  • 登录code-push客户端
    • code-push login http://127.0.0.1:3000,然后输入浏览器获取到的access-key。
      Successfully logged-in. Your session file was written to /Users/XX/.code-push.config. You can run the code-push logout command at any time to delete this file and terminate your session.
  • 注册APP
    1. code-push app ls
    2. code-push app ls -help
    3. code-push app add hluser-app-ios-rn ios react-native
    4. code-push app add hluser-app-android-rn android react-native
  • 发布bundle

    1. code-push release -help
    2. code-push release hluser-app-ios-rn /home/work/ios "*" --des "base" -m true
    3. code-push release hluser-app-ios-rn -d Production /home/work/ios "*" --des "base" -m true
      app已经创建好了,其他的也已经配置好了,就差发布一个更新版本来进行测试了,发布到code-push服务器上的是bundle文件,所以需要先把js文件打包成bundle文件。code-push发布应用步骤上是需要先把本地js文件打包成bundle文件,然后再发布。
  • 查看
    1. code-push deployment ls -help
    2. code-push deployment ls hluser-app-ios-rn --displayKeys
    3. code-push deployment ls hluser-app-ios-rn -k
  • 回滚
    1. code-push rollback hluser-app-ios-rn Staging --targetRelease v3
  • 清除
    1. code-push deployment clear hluser-app-ios-rn Staging
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值