React Native集成codePush

1:codePush 命令
npm install -g code-push-cli
code-push -v
code-push login 登陸
code-push loout 注銷
code-push access-key ls 列出登陸的token
code-push access-key rm <accessKeyName> 刪除某個 access-key
code-push app add <appName> <os> <platform> 在賬號里面添加一個新的app
code-push app remove 或者 rm 在賬號里移除一個app
code-push app rename 重命名一個存在app
code-push app list 或則 ls 列出賬號下面的所有app
code-push app transfer 把app的所有權(quán)轉(zhuǎn)移到另外一個賬號
code-push register //當(dāng)注冊成功后就缆,CodePush會給我們一個key,
我們直接復(fù)制這個key,然后在終端中將這個key填寫進(jìn)去即可
應(yīng)用添加成功后就會返回對應(yīng)的production 和 Staging 兩個key,production代表生產(chǎn)版的熱更新部署终畅,Staging代表開發(fā)版的熱更新部署

2:deployment 命令
code-push deployment <command>
命令:
add Add a new deployment to an app
clear Clear the release history associated with a deployment
remove Remove a deployment from an app
rm Remove a deployment from an app
rename Rename an existing deployment
list List the deployments associated with an app
ls List the deployments associated with an app
history Display the release history for a deployment
h Display the release history for a deployment

3:集成CodePush SDK
進(jìn)入項目根目錄(具有Android絮识,ios挪圾,和package.json文件為項目根目錄)
npm install --save react-native-code-push
react-native link

4:發(fā)布更新
code-push release-react <appName> <platform> [options]
選項:
--bundleName, -b Name of the generated JS bundle file. If unspecified, the standard bundle name will be used, depending on the specified platform: "main.jsbundle" (iOS), "index.android.bundle" (Android) or "index.windows.bundle" (Windows) [字符串] [默認(rèn)值: null]
--deploymentName, -d Deployment to release the update to [字符串] [默認(rèn)值: "Staging",分為"Staging","Production"]
--description, --des Description of the changes made to the app with this release [字符串] [默認(rèn)值: null靠益,描述,備注]
--development, --dev Specifies whether to generate a dev or release build [布爾] [默認(rèn)值: false]
--disabled, -x Specifies whether this release should be immediately downloadable [布爾] [默認(rèn)值: false]
--entryFile, -e Path to the app's entry Javascript file. If omitted, "index.<platform>.js" and then "index.js" will be used (if they exist) [字符串] [默認(rèn)值: null]
--gradleFile, -g Path to the gradle file which specifies the binary version you want to target this release at (android only). [默認(rèn)值: null]
--mandatory, -m Specifies whether this release should be considered mandatory [布爾] [默認(rèn)值: false,強制更新]
--noDuplicateReleaseError When this flag is set, releasing a package that is identical to the latest release will produce a warning instead of an error [布爾] [默認(rèn)值: false]
--plistFile, -p Path to the plist file which specifies the binary version you want to target this release at (iOS only). [默認(rèn)值: null]
--plistFilePrefix, --pre Prefix to append to the file name when attempting to find your app's Info.plist file (iOS only). [默認(rèn)值: null]
--rollout, -r Percentage of users this release should be immediately available to [字符串] [默認(rèn)值: "100%"]
--privateKeyPath, -k Specifies the location of a RSA private key to sign the release with [字符串] [默認(rèn)值: false]
--sourcemapOutput, -s Path to where the sourcemap for the resulting bundle should be written. If omitted, a sourcemap will not be generated. [字符串] [默認(rèn)值: null]
--targetBinaryVersion, -t Semver expression that specifies the binary app version(s) this release is targeting (e.g. 1.1.0, ~1.2.3). If omitted, the release will target the exact version specified in the "Info.plist" (iOS), "build.gradle" (Android) or "Package.appxmanifest" (Windows) files. [字符串] [默認(rèn)值: null]
--outputDir, -o Path to where the bundle and sourcemap should be written. If omitted, a bundle and sourcemap will not be written. [字符串] [默認(rèn)值: null]
--config, -c Path to the React Native CLI configuration file [字符串] [默認(rèn)值: null]
-v, --version 顯示版本號 [布爾]

mkdir bundles //在當(dāng)前目錄中新建文件夾bundles
react-native bundle --platform android --entry-file index.js --bundle-output ./bundles/index.android.bundle --dev false
code-push release <appName> <updateContentsPath> <targetBinaryVersion> [options]
code-push release AndroidRNCodePushDemo ./bundles/index.android.bundle 1.0.0 --deploymentName Staging --description "1:測試第一次codePush" --mandatory true

5:接入流程
安裝 CodePush CLI
注冊 CodePush賬號
在CodePush服務(wù)器注冊App
RN代碼中集成CodePush
原生應(yīng)用中配置CodePush
生成bundle
上傳bundle

6:appcenter賬號
appcenter login
npm i appcenter-cli 更新appcenter客戶端
After registering, you are automatically logged-in with the CLI, so until you explicitly log out, you don't need to login again from the same machine.
appcenter profile list 展示登錄的appcenter賬號信息
appcenter logout 退出登錄appcenter
appcenter tokens list
appcenter tokens delete <machineName(ID)>
appcenter tokens create -d "Azure DevOps Integration"
appcenter login --token <accessToken>
appcenter apps list
appcenter apps set-current <ownerName>/<appName>
appcenter codepush deployment list -a <ownerName>/<appName>
appcenter codepush deployment list
appcenter apps get-current

7:范圍表達(dá)式
1.2.3 僅僅只有1.2.3的版本
*所有版本
1.2.x 主要版本1街图,次要版本2的任何修補程序版本
1.2.3 - 1.2.7 1.2.3版本到1.2.7版本
=1.2.3 <1.2.7 大于等于1.2.3版本小于1.2.7的版本
~1.2.3 大于等于1.2.3版本小于1.3.0的版本
^1.2.3 大于等于1.2.3版本小于2.0.0的版本

codePush與Pushy起沖突,一個應(yīng)用集成一個熱更新就行耘擂。

具體參考以下三篇文章:

CodePush熱更新詳細(xì)接入教程 作者光強_上海
react-native熱更新之CodePush詳細(xì)介紹及使用方法
作者clf_programing
code-push常用命令 作者九卿

特別感謝三位的文章胆剧!

微軟官網(wǎng)鏈接:Releasing CodePush updates using the App Center CLI

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市醉冤,隨后出現(xiàn)的幾起案子秩霍,更是在濱河造成了極大的恐慌,老刑警劉巖蚁阳,帶你破解...
    沈念sama閱讀 219,427評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件铃绒,死亡現(xiàn)場離奇詭異,居然都是意外死亡螺捐,警方通過查閱死者的電腦和手機(jī)颠悬,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,551評論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來定血,“玉大人赔癌,你說我怎么就攤上這事±焦担” “怎么了灾票?”我有些...
    開封第一講書人閱讀 165,747評論 0 356
  • 文/不壞的土叔 我叫張陵,是天一觀的道長茫虽。 經(jīng)常有香客問我刊苍,道長,這世上最難降的妖魔是什么濒析? 我笑而不...
    開封第一講書人閱讀 58,939評論 1 295
  • 正文 為了忘掉前任正什,我火速辦了婚禮,結(jié)果婚禮上悼枢,老公的妹妹穿的比我還像新娘埠忘。我一直安慰自己,他們只是感情好馒索,可當(dāng)我...
    茶點故事閱讀 67,955評論 6 392
  • 文/花漫 我一把揭開白布莹妒。 她就那樣靜靜地躺著,像睡著了一般绰上。 火紅的嫁衣襯著肌膚如雪旨怠。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,737評論 1 305
  • 那天蜈块,我揣著相機(jī)與錄音鉴腻,去河邊找鬼迷扇。 笑死,一個胖子當(dāng)著我的面吹牛爽哎,可吹牛的內(nèi)容都是我干的蜓席。 我是一名探鬼主播,決...
    沈念sama閱讀 40,448評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼课锌,長吁一口氣:“原來是場噩夢啊……” “哼厨内!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起渺贤,我...
    開封第一講書人閱讀 39,352評論 0 276
  • 序言:老撾萬榮一對情侶失蹤雏胃,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后志鞍,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體瞭亮,經(jīng)...
    沈念sama閱讀 45,834評論 1 317
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,992評論 3 338
  • 正文 我和宋清朗相戀三年固棚,在試婚紗的時候發(fā)現(xiàn)自己被綠了统翩。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,133評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡此洲,死狀恐怖唆缴,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情黍翎,我是刑警寧澤面徽,帶...
    沈念sama閱讀 35,815評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站匣掸,受9級特大地震影響趟紊,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜碰酝,卻給世界環(huán)境...
    茶點故事閱讀 41,477評論 3 331
  • 文/蒙蒙 一霎匈、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧送爸,春花似錦铛嘱、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,022評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至纹磺,卻和暖如春帖烘,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背橄杨。 一陣腳步聲響...
    開封第一講書人閱讀 33,147評論 1 272
  • 我被黑心中介騙來泰國打工秘症, 沒想到剛下飛機(jī)就差點兒被人妖公主榨干…… 1. 我叫王不留照卦,地道東北人。 一個月前我還...
    沈念sama閱讀 48,398評論 3 373
  • 正文 我出身青樓乡摹,卻偏偏與公主長得像役耕,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子聪廉,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,077評論 2 355

推薦閱讀更多精彩內(nèi)容