@algocare/react-native-code-push 12.6.3 → 13.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/CodePush.podspec +6 -8
  2. package/README.md +343 -586
  3. package/android/app/build.gradle +2 -1
  4. package/android/app/proguard-rules.pro +14 -0
  5. package/android/app/src/debug/AndroidManifest.xml +9 -0
  6. package/android/app/src/main/AndroidManifest.xml +1 -2
  7. package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +14 -139
  8. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +0 -3
  9. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +108 -63
  10. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +2 -33
  11. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +13 -109
  12. package/android/build.gradle +3 -0
  13. package/app.plugin.js +1 -0
  14. package/bin/code-push.js +6 -0
  15. package/cli/commands/bundleCommand/bundleCodePush.ts +118 -0
  16. package/cli/commands/bundleCommand/index.ts +34 -0
  17. package/cli/commands/createHistoryCommand/createReleaseHistory.ts +37 -0
  18. package/cli/commands/createHistoryCommand/createReleaseHistoryList.ts +40 -0
  19. package/cli/commands/createHistoryCommand/index.ts +44 -0
  20. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.ts +33 -0
  21. package/cli/commands/createPullRequestHistoryCommand/index.ts +31 -0
  22. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.ts +71 -0
  23. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.ts +75 -0
  24. package/cli/commands/createPullRequestReleaseCommand/index.ts +74 -0
  25. package/cli/commands/getPackageHashCommand/index.ts +45 -0
  26. package/cli/commands/initCommand/index.ts +14 -0
  27. package/cli/commands/initCommand/initAndroid.ts +91 -0
  28. package/cli/commands/initCommand/initIos.ts +123 -0
  29. package/cli/commands/initCommand/test/initAndroid.test.ts +128 -0
  30. package/cli/commands/initCommand/test/initIos.test.ts +99 -0
  31. package/cli/commands/releaseCommand/addToReleaseHistory.ts +57 -0
  32. package/cli/commands/releaseCommand/index.ts +90 -0
  33. package/cli/commands/releaseCommand/release.ts +105 -0
  34. package/cli/commands/removePullRequestHistoryCommand/index.ts +37 -0
  35. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.ts +28 -0
  36. package/cli/commands/showHistoryCommand/index.ts +31 -0
  37. package/cli/commands/updateHistoryCommand/index.ts +55 -0
  38. package/cli/commands/updateHistoryCommand/updateReleaseHistory.ts +42 -0
  39. package/cli/constant.ts +4 -0
  40. package/cli/dist/commands/bundleCommand/bundleCodePush.js +65 -0
  41. package/cli/dist/commands/bundleCommand/index.js +15 -0
  42. package/cli/dist/commands/createHistoryCommand/createReleaseHistory.js +25 -0
  43. package/cli/dist/commands/createHistoryCommand/createReleaseHistoryList.js +27 -0
  44. package/cli/dist/commands/createHistoryCommand/index.js +20 -0
  45. package/cli/dist/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +23 -0
  46. package/cli/dist/commands/createPullRequestHistoryCommand/index.js +15 -0
  47. package/cli/dist/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +51 -0
  48. package/cli/dist/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +39 -0
  49. package/cli/dist/commands/createPullRequestReleaseCommand/index.js +35 -0
  50. package/cli/dist/commands/getPackageHashCommand/index.js +26 -0
  51. package/cli/dist/commands/initCommand/index.js +12 -0
  52. package/cli/dist/commands/initCommand/initAndroid.js +73 -0
  53. package/cli/dist/commands/initCommand/initIos.js +108 -0
  54. package/cli/dist/commands/initCommand/test/initAndroid.test.js +113 -0
  55. package/cli/dist/commands/initCommand/test/initIos.test.js +95 -0
  56. package/cli/dist/commands/releaseCommand/addToReleaseHistory.js +35 -0
  57. package/cli/dist/commands/releaseCommand/index.js +45 -0
  58. package/cli/dist/commands/releaseCommand/release.js +62 -0
  59. package/cli/dist/commands/removePullRequestHistoryCommand/index.js +19 -0
  60. package/cli/dist/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +18 -0
  61. package/cli/dist/commands/showHistoryCommand/index.js +15 -0
  62. package/cli/dist/commands/updateHistoryCommand/index.js +31 -0
  63. package/cli/dist/commands/updateHistoryCommand/updateReleaseHistory.js +28 -0
  64. package/cli/dist/constant.js +4 -0
  65. package/cli/dist/functions/getReactTempDir.js +10 -0
  66. package/cli/{functions → dist/functions}/makeCodePushBundle.js +5 -11
  67. package/cli/{functions → dist/functions}/prepareToBundleJS.js +2 -5
  68. package/cli/dist/functions/runExpoBundleCommand.js +35 -0
  69. package/cli/{functions → dist/functions}/runHermesEmitBinaryCommand.js +36 -71
  70. package/cli/{functions → dist/functions}/runReactNativeBundleCommand.js +19 -24
  71. package/cli/dist/index.js +54 -0
  72. package/cli/dist/utils/datetime.js +17 -0
  73. package/cli/dist/utils/file-utils.js +19 -0
  74. package/cli/dist/utils/fsUtils.js +44 -0
  75. package/cli/{utils → dist/utils}/hash-utils.js +19 -130
  76. package/cli/{utils → dist/utils}/promisfied-fs.js +5 -16
  77. package/cli/dist/utils/showLogo.js +21 -0
  78. package/cli/dist/utils/unzip.js +41 -0
  79. package/cli/{utils → dist/utils}/zip.js +15 -51
  80. package/cli/functions/{getReactTempDir.js → getReactTempDir.ts} +2 -6
  81. package/cli/functions/makeCodePushBundle.ts +26 -0
  82. package/cli/functions/prepareToBundleJS.ts +10 -0
  83. package/cli/functions/runExpoBundleCommand.ts +45 -0
  84. package/cli/functions/runHermesEmitBinaryCommand.ts +203 -0
  85. package/cli/functions/runReactNativeBundleCommand.ts +67 -0
  86. package/cli/index.ts +68 -0
  87. package/cli/package.json +35 -0
  88. package/cli/utils/datetime.ts +19 -0
  89. package/cli/utils/{file-utils.js → file-utils.ts} +4 -21
  90. package/cli/utils/fsUtils.ts +50 -0
  91. package/cli/utils/hash-utils.ts +143 -0
  92. package/cli/utils/promisfied-fs.ts +19 -0
  93. package/cli/utils/{showLogo.js → showLogo.ts} +4 -6
  94. package/cli/utils/unzip.ts +46 -0
  95. package/cli/utils/zip.ts +65 -0
  96. package/expo/plugin/withCodePush.js +14 -0
  97. package/expo/plugin/withCodePushAndroid.js +92 -0
  98. package/expo/plugin/withCodePushIos.js +143 -0
  99. package/ios/CodePush/CodePush.h +0 -16
  100. package/ios/CodePush/CodePush.m +30 -20
  101. package/ios/CodePush/CodePushConfig.m +1 -11
  102. package/ios/CodePush/CodePushPackage.m +12 -69
  103. package/ios/CodePush/CodePushUpdateUtils.m +1 -91
  104. package/ios/CodePush/SSZipArchive/Info.plist +26 -0
  105. package/ios/CodePush/SSZipArchive/README.md +1 -1
  106. package/ios/CodePush/SSZipArchive/SSZipArchive.h +129 -27
  107. package/ios/CodePush/SSZipArchive/SSZipArchive.m +1119 -314
  108. package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
  109. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
  110. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
  111. package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
  112. package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
  113. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
  114. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
  115. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
  116. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
  117. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
  118. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
  119. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
  120. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
  121. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
  122. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
  123. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
  124. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
  125. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
  126. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
  127. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
  128. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
  129. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
  130. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
  131. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
  132. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
  133. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
  134. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
  135. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
  136. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
  137. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
  138. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
  139. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
  140. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
  141. package/ios/CodePush.xcodeproj/project.pbxproj +244 -453
  142. package/ios/PrivacyInfo.xcprivacy +31 -0
  143. package/package.json +67 -41
  144. package/react-native.config.js +1 -1
  145. package/{AlertAdapter.js → src/AlertAdapter.js} +5 -5
  146. package/src/CodePush.js +947 -0
  147. package/{package-mixins.js → src/package-mixins.js} +1 -1
  148. package/{versioning → src/versioning}/BaseVersioning.js +12 -1
  149. package/{versioning → src/versioning}/SemverVersioning.test.js +78 -0
  150. package/typings/react-native-code-push.d.ts +559 -495
  151. package/CONTRIBUTING.md +0 -134
  152. package/CodePush.js +0 -972
  153. package/SECURITY.md +0 -41
  154. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
  155. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +0 -12
  156. package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +0 -17
  157. package/android/codepush.gradle +0 -162
  158. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  159. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  160. package/android/gradlew +0 -164
  161. package/android/gradlew.bat +0 -90
  162. package/babel.config.js +0 -3
  163. package/cli/commands/bundleCommand/bundleCodePush.js +0 -57
  164. package/cli/commands/bundleCommand/index.js +0 -55
  165. package/cli/commands/common.js +0 -245
  166. package/cli/commands/createHistoryCommand/createReleaseHistory.js +0 -42
  167. package/cli/commands/createHistoryCommand/createReleaseHistoryList.js +0 -52
  168. package/cli/commands/createHistoryCommand/index.js +0 -95
  169. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +0 -34
  170. package/cli/commands/createPullRequestHistoryCommand/index.js +0 -29
  171. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +0 -74
  172. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +0 -91
  173. package/cli/commands/createPullRequestReleaseCommand/index.js +0 -68
  174. package/cli/commands/getPackageHashCommand/index.js +0 -42
  175. package/cli/commands/releaseCommand/addToReleaseHistory.js +0 -85
  176. package/cli/commands/releaseCommand/index.js +0 -151
  177. package/cli/commands/releaseCommand/release.js +0 -121
  178. package/cli/commands/removePullRequestHistoryCommand/index.js +0 -28
  179. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +0 -23
  180. package/cli/commands/showHistoryCommand/index.js +0 -88
  181. package/cli/commands/updateHistoryCommand/index.js +0 -123
  182. package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +0 -69
  183. package/cli/constant.js +0 -8
  184. package/cli/index.js +0 -63
  185. package/cli/utils/datetime.js +0 -22
  186. package/cli/utils/fsUtils.js +0 -64
  187. package/cli/utils/version.js +0 -26
  188. package/code-push.config.example.supabase.ts +0 -114
  189. package/code-push.config.js +0 -229
  190. package/code-push.config.ts +0 -175
  191. package/docs/api-android.md +0 -83
  192. package/docs/api-ios.md +0 -31
  193. package/docs/api-js.md +0 -592
  194. package/docs/multi-deployment-testing-android.md +0 -148
  195. package/docs/multi-deployment-testing-ios.md +0 -59
  196. package/docs/setup-android.md +0 -482
  197. package/docs/setup-ios.md +0 -280
  198. package/eslint.config.mjs +0 -32
  199. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
  200. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
  201. package/ios/CodePush/Base64/README.md +0 -47
  202. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
  203. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
  204. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
  205. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
  206. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
  207. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
  208. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
  209. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
  210. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
  211. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
  212. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
  213. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
  214. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
  215. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
  216. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
  217. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
  218. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
  219. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
  220. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
  221. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
  222. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
  223. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
  224. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
  225. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
  226. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
  227. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
  228. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
  229. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
  230. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
  231. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
  232. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
  233. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
  234. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
  235. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
  236. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
  237. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
  238. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
  239. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
  240. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
  241. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
  242. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
  243. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
  244. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
  245. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
  246. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
  247. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
  248. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
  249. package/ios/CodePush/JWT/LICENSE +0 -19
  250. package/ios/CodePush/JWT/README.md +0 -489
  251. package/ios/CodePush/SSZipArchive/Common.h +0 -81
  252. package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
  253. package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
  254. package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
  255. package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
  256. package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
  257. package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
  258. package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
  259. package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
  260. package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
  261. package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
  262. package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
  263. package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
  264. package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
  265. package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
  266. package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
  267. package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
  268. package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
  269. package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
  270. package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
  271. package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
  272. package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
  273. package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
  274. package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
  275. package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
  276. package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
  277. package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
  278. package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
  279. package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
  280. package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
  281. package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
  282. package/scripts/generateBundledResourcesHash.js +0 -125
  283. package/scripts/getFilesInFolder.js +0 -19
  284. package/scripts/recordFilesBeforeBundleCommand.js +0 -41
  285. package/tsconfig.json +0 -20
  286. package/tslint.json +0 -32
  287. /package/{logging.js → src/logging.js} +0 -0
  288. /package/{versioning → src/versioning}/BaseVersioning.test.js +0 -0
  289. /package/{versioning → src/versioning}/IncrementalVersioning.js +0 -0
  290. /package/{versioning → src/versioning}/IncrementalVersioning.test.js +0 -0
  291. /package/{versioning → src/versioning}/SemverVersioning.js +0 -0
  292. /package/{versioning → src/versioning}/index.js +0 -0
package/README.md CHANGED
@@ -1,738 +1,495 @@
1
- ## @algocare/react-native-code-push
1
+ # @algocare/react-native-code-push
2
2
 
3
- > `react-native-code-push`의 알고케어 커스텀 포크
4
- > AppCenter 없이 독립적인 CodePush 배포 시스템
3
+ > **알고케어 포크 (v13+)** — [Soomgo-Mobile/react-native-code-push](https://github.com/Soomgo-Mobile/react-native-code-push) v12.4.0 베이스. 12.6.x에서 올라오는 경우 [docs/migration-v13.ko.md](./docs/migration-v13.ko.md) 필독.
5
4
 
6
- ```bash
7
- npm install @algocare/react-native-code-push
8
- ```
9
-
10
- ---
5
+ ### Seamless Transition from AppCenter to a Fully Self-Hosted CodePush
11
6
 
12
- ## 🚀 빠른 시작 (5분 안에 설정 완료!)
7
+ - **No API Server Needed** – Use static hosting solutions (e.g., AWS S3) without maintaining additional API servers.
8
+ - **Familiar API** – Built on `microsoft/react-native-code-push`, ensuring compatibility and stability.
9
+ - **Flexible Deployment** – Implement your own release workflow, giving you complete control over the deployment process.
13
10
 
14
- ### 1단계: 패키지 설치
15
-
16
- ```bash
17
- npm install @algocare/react-native-code-push
18
- ```
11
+ ### 🚀 New Architecture support
19
12
 
20
- ### 2단계: 환경변수 설정
13
+ Supports React Native 0.77 ~ 0.84.
21
14
 
22
- #### B2C Home 프로젝트만 (`.env` 파일 사용)
15
+ > [!NOTE]
16
+ > If you are using React Native 0.76 or lower, please use version `12.0.2` of this library.
23
17
 
24
- `home-device`, `home-mobile` 프로젝트만 `.env` 파일 생성:
18
+ (Tested on the React Native CLI template apps)
25
19
 
26
- ```bash
27
- # AWS 자격 증명
28
- AWS_ACCESS_KEY_ID=your_aws_access_key_here
29
- AWS_SECRET_ACCESS_KEY=your_aws_secret_key_here
30
- AWS_REGION=ap-northeast-2
31
-
32
- # STG/PRD 환경별 설정
33
- AWS_S3_BUCKET_STG=your-stg-bucket-name
34
- AWS_S3_BUCKET_PRD=your-prd-bucket-name
35
- CDN_URL_STG=https://your-stg-cdn-url.com
36
- CDN_URL_PRD=https://your-prd-cdn-url.com
37
- ```
20
+ ### ✅ Requirements
38
21
 
39
- ⚠️ **실제 값은 내부에서 공유받으세요!**
22
+ - **React Native**: 0.77 or higher
23
+ - **iOS**: 15.5 or higher
24
+ - **Android**: API level 16 or higher
40
25
 
41
- #### B2B + B2C MVP (Infisical 사용)
26
+ ## 🚗 Migration Guide
42
27
 
43
- `user`, `device`, `b2c-device` 프로젝트는 Infisical 사용:
28
+ If you have been using `react-native-code-push`, replace the NPM package first.
44
29
 
45
30
  ```bash
46
- # Infisical에서 자동으로 .env 파일 생성
47
- yarn set:stg # STG 환경변수 로드
48
- yarn set:prd # PRD 환경변수 로드
31
+ npm remove react-native-code-push
32
+ npm install @bravemobile/react-native-code-push
49
33
  ```
50
34
 
51
- Infisical에 이미 모든 환경변수가 설정되어 있습니다.
35
+ 1. Edit `android/app/build.gradle` file to remove the `apply from: "../../node_modules/..../codepush.gradle"` line.
52
36
 
53
- ⚠️ **중요**: `.env` 파일을 `.gitignore`에 추가하세요!
54
-
55
- ```bash
56
- echo ".env" >> .gitignore
57
- ```
37
+ 2. The following changes are optional but recommended for cleaning up the old configuration:
38
+ - Since the deployment key is no longer needed due to the retirement of AppCenter, it is recommended to remove it from your `Info.plist`, `strings.xml`, or JavaScript code.
39
+ - Thanks to Auto Linking, you can remove the `react-native-code-push` module settings from `settings.gradle`.
58
40
 
59
- ### 3단계: package.json에 스크립트 추가
41
+ 3. Follow the installation guide starting from **'4. "CodePush-ify" your app'**.
60
42
 
61
- ```json
62
- {
63
- "scripts": {
64
- "codepush:release": "sh scripts/codepush.sh release",
65
- "codepush:release:prd": "sh scripts/codepush.sh release --env=prd",
66
- "codepush:show": "sh scripts/codepush.sh show",
67
- "codepush:show:prd": "sh scripts/codepush.sh show --env=prd"
68
- }
69
- }
70
- ```
71
43
 
72
- ### 4단계: 배포!
44
+ ## ⚙️ Installation
73
45
 
46
+ ### 1. Install NPM Package
74
47
  ```bash
75
- # Staging 환경에 배포
76
- npm run codepush:release
77
-
78
- # Production 환경에 배포
79
- npm run codepush:release:prd
80
- ```
81
-
82
- **끝!** 더 이상 추가 설정 파일이 필요 없습니다. 🎉
83
-
84
- ---
85
-
86
- ## 📱 지원하는 앱
87
-
88
- | 앱 이름 | 설명 | 플랫폼 | 환경 관리 |
89
- |---------|------|--------|----------|
90
- | `user` | B2B 모바일 앱 | iOS, Android | Infisical (STG/PRD) |
91
- | `device` | B2B 디바이스 앱 | Android | Infisical (STG/PRD) |
92
- | `b2c-device` | B2C MVP 디바이스 앱 | Android | Infisical (STG/PRD) |
93
- | `home-device` | B2C Home (상용) 디바이스 앱 | Android | .env 파일 (STG/PRD) |
94
- | `home-mobile` | B2C Home (상용) 모바일 앱 | iOS, Android | .env 파일 (STG/PRD) |
95
-
96
- > **모든 앱이 STG/PRD 환경을 구분합니다!**
97
- > - **B2B + B2C MVP**: Infisical로 환경변수 관리
98
- > - **B2C Home**: .env 파일로 환경변수 관리
99
-
100
- ---
101
-
102
- ## ⚙️ 작동 원리
103
-
104
- ### 환경 자동 선택
105
-
106
- 패키지가 자동으로 다음을 수행합니다:
107
-
108
- 1. `.env` 파일에서 AWS 자격증명 로드
109
- 2. `-i` 플래그로 환경 구분 (stg/prd)
110
- 3. 적절한 S3 버킷과 CDN URL 선택
111
- 4. 번들을 업로드하고 히스토리 관리
112
-
113
- ### 환경변수 우선순위
114
-
115
- ```javascript
116
- // STG 환경
117
- -i stg → AWS_S3_BUCKET_STG, CDN_URL_STG
118
-
119
- // PRD 환경
120
- -i prd → AWS_S3_BUCKET_PRD, CDN_URL_PRD
121
-
122
- // 레거시 호환성 (옵션)
123
- AWS_S3_BUCKET, CDN_URL // identifier 없이 사용 가능
48
+ npm install @bravemobile/react-native-code-push
124
49
  ```
125
50
 
126
- ---
51
+ ### 2. Run init command
127
52
 
128
- ## 🔧 상세 설정
53
+ For React Native CLI projects, you can use the automatic setup command to configure your project for CodePush.
129
54
 
130
- ### B2C Home 프로젝트 (`.env` 파일)
55
+ This command will automatically edit your `AppDelegate` and `MainApplication` files to integrate CodePush.
131
56
 
132
- **home-device, home-mobile**
133
-
134
- `.env` 파일:
135
57
  ```bash
136
- AWS_S3_BUCKET_STG=your-stg-bucket-name
137
- AWS_S3_BUCKET_PRD=your-prd-bucket-name
138
- CDN_URL_STG=https://your-stg-cdn-url.com
139
- CDN_URL_PRD=https://your-prd-cdn-url.com
58
+ npx code-push init
140
59
  ```
141
60
 
142
- 사용:
143
- ```bash
144
- npm run codepush:release # STG 배포
145
- npm run codepush:release:prd # PRD 배포
146
- ```
147
-
148
- ### B2B + B2C MVP (Infisical)
149
-
150
- **user, device, b2c-device**
61
+ And run the following command to install CocoaPods dependencies for iOS:
151
62
 
152
63
  ```bash
153
- # package.json 스크립트
154
- {
155
- "scripts": {
156
- "set:stg": "infisical export --env=stg > .env",
157
- "set:prd": "infisical export --env=prd > .env",
158
- "codepush:stg": "yarn set:stg && npx code-push release -i stg",
159
- "codepush:prd": "yarn set:prd && npx code-push release -i prd"
160
- }
161
- }
64
+ cd ios && pod install && cd ..
162
65
  ```
66
+ (or `npx pod-install`, `bundle exec pod install --project-directory=./ios`, ..)
163
67
 
164
- 사용:
165
- ```bash
166
- yarn codepush:stg # STG 배포
167
- yarn codepush:prd # PRD 배포
168
- ```
68
+ ### 2-1. Manual Setup
169
69
 
170
- ---
70
+ If you prefer manual setup or if the automatic configuration fails, you can follow the manual setup instructions below.
171
71
 
172
- ## 📝 예제 Scripts
72
+ <details><summary>Click to see the manual setup instructions.</summary>
73
+ <p>
173
74
 
174
- ### 기본 배포 스크립트 (`scripts/codepush.sh`)
75
+ ### iOS Manual Setup
175
76
 
176
- ```bash
177
- #!/bin/bash
178
-
179
- ENV="stg"
180
- COMMAND=""
181
- ADDITIONAL_ARGS="-a home-mobile -i $ENV"
182
-
183
- while [[ "$#" -gt 0 ]]; do
184
- case $1 in
185
- create|update|show|release) COMMAND="$1";;
186
- --env=*) ENV="${1#*=}"
187
- ADDITIONAL_ARGS="-a home-mobile -i $ENV"
188
- ;;
189
- *) ADDITIONAL_ARGS="$ADDITIONAL_ARGS $1";;
190
- esac
191
- shift
192
- done
193
-
194
- if [ "$COMMAND" = "release" ]; then
195
- npx code-push release $ADDITIONAL_ARGS
196
- else
197
- npx code-push $COMMAND-history $ADDITIONAL_ARGS
198
- fi
199
- ```
200
-
201
- ---
77
+ #### (1) Install CocoaPods Dependencies
202
78
 
203
- ## 🆚 기존 방식과의 차이
79
+ Run `cd ios && pod install && cd ..`
204
80
 
205
- ### 기존 방식 (복잡함)
81
+ (`npx pod-install`, `bundle exec pod install --project-directory=./ios`, ..)
206
82
 
207
- 1. 프로젝트마다 `code-push.config.js` 파일 생성
208
- 2. AWS 키 하드코딩 (보안 위험)
209
- 3. `postinstall` 스크립트로 파일 복사
210
- 4. 환경별로 다른 설정 파일 관리
211
83
 
212
- ### 새로운 방식 (간단함)
84
+ #### (2) Edit `AppDelegate` Code
213
85
 
214
- 1. `.env` 파일 하나만 생성
215
- 2. AWS 키 안전하게 관리
216
- 3. 추가 설정 파일 불필요
217
- 4. 환경변수로 자동 전환
86
+ **If you have `AppDelegate.swift` (>= RN 0.77)**
218
87
 
219
- ---
220
88
 
221
- ## 🔍 트러블슈팅
89
+ <details><summary>If your project doesn't have bridging header, please create a file.</summary>
90
+ <p>
222
91
 
223
- ### CodePush 실행 "AWS credentials not found" 에러
92
+ 1. Open your project with Xcode (e.g. CodePushDemoApp.xcworkspace)
93
+ 2. File → New → File from Template
94
+ 3. Select 'Objective-C File' and click 'Next' and write any name as you like.
95
+ 4. Then Xcode will ask you to create a bridging header file. Click 'Create'.
96
+ 5. Delete the file created in step 3.
224
97
 
225
- **원인**: `.env` 파일이 없거나 환경변수가 설정되지 않음
98
+ </p>
99
+ </details>
226
100
 
227
- **해결**:
228
- ```bash
229
- # .env 파일 확인
230
- cat .env
231
101
 
232
- # 환경변수 설정 확인
233
- echo $AWS_ACCESS_KEY_ID
102
+ Add the following line to the bridging header file. (e.g. `CodePushDemoApp-Bridging-Header.h`)
103
+ ```diff
104
+ + #import <CodePush/CodePush.h>
234
105
  ```
235
106
 
236
- ### S3 업로드 실패 (403 Forbidden)
237
-
238
- **원인**: AWS 자격증명이 잘못되었거나 권한 부족
239
-
240
- **해결**:
241
- 1. `.env` 파일의 AWS 확인
242
- 2. IAM 사용자 권한 확인 (S3 PutObject 필요)
243
-
244
- ### 잘못된 환경에 배포됨
245
-
246
- **원인**: `-i` 플래그를 잘못 지정
247
-
248
- **해결**:
249
- ```bash
250
- # STG 배포
251
- npm run codepush:release # -i stg (기본값)
252
-
253
- # PRD 배포
254
- npm run codepush:release:prd # -i prd
107
+ Then, edit `AppDelegate.swift` like below.
108
+
109
+ ```diff
110
+ @main
111
+ class AppDelegate: RCTAppDelegate {
112
+ override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
113
+
114
+ // ...
115
+
116
+ override func bundleURL() -> URL? {
117
+ #if DEBUG
118
+ RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
119
+ #else
120
+ - Bundle.main.url(forResource: "main", withExtension: "jsbundle")
121
+ + CodePush.bundleURL()
122
+ #endif
123
+ }
124
+ }
255
125
  ```
256
126
 
257
- ---
258
-
259
- ### Self-host the update bundle file
260
127
 
261
- Specify the host and path using the `bundleHost` option.
128
+ **Or if you have `AppDelegate.mm`**
129
+
130
+ ```diff
131
+ + #import <CodePush/CodePush.h>
132
+
133
+ // ...
134
+
135
+ - (NSURL *)bundleURL
136
+ {
137
+ #if DEBUG
138
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
139
+ #else
140
+ - return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
141
+ + return [CodePush bundleURL];
142
+ #endif
143
+ }
144
+
145
+ @end
262
146
 
263
- Upload the code-push bundle file to your server. The file name should be exactly same as the file on AppCenter.
147
+ ```
264
148
 
265
- ```javascript
266
- const codePushOptions = {
267
- bundlehost: 'https://cdn.yours.com/codepush/bundle/',
268
- }
269
149
 
270
- export default codePush(codePushOptions)(MyApp)
271
- ```
150
+ ### Android Manual Setup
272
151
 
273
- ### Customize the update check behavior
152
+ #### Edit `MainApplication` Code
274
153
 
275
- Specify a function to perform the update check using the `updateChecker` option.
154
+ **(RN 0.82+) If you have `MainApplication.kt`**
276
155
 
277
- (The `bundleHost` option can be used in combination.)
156
+ ```diff
157
+ + import com.microsoft.codepush.react.CodePush
278
158
 
279
- ```javascript
280
- const codePushOptions = {
281
- updateChecker: async (updateCheckRequest) => {
282
- // It's up to you to decide what to do.
283
- // However, you need to have a good understanding of Code Push's interface to configure your response.
284
- const { data: response } = await axios.get(
285
- 'https://your.api.com/update_check',
286
- {
287
- params: { app_version: updateCheckRequest.app_version },
288
- }
289
- )
290
- return response
291
- },
159
+ class MainApplication : Application(), ReactApplication {
160
+ override val reactHost: ReactHost by lazy {
161
+ getDefaultReactHost(
162
+ context = applicationContext,
163
+ packageList =
164
+ PackageList(this).packages.apply {
165
+ // Packages that cannot be autolinked yet can be added manually here, for example:
166
+ // add(MyReactNativePackage())
167
+ },
168
+ + jsBundleFilePath = CodePush.getJSBundleFile(),
169
+ )
170
+ }
171
+ // ...
292
172
  }
293
-
294
- export default codePush(codePushOptions)(MyApp)
295
173
  ```
296
174
 
297
- ## Original README.md is below.
298
-
299
- ---
175
+ **(RN 0.73+) If you have `MainApplication.kt`**
300
176
 
301
- [![appcenterbanner](https://user-images.githubusercontent.com/31293287/32969262-3cc5d48a-cb99-11e7-91bf-fa57c67a371c.png)](http://microsoft.github.io/code-push/)
177
+ ```diff
178
+ + import com.microsoft.codepush.react.CodePush
302
179
 
303
- #### [Sign up With App Center](https://appcenter.ms/signup?utm_source=CodePush&utm_medium=Azure) to use CodePush
180
+ class MainApplication : Application(), ReactApplication {
181
+ override val reactNativeHost: ReactNativeHost =
182
+ object : DefaultReactNativeHost(this) {
304
183
 
305
- # React Native Module for CodePush
184
+ // ...
306
185
 
307
- _Note: This README is only relevant to the latest version of our plugin. If you are using an older version, please switch to the relevant tag on [our GitHub repo](https://github.com/microsoft/react-native-code-push) to view the docs for that particular version._
308
-
309
- ![Switching tags](https://user-images.githubusercontent.com/42337914/57237511-0835de80-7030-11e9-88fa-64eb200478d0.png)
310
-
311
- This plugin provides client-side integration for the [CodePush service](https://microsoft.github.io/code-push/), allowing you to easily add a dynamic update experience to your React Native app(s).
312
-
313
- <!-- React Native Catalog -->
314
-
315
- - [How does it work?](#how-does-it-work)
316
- - [Supported React Native Platforms](#supported-react-native-platforms)
317
- - [Supported Components](#supported-components)
318
- - [Getting Started](#getting-started)
319
- - [iOS Setup](docs/setup-ios.md)
320
- - [Android Setup](docs/setup-android.md)
321
- - [Plugin Usage](#plugin-usage)
322
- - [Store Guideline Compliance](#store-guideline-compliance)
323
- - [Releasing Updates](#releasing-updates)
324
- - [Multi-Deployment Testing](#multi-deployment-testing)
325
- - [Android](docs/multi-deployment-testing-android.md)
326
- - [iOS](docs/multi-deployment-testing-ios.md)
327
- - [Dynamic Deployment Assignment](#dynamic-deployment-assignment)
328
- - [API Reference](#api-reference)
329
- - [JavaScript API](docs/api-js.md)
330
- - [Objective-C API Reference (iOS)](docs/api-ios.md)
331
- - [Java API Reference (Android)](docs/api-android.md)
332
- - [Debugging / Troubleshooting](#debugging--troubleshooting)
333
- - [Example Apps / Starters](#example-apps--starters)
334
- - [Continuous Integration / Delivery](#continuous-integration--delivery)
335
- - [TypeScript Consumption](#typescript-consumption)
336
-
337
- <!-- React Native Catalog -->
338
-
339
- ## How does it work?
340
-
341
- A React Native app is composed of JavaScript files and any accompanying [images](https://reactnative.dev/docs/image), which are bundled together by the [metro bundler](https://github.com/facebook/metro) and distributed as part of a platform-specific binary (i.e. an `.ipa` or `.apk` file). Once the app is released, updating either the JavaScript code (e.g. making bug fixes, adding new features) or image assets, requires you to recompile and redistribute the entire binary, which of course, includes any review time associated with the store(s) you are publishing to.
342
-
343
- The CodePush plugin helps get product improvements in front of your end users instantly, by keeping your JavaScript and images synchronized with updates you release to the CodePush server. This way, your app gets the benefits of an offline mobile experience, as well as the "web-like" agility of side-loading updates as soon as they are available. It's a win-win!
344
-
345
- In order to ensure that your end users always have a functioning version of your app, the CodePush plugin maintains a copy of the previous update, so that in the event that you accidentally push an update which includes a crash, it can automatically roll back. This way, you can rest assured that your newfound release agility won't result in users becoming blocked before you have a chance to [roll back](https://docs.microsoft.com/en-us/appcenter/distribution/codepush/cli#rolling-back-updates) on the server. It's a win-win-win!
346
-
347
- _Note: Any product changes which touch native code (e.g. modifying your `AppDelegate.m`/`MainActivity.java` file, adding a new plugin) cannot be distributed via CodePush, and therefore, must be updated via the appropriate store(s)._
348
-
349
- ## Supported React Native platforms
350
-
351
- - iOS (7+)
352
- - Android (4.1+) on TLS 1.2 compatible devices
353
-
354
- We try our best to maintain backwards compatibility of our plugin with previous versions of React Native, but due to the nature of the platform, and the existence of breaking changes between releases, it is possible that you need to use a specific version of the CodePush plugin in order to support the exact version of React Native you are using. The following table outlines which CodePush plugin versions officially support the respective React Native versions:
355
-
356
- | React Native version(s) | Supporting CodePush version(s) |
357
- | ----------------------- | ------------------------------------------------------ |
358
- | <0.14 | **Unsupported** |
359
- | v0.14 | v1.3 _(introduced Android support)_ |
360
- | v0.15-v0.18 | v1.4-v1.6 _(introduced iOS asset support)_ |
361
- | v0.19-v0.28 | v1.7-v1.17 _(introduced Android asset support)_ |
362
- | v0.29-v0.30 | v1.13-v1.17 _(RN refactored native hosting code)_ |
363
- | v0.31-v0.33 | v1.14.6-v1.17 _(RN refactored native hosting code)_ |
364
- | v0.34-v0.35 | v1.15-v1.17 _(RN refactored native hosting code)_ |
365
- | v0.36-v0.39 | v1.16-v1.17 _(RN refactored resume handler)_ |
366
- | v0.40-v0.42 | v1.17 _(RN refactored iOS header files)_ |
367
- | v0.43-v0.44 | v2.0+ _(RN refactored uimanager dependencies)_ |
368
- | v0.45 | v3.0+ _(RN refactored instance manager code)_ |
369
- | v0.46 | v4.0+ _(RN refactored js bundle loader code)_ |
370
- | v0.46-v0.53 | v5.1+ _(RN removed unused registration of JS modules)_ |
371
- | v0.54-v0.55 | v5.3+ _(Android Gradle Plugin 3.x integration)_ |
372
- | v0.56-v0.58 | v5.4+ _(RN upgraded versions for Android tools)_ |
373
- | v0.59 | v5.6+ _(RN refactored js bundle loader code)_ |
374
- | v0.60-v0.61 | v6.0+ _(RN migrated to Autolinking)_ |
375
- | v0.62-v0.64 | v6.2+ _(RN removed LiveReload)_ |
376
- | v0.65-v0.70 | v7.0+ _(RN updated iPhone-target-version)_ |
377
- | v0.71 | v8.0+ _(RN moved to react-native-gradle-plugin)_ |
186
+ + override fun getJSBundleFile(): String = CodePush.getJSBundleFile()
187
+ }
188
+ // ...
189
+ }
190
+ ```
378
191
 
379
- _NOTE: `react-native-code-push` versions lower than **[v5.7.0](https://github.com/microsoft/react-native-code-push/releases/tag/v5.7.0)** will stop working in the near future. You can find more information in our [documentation](https://github.com/microsoft/code-push/blob/master/migration-notice.md)._
380
192
 
381
- We work hard to respond to new RN releases, but they do occasionally break us. We will update this chart with each RN release, so that users can check to see what our "official" support is.
193
+ **Or if you have `MainApplication.java`**
382
194
 
383
- ### Supported Components
195
+ ```diff
196
+ // ...
197
+ + import com.microsoft.codepush.react.CodePush
384
198
 
385
- When using the React Native assets system (i.e. using the `require("./foo.png")` syntax), the following list represents the set of core components (and props) that support having their referenced images and videos updated via CodePush:
199
+ public class MainApplication extends Application implements ReactApplication {
386
200
 
387
- | Component | Prop(s) |
388
- | ------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------- |
389
- | `Image` | `source` |
390
- | `MapView.Marker` <br />_(Requires [react-native-maps](https://github.com/lelandrichardson/react-native-maps) `>=O.3.2`)_ | `image` |
391
- | `ProgressViewIOS` | `progressImage`, `trackImage` |
392
- | `TabBarIOS.Item` | `icon`, `selectedIcon` |
393
- | `ToolbarAndroid` <br />_(React Native 0.21.0+)_ | `actions[].icon`, `logo`, `overflowIcon` |
394
- | `Video` | `source` |
201
+ private final ReactNativeHost mReactNativeHost =
202
+ new DefaultReactNativeHost(this) {
395
203
 
396
- The following list represents the set of components (and props) that don't currently support their assets being updated via CodePush, due to their dependency on static images and videos (i.e. using the `{ uri: "foo" }` syntax):
204
+ // ...
205
+
206
+ + @Override
207
+ + override fun getJSBundleFile(): String {
208
+ + return CodePush.getJSBundleFile()
209
+ + }
210
+ };
211
+ // ...
212
+ }
213
+ ```
397
214
 
398
- | Component | Prop(s) |
399
- | ----------- | -------------------------------------------------------------------- |
400
- | `SliderIOS` | `maximumTrackImage`, `minimumTrackImage`, `thumbImage`, `trackImage` |
401
- | `Video` | `source` |
215
+ </p>
216
+ </details>
402
217
 
403
- As new core components are released, which support referencing assets, we'll update this list to ensure users know what exactly they can expect to update using CodePush.
404
218
 
405
- _Note: CodePush only works with Video components when using `require` in the source prop. For example:_
219
+ ### 3. Expo Setup
220
+ For Expo projects, you can use the automated config plugin instead of manual setup.
406
221
 
407
- ```javascript
408
- <Video source={require('./foo.mp4')} />
222
+ **Add plugin to your Expo configuration:**
223
+ ```js
224
+ // app.config.js
225
+ export default {
226
+ expo: {
227
+ plugins: ["@bravemobile/react-native-code-push"],
228
+ },
229
+ };
409
230
  ```
410
231
 
411
- ## Getting Started
412
-
413
- Once you've followed the general-purpose ["getting started"](https://docs.microsoft.com/en-us/appcenter/distribution/codepush/index) instructions for setting up your CodePush account, you can start CodePush-ifying your React Native app by running the following command from within your app's root directory:
414
-
415
- ```shell
416
- npm install --save react-native-code-push
232
+ **Run prebuild to apply changes:**
233
+ ```bash
234
+ npx expo prebuild
417
235
  ```
418
236
 
419
- As with all other React Native plugins, the integration experience is different for iOS and Android, so perform the following setup steps depending on which platform(s) you are targeting. Note, if you are targeting both platforms it is recommended to create separate CodePush applications for each platform.
420
-
421
- If you want to see how other projects have integrated with CodePush, you can check out the excellent [example apps](#example-apps--starters) provided by the community. Additionally, if you'd like to quickly familiarize yourself with CodePush + React Native, you can check out the awesome getting started videos produced by [Bilal Budhani](https://www.youtube.com/watch?v=uN0FRWk-YW8&feature=youtu.be) and/or [Deepak Sisodiya ](https://www.youtube.com/watch?v=f6I9y7V-Ibk).
422
-
423
- _NOTE: This guide assumes you have used the `react-native init` command to initialize your React Native project. As of March 2017, the command `create-react-native-app` can also be used to initialize a React Native project. If using this command, please run `npm run eject` in your project's home directory to get a project very similar to what `react-native init` would have created._
424
-
425
- Then continue with installing the native module
426
-
427
- - [iOS Setup](docs/setup-ios.md)
428
- - [Android Setup](docs/setup-android.md)
429
-
430
- ## Plugin Usage
431
-
432
- With the CodePush plugin downloaded and linked, and your app asking CodePush where to get the right JS bundle from, the only thing left is to add the necessary code to your app to control the following policies:
237
+ > [!NOTE]
238
+ > The plugin automatically handles all native iOS and Android code modifications. No manual editing of AppDelegate, MainApplication, or gradle files is required.
433
239
 
434
- 1. When (and how often) to check for an update? (for example app start, in response to clicking a button in a settings page, periodically at some fixed interval)
240
+ **Requirements**
241
+ Expo SDK: 50.0.0 or higher
435
242
 
436
- 2. When an update is available, how to present it to the end user?
437
243
 
438
- The simplest way to do this is to "CodePush-ify" your app's root component. To do so, you can choose one of the following two options:
244
+ ### 4. "CodePush-ify" Your App
439
245
 
440
- - **Option 1: Wrap your root component with the `codePush` higher-order component:**
246
+ The root component of your app should be wrapped with a higher-order component.
441
247
 
442
- - For class component
248
+ You should also pass configuration options, including the implementation of the `releaseHistoryFetcher` function.
249
+ This function is used to find the latest CodePush update within the `ReleaseHistoryInterface` data.
443
250
 
444
- ```javascript
445
- import codePush from 'react-native-code-push'
251
+ To enable this, you need to create a release history using the CLI tool and upload it to the remote.
252
+ (The following steps explain more about the CLI.)
446
253
 
447
- class MyApp extends Component {}
254
+ At runtime, the library fetches this information to keep the app up to date.
448
255
 
449
- MyApp = codePush(MyApp)
450
- ```
256
+ ```typescript
257
+ import CodePush, {
258
+ ReleaseHistoryInterface,
259
+ UpdateCheckRequest,
260
+ } from "@bravemobile/react-native-code-push";
451
261
 
452
- - For functional component
262
+ // ... MyApp Component
453
263
 
454
- ```javascript
455
- import codePush from 'react-native-code-push'
264
+ async function releaseHistoryFetcher(
265
+ updateRequest: UpdateCheckRequest,
266
+ ): Promise<ReleaseHistoryInterface> {
456
267
 
457
- let MyApp: () => React$Node = () => {}
268
+ // Fetch release history for current binary app version.
269
+ // You can implement how to fetch the release history freely. (Refer to the example app if you need a guide)
458
270
 
459
- MyApp = codePush(MyApp)
460
- ```
461
-
462
- - **Option 2: Use the [ES7 decorator](https://github.com/wycats/javascript-decorators) syntax:**
463
-
464
- _NOTE: Decorators are not yet supported in Babel 6.x pending proposal update._ You may need to enable it by installing and using [babel-preset-react-native-stage-0](https://github.com/skevy/babel-preset-react-native-stage-0#babel-preset-react-native-stage-0).
465
-
466
- - For class component
467
-
468
- ```javascript
469
- import codePush from 'react-native-code-push'
271
+ const {data: releaseHistory} = await axios.get<ReleaseHistoryInterface>(
272
+ `https://your.cdn.com/histories/${platform}/${identifier}/${updateRequest.app_version}.json`,
273
+ );
274
+ return releaseHistory;
275
+ }
470
276
 
471
- @codePush
472
- class MyApp extends Component {}
473
- ```
277
+ export default CodePush({
278
+ checkFrequency: CodePush.CheckFrequency.MANUAL, // or something else
279
+ releaseHistoryFetcher: releaseHistoryFetcher,
280
+ })(MyApp);
474
281
 
475
- - For functional component
282
+ ```
476
283
 
477
- ```javascript
478
- import codePush from 'react-native-code-push'
284
+ > [!NOTE]
285
+ > The URL for fetching the release history should point to the resource location generated by the CLI tool.
479
286
 
480
- const MyApp: () => React$Node = () => {}
481
287
 
482
- export default codePush(MyApp)
483
- ```
288
+ #### 4-1. Telemetry Callbacks
484
289
 
485
- By default, CodePush will check for updates on every app start. If an update is available, it will be silently downloaded, and installed the next time the app is restarted (either explicitly by the end user or by the OS), which ensures the least invasive experience for your end users. If an available update is mandatory, then it will be installed immediately, ensuring that the end user gets it as soon as possible.
290
+ Please refer to the [CodePushOptions](https://github.com/Soomgo-Mobile/react-native-code-push/blob/f0d26f7614af41c6dd4daecd9f7146e2383b2b0d/typings/react-native-code-push.d.ts#L76-L95) type for more details.
291
+ - **onUpdateSuccess:** Triggered when the update bundle is executed successfully.
292
+ - **onUpdateRollback:** Triggered when there is an issue executing the update bundle, leading to a rollback.
293
+ - **onDownloadStart:** Triggered when the bundle download begins.
294
+ - **onDownloadSuccess:** Triggered when the bundle download completes successfully.
295
+ - **onSyncError:** Triggered when an unknown error occurs during the update process. (`CodePush.SyncStatus.UNKNOWN_ERROR` status)
486
296
 
487
- If you would like your app to discover updates more quickly, you can also choose to sync up with the CodePush server every time the app resumes from the background.
488
297
 
489
- - For class component
298
+ ### 5. Configure the CLI Tool
490
299
 
491
- ```javascript
492
- let codePushOptions = {
493
- checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
494
- }
300
+ > [!TIP]
301
+ > For a more detailed and practical example, refer to the `CodePushDemoApp` in `example` directory. ([link](https://github.com/Soomgo-Mobile/react-native-code-push/tree/master/Examples/CodePushDemoApp))
495
302
 
496
- class MyApp extends Component {}
303
+ **(1) Create a `code-push.config.ts` file in the root directory of your project.**
497
304
 
498
- MyApp = codePush(codePushOptions)(MyApp)
499
- ```
305
+ Then, implement three functions to upload the bundle file and create/update the release history.
306
+ The CLI tool uses these functions to release CodePush updates and manage releases.
307
+ (These functions are not used at runtime by the library.)
500
308
 
501
- - For functional component
309
+ You can copy and paste the following code and modify it as needed.
502
310
 
503
- ```javascript
504
- let codePushOptions = {
505
- checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
506
- }
311
+ ```typescript
312
+ import {
313
+ CliConfigInterface,
314
+ ReleaseHistoryInterface,
315
+ } from "@bravemobile/react-native-code-push";
507
316
 
508
- let MyApp: () => React$Node = () => {}
317
+ const Config: CliConfigInterface = {
318
+ bundleUploader: async (
319
+ source: string,
320
+ platform: "ios" | "android",
321
+ identifier,
322
+ ): Promise<{downloadUrl: string}> => {
323
+ // ...
324
+ },
509
325
 
510
- MyApp = codePush(codePushOptions)(MyApp)
511
- ```
326
+ getReleaseHistory: async (
327
+ targetBinaryVersion: string,
328
+ platform: "ios" | "android",
329
+ identifier,
330
+ ): Promise<ReleaseHistoryInterface> => {
331
+ // ...
332
+ },
512
333
 
513
- Alternatively, if you want fine-grained control over when the check happens (like a button press or timer interval), you can call [`CodePush.sync()`](docs/api-js.md#codepushsync) at any time with your desired `SyncOptions`, and optionally turn off CodePush's automatic checking by specifying a manual `checkFrequency`:
334
+ setReleaseHistory: async (
335
+ targetBinaryVersion: string,
336
+ jsonFilePath: string,
337
+ releaseInfo: ReleaseHistoryInterface,
338
+ platform: "ios" | "android",
339
+ identifier,
340
+ ): Promise<void> => {
341
+ // ...
342
+ },
343
+ };
514
344
 
515
- ```javascript
516
- let codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL }
345
+ module.exports = Config;
517
346
 
518
- class MyApp extends Component {
519
- onButtonPress() {
520
- codePush.sync({
521
- updateDialog: true,
522
- installMode: codePush.InstallMode.IMMEDIATE,
523
- })
524
- }
347
+ ```
525
348
 
526
- render() {
527
- return (
528
- <View>
529
- <TouchableOpacity onPress={this.onButtonPress}>
530
- <Text>Check for updates</Text>
531
- </TouchableOpacity>
532
- </View>
533
- )
349
+ **`bundleUploader`**
350
+ - Implements a function to upload the bundle file.
351
+ - The `downloadUrl` returned by this function is recorded in `ReleaseHistoryInterface` data
352
+ and is used by the library runtime to download the bundle file from this URL.
353
+ - Used in the following cases:
354
+ - Creating a new CodePush update with the `release` command.
355
+
356
+
357
+ **`getReleaseHistory`**
358
+ - Retrieves the release history of a specific binary app by fetching a JSON file or calling an API.
359
+ - Used in the following cases:
360
+ - Printing the release history with the `show-history` command.
361
+ - Loading existing release history during the `release` command.
362
+ - Fetching release history to modify information in the `update-history` command.
363
+
364
+ (Similar to the `releaseHistoryFetcher` function in the library runtime options.)
365
+
366
+
367
+ **`setReleaseHistory`**
368
+ - Uploads a JSON file located at `jsonFilePath` or calls an API using `releaseInfo` metadata.
369
+ - If using a JSON file, **modifying the existing file should be allowed.**
370
+ (Overwriting the file is recommended.)
371
+ - Used in the following cases:
372
+ - Creating a new release record for a new binary build with the `create-history` command.
373
+ - Appending a new record to an existing release history with the `release` command.
374
+ - Modifying an existing release history with the `update-history` command.
375
+
376
+
377
+ **(2) For `code-push.config.ts` (TypeScript) to work properly, you may need to update your `tsconfig.json`.**
378
+
379
+ ```diff
380
+ {
381
+ "extends": "@react-native/typescript-config/tsconfig.json",
382
+ // ...
383
+ "include": [
384
+ // ...
385
+ + "code-push.config.ts"
386
+ ],
387
+ + "ts-node": {
388
+ + "compilerOptions": {
389
+ + "module": "CommonJS",
390
+ + "types": ["node"]
391
+ + }
392
+ + }
534
393
  }
535
- }
536
394
 
537
- MyApp = codePush(codePushOptions)(MyApp)
538
395
  ```
539
396
 
540
- If you would like to display an update confirmation dialog (an "active install"), configure when an available update is installed (like force an immediate restart) or customize the update experience in any other way, refer to the [`codePush()`](docs/api-js.md#codepush) API reference for information on how to tweak this default behavior.
541
-
542
- _NOTE: If you are using [Redux](http://redux.js.org) and [Redux Saga](https://redux-saga.js.org/), you can alternatively use the [react-native-code-push-saga](http://github.com/lostintangent/react-native-code-push-saga) module, which allows you to customize when `sync` is called in a perhaps simpler/more idiomatic way._
543
-
544
- ### Store Guideline Compliance
545
-
546
- Android Google Play and iOS App Store have corresponding guidelines that have rules you should be aware of before integrating the CodePush solution within your application.
547
-
548
- #### Google play
549
-
550
- Third paragraph of [Device and Network Abuse](https://support.google.com/googleplay/android-developer/answer/9888379?hl=en) topic describe that updating source code by any method other than Google Play's update mechanism is restricted. But this restriction does not apply to updating javascript bundles.
551
-
552
- > This restriction does not apply to code that runs in a virtual machine and has limited access to Android APIs (such as JavaScript in a webview or browser).
553
397
 
554
- That fully allow CodePush as it updates just JS bundles and can't update native code part.
398
+ ## 🚀 CLI Tool Usage
555
399
 
556
- #### App Store
400
+ > [!TIP]
401
+ > You can use `--help` command to see the available commands and options.
402
+ >
403
+ > For detailed documentation, see the [CLI README](cli/README.md) ([한국어](cli/README.ko.md)).
557
404
 
558
- Paragraph **3.3.2**, since back in 2015's [Apple Developer Program License Agreement](https://developer.apple.com/programs/ios/information/) fully allowed performing over-the-air updates of JavaScript and assets - and in its latest version (20170605) [downloadable here](https://developer.apple.com/terms/) this ruling is even broader:
405
+ (interactive mode not supported yet)
559
406
 
560
- > Interpreted code may be downloaded to an Application but only so long as such code: (a) does not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application as submitted to the App Store, (b) does not create a store or storefront for other code or applications, and (c) does not bypass signing, sandbox, or other security features of the OS.
407
+ ### Commands
561
408
 
562
- CodePush allows you to follow these rules in full compliance so long as the update you push does not significantly deviate your product from its original App Store approved intent.
563
409
 
564
- To further remain in compliance with Apple's guidelines we suggest that App Store-distributed apps don't enable the `updateDialog` option when calling `sync`, since in the [App Store Review Guidelines](https://developer.apple.com/app-store/review/guidelines/) it is written that:
410
+ #### `create-history`
565
411
 
566
- > Apps must not force users to rate the app, review the app, download other apps, or other similar actions in order to access functionality, content, or use of the app.
412
+ Create a new release history for a specific binary app version.
413
+ - Use this command whenever you release a new binary app to the app store.
414
+ This ensures that the library runtime recognizes the binary app as the latest version and determines that no CodePush update is available for it.
567
415
 
568
- This is not necessarily the case for `updateDialog`, since it won't force the user to download the new version, but at least you should be aware of that ruling if you decide to show it.
416
+ **Example:**
417
+ - Create a new release history for the binary app version `1.0.0`.
569
418
 
570
- ## Releasing Updates
571
-
572
- Once your app is configured and distributed to your users, and you have made some JS or asset changes, it's time to release them. The recommended way to release them is using the `release-react` command in the App Center CLI, which will bundle your JavaScript files, asset files, and release the update to the CodePush server.
573
-
574
- _NOTE: Before you can start releasing updates, please log into App Center by running the `appcenter login` command._
575
-
576
- In its most basic form, this command only requires one parameter: your owner name + "/" + app name.
577
-
578
- ```shell
579
- appcenter codepush release-react -a <ownerName>/<appName>
580
-
581
- appcenter codepush release-react -a <ownerName>/MyApp-iOS
582
- appcenter codepush release-react -a <ownerName>/MyApp-Android
419
+ ```bash
420
+ npx code-push create-history --binary-version 1.0.0 --platform ios --identifier staging
583
421
  ```
584
422
 
585
- The `release-react` command enables such a simple workflow because it provides many sensible defaults (like generating a release bundle, assuming your app's entry file on iOS is either `index.ios.js` or `index.js`). However, all of these defaults can be customized to allow incremental flexibility as necessary, which makes it a good fit for most scenarios.
586
-
587
- ```shell
588
- # Release a mandatory update with a changelog
589
- appcenter codepush release-react -a <ownerName>/MyApp-iOS -m --description "Modified the header color"
423
+ #### `show-history`
590
424
 
591
- # Release an update for an app that uses a non-standard entry file name, and also capture
592
- # the sourcemap file generated by react-native bundle
593
- appcenter codepush release-react -a <ownerName>/MyApp-iOS --entry-file MyApp.js --sourcemap-output ../maps/MyApp.map
425
+ Display the release history for a specific binary app version.
594
426
 
595
- # Release a dev Android build to just 1/4 of your end users
596
- appcenter codepush release-react -a <ownerName>/MyApp-Android --rollout 25 --development true
597
427
 
598
- # Release an update that targets users running any 1.1.* binary, as opposed to
599
- # limiting the update to exact version name in the build.gradle file
600
- appcenter codepush release-react -a <ownerName>/MyApp-Android --target-binary-version "~1.1.0"
428
+ **Example:**
429
+ - Show the release history for the binary app version `1.0.0`.
601
430
 
431
+ ```bash
432
+ npx code-push show-history --binary-version 1.0.0 --platform ios --identifier staging
602
433
  ```
603
434
 
604
- The CodePush client supports differential updates, so even though you are releasing your JS bundle and assets on every update, your end users will only actually download the files they need. The service handles this automatically so that you can focus on creating awesome apps and we can worry about optimizing end user downloads.
605
-
606
- For more details about how the `release-react` command works, as well as the various parameters it exposes, refer to the [CLI docs](https://github.com/microsoft/code-push/tree/v3.0.1/cli#releasing-updates-react-native). Additionally, if you would prefer to handle running the `react-native bundle` command yourself, and therefore, want an even more flexible solution than `release-react`, refer to the [`release` command](https://github.com/microsoft/code-push/tree/v3.0.1/cli#releasing-updates-general) for more details.
607
-
608
- If you run into any issues, or have any questions/comments/feedback, you can ping us within the [#code-push](https://discord.gg/0ZcbPKXt5bWxFdFu) channel on Reactiflux, [e-mail us](mailto:codepushfeed@microsoft.com) and/or check out the [troubleshooting](#debugging--troubleshooting) details below.
435
+ #### `release`
609
436
 
610
- _NOTE: CodePush updates should be tested in modes other than Debug mode. In Debug mode, React Native app always downloads JS bundle generated by packager, so JS bundle downloaded by CodePush does not apply._
437
+ Release a CodePush update for a specific binary app version.
438
+ - This command creates a CodePush bundle file, uploads it, and updates the release history with the new release information.
611
439
 
612
- ### Multi-Deployment Testing
440
+ **Example:**
441
+ - Release a CodePush update `1.0.1` targeting the binary app version `1.0.0`.
613
442
 
614
- In our [getting started](#getting-started) docs, we illustrated how to configure the CodePush plugin using a specific deployment key. However, in order to effectively test your releases, it is critical that you leverage the `Staging` and `Production` deployments that are auto-generated when you first created your CodePush app (or any custom deployments you may have created). This way, you never release an update to your end users that you haven't been able to validate yourself.
615
-
616
- _NOTE: Our client-side rollback feature can help unblock users after installing a release that resulted in a crash, and server-side rollbacks (i.e. `appcenter codepush rollback`) allow you to prevent additional users from installing a bad release once it's been identified. However, it's obviously better if you can prevent an erroneous update from being broadly released in the first place._
617
-
618
- Taking advantage of the `Staging` and `Production` deployments allows you to achieve a workflow like the following (feel free to customize!):
619
-
620
- 1. Release a CodePush update to your `Staging` deployment using the `appcenter codepush release-react` command (or `appcenter codepush release` if you need more control)
621
-
622
- 2. Run your staging/beta build of your app, sync the update from the server, and verify it works as expected
623
-
624
- 3. Promote the tested release from `Staging` to `Production` using the `appcenter codepush promote` command
625
-
626
- 4. Run your production/release build of your app, sync the update from the server and verify it works as expected
627
-
628
- _NOTE: If you want to take a more cautious approach, you can even choose to perform a "staged rollout" as part of #3, which allows you to mitigate additional potential risk with the update (like did your testing in #2 touch all possible devices/conditions?) by only making the production update available to a percentage of your users (for example `appcenter codepush promote -a <ownerName>/<appName> -s Staging -d Production -r 20`). Then, after waiting for a reasonable amount of time to see if any crash reports or customer feedback comes in, you can expand it to your entire audience by running `appcenter codepush patch -a <ownerName>/<appName> Production -r 100`._
629
-
630
- You'll notice that the above steps refer to a "staging build" and "production build" of your app. If your build process already generates distinct binaries per "environment", then you don't need to read any further, since swapping out CodePush deployment keys is just like handling environment-specific config for any other service your app uses (like Facebook). However, if you're looking for examples (**including demo projects**) on how to setup your build process to accommodate this, then refer to the following sections, depending on the platform(s) your app is targeting:
631
-
632
- - [Android](docs/multi-deployment-testing-android.md)
633
- - [iOS](docs/multi-deployment-testing-ios.md)
634
-
635
- ### Dynamic Deployment Assignment
636
-
637
- The above section illustrated how you can leverage multiple CodePush deployments in order to effectively test your updates before broadly releasing them to your end users. However, since that workflow statically embeds the deployment assignment into the actual binary, a staging or production build will only ever sync updates from that deployment. In many cases, this is sufficient, since you only want your team, customers, stakeholders, etc. to sync with your pre-production releases, and therefore, only they need a build that knows how to sync with staging. However, if you want to be able to perform A/B tests, or provide early access of your app to certain users, it can prove very useful to be able to dynamically place specific users (or audiences) into specific deployments at runtime.
638
-
639
- In order to achieve this kind of workflow, all you need to do is specify the deployment key you want the current user to syncronize with when calling the `codePush` method. When specified, this key will override the "default" one that was provided in your app's `Info.plist` (iOS) or `MainActivity.java` (Android) files. This allows you to produce a build for staging or production, that is also capable of being dynamically "redirected" as needed.
443
+ ```bash
444
+ npx code-push release --binary-version 1.0.0 --app-version 1.0.1 \
445
+ --platform ios --identifier staging --entry-file index.js \
446
+ --mandatory true
640
447
 
641
- ```javascript
642
- // Imagine that "userProfile" is a prop that this component received
643
- // which includes the deployment key that the current user should use.
644
- codePush.sync({ deploymentKey: userProfile.CODEPUSH_KEY })
448
+ # Expo project
449
+ npx code-push release --framework expo --binary-version 1.0.0 --app-version 1.0.1 --platform ios
645
450
  ```
451
+ - `--framework`(`-f`) : Framework type (expo)
452
+ - `--binary-version`: The version of the binary app that the CodePush update is targeting.
453
+ - `--app-version`: The version of the CodePush update itself.
646
454
 
647
- With that change in place, now it's just a matter of choosing how your app determines the right deployment key for the current user. In practice, there are typically two solutions for this:
455
+ > [!IMPORTANT]
456
+ > `--app-version` should be greater than `--binary-version` (SemVer comparison).
648
457
 
649
- 1. Expose a user-visible mechanism for changing deployments at any time. For example, your settings page could have a toggle for enabling "beta" access. This model works well if you're not concerned with the privacy of your pre-production updates, and you have power users that may want to opt-in to earlier (and potentially buggy) updates at their own will (kind of like Chrome channels). However, this solution puts the decision in the hands of your users, which doesn't help you perform A/B tests transparently.
458
+ - `--rollout`: The rollout percentage for the update. (0~100, inclusive)
650
459
 
651
- 2. Annotate the server-side profile of your users with an additional piece of metadata that indicates the deployment they should sync with. By default, your app could just use the binary-embedded key, but after a user has authenticated, your server can choose to "redirect" them to a different deployment, which allows you to incrementally place certain users or groups in different deployments as needed. You could even choose to store the server-response in local storage so that it becomes the new default. How you store the key alongside your user's profiles is entirely up to your authentication solution (for example Auth0, Firebase, custom DB + REST API), but is generally pretty trivial to do.
460
+ #### `update-history`
652
461
 
653
- _NOTE: If needed, you could also implement a hybrid solution that allowed your end-users to toggle between different deployments, while also allowing your server to override that decision. This way, you have a hierarchy of "deployment resolution" that ensures your app has the ability to update itself out-of-the-box, your end users can feel rewarded by getting early access to bits, but you also have the ability to run A/B tests on your users as needed._
462
+ Update the release history for a specific CodePush update.
463
+ - Use the `--enable` option to disable a specific release for rollback. (or enable it)
464
+ - Use the `--mandatory` option to make the update as mandatory or optional.
465
+ - Use the `--rollout` option to change the rollout percentage of the update. (0~100, inclusive)
466
+ - If the rollout percentage is reduced, users who fall outside the new target will have their rollout canceled and rollback to the previous latest version.
654
467
 
655
- Since we recommend using the `Staging` deployment for pre-release testing of your updates (as explained in the previous section), it doesn't neccessarily make sense to use it for performing A/B tests on your users, as opposed to allowing early-access (as explained in option #1 above). Therefore, we recommend making full use of custom app deployments, so that you can segment your users however makes sense for your needs. For example, you could create long-term or even one-off deployments, release a variant of your app to it, and then place certain users into it in order to see how they engage.
468
+ **Example:**
469
+ - Rollback the CodePush update `1.0.1` (targeting the binary app version `1.0.0`).
656
470
 
657
- ```javascript
658
- // #1) Create your new deployment to hold releases of a specific app variant
659
- appcenter codepush deployment add -a <ownerName>/<appName> test-variant-one
660
-
661
- // #2) Target any new releases at that custom deployment
662
- appcenter codepush release-react -a <ownerName>/<appName> -d test-variant-one
471
+ ```bash
472
+ npx code-push update-history --binary-version 1.0.0 --app-version 1.0.1 \
473
+ --platform ios --identifier staging \
474
+ --enable false
663
475
  ```
664
476
 
665
- _NOTE: The total user count that is reported in your deployment's "Install Metrics" will take into account users that have "switched" from one deployment to another. For example, if your `Production` deployment currently reports having 1 total user, but you dynamically switch that user to `Staging`, then the `Production` deployment would report 0 total users, while `Staging` would report 1 (the user that just switched). This behavior allows you to accurately track your release adoption, even in the event of using a runtime-based deployment redirection solution._
666
-
667
- ---
668
-
669
- ## API Reference
670
-
671
- - [JavaScript API](docs/api-js.md)
672
- - [Objective-C API Reference (iOS)](docs/api-ios.md)
673
- - [Java API Reference (Android)](docs/api-android.md)
674
-
675
- ### Example Apps / Starters
676
-
677
- The React Native community has graciously created some awesome open source apps that can serve as examples for developers that are getting started. The following is a list of OSS React Native apps that are also using CodePush, and can therefore be used to see how others are using the service:
477
+ #### `bundle`
678
478
 
679
- - [F8 App](https://github.com/fbsamples/f8app) - The official conference app for [F8 2016](https://www.fbf8.com/).
680
- - [Feline for Product Hunt](https://github.com/arjunkomath/Feline-for-Product-Hunt) - An Android client for Product Hunt.
681
- - [GeoEncoding](https://github.com/LynxITDigital/GeoEncoding) - An app by [Lynx IT Digital](https://digital.lynxit.com.au) which demonstrates how to use numerous React Native components and modules.
682
- - [Math Facts](https://github.com/Khan/math-facts) - An app by Khan Academy to help memorize math facts more easily.
479
+ Create a CodePush bundle file.
683
480
 
684
- Additionally, if you're looking to get started with React Native + CodePush, and are looking for an awesome starter kit, you should check out the following:
685
-
686
- - [Pepperoni](http://getpepperoni.com/)
687
-
688
- _Note: If you've developed a React Native app using CodePush, that is also open-source, please let us know. We would love to add it to this list!_
689
-
690
- ### Debugging / Troubleshooting
691
-
692
- The `sync` method includes a lot of diagnostic logging out-of-the-box, so if you're encountering an issue when using it, the best thing to try first is examining the output logs of your app. This will tell you whether the app is configured correctly (like can the plugin find your deployment key?), if the app is able to reach the server, if an available update is being discovered, if the update is being successfully downloaded/installed, etc. We want to continue improving the logging to be as intuitive/comprehensive as possible, so please [let us know](mailto:codepushfeed@microsoft.com) if you find it to be confusing or missing anything.
693
-
694
- The simplest way to view these logs is to add the flag `--debug` for each command. This will output a log stream that is filtered to just CodePush messages. This makes it easy to identify issues, without needing to use a platform-specific tool, or wade through a potentially high volume of logs.
695
-
696
- <img width="540" alt="screen shot 2016-06-21 at 10 15 42 am" src="https://cloud.githubusercontent.com/assets/116461/16246973/838e2e98-37bc-11e6-9649-685f39e325a0.png">
697
-
698
- Additionally, you can also use any of the platform-specific tools to view the CodePush logs, if you are more comfortable with them. Simple start up the Chrome DevTools Console, the Xcode Console (iOS), the [OS X Console](https://en.wikipedia.org/wiki/Console_%28OS_X%29#.7E.2FLibrary.2FLogs) (iOS) and/or ADB logcat (Android), and look for messages which are prefixed with `[CodePush]`.
699
-
700
- Note that by default, React Native logs are disabled on iOS in release builds, so if you want to view them in a release build, you need to make the following changes to your `AppDelegate.m` file:
701
-
702
- 1. Add an `#import <React/RCTLog.h>` statement. For RN < v0.40 use: `#import "RCTLog.h"`
703
-
704
- 2. Add the following statement to the top of your `application:didFinishLaunchingWithOptions` method:
705
-
706
- ```objective-c
707
- RCTSetLogThreshold(RCTLogLevelInfo);
708
- ```
709
-
710
- Now you'll be able to see CodePush logs in either debug or release mode, on both iOS or Android. If examining the logs don't provide an indication of the issue, please refer to the following common issues for additional resolution ideas:
711
-
712
- | Issue / Symptom | Possible Solution |
713
- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
714
- | Compilation Error | Double-check that your version of React Native is [compatible](#supported-react-native-platforms) with the CodePush version you are using. |
715
- | Network timeout / hang when calling `sync` or `checkForUpdate` in the iOS Simulator | Try resetting the simulator by selecting the `Simulator -> Reset Content and Settings..` menu item, and then re-running your app. |
716
- | Server responds with a `404` when calling `sync` or `checkForUpdate` | Double-check that the deployment key you added to your `Info.plist` (iOS), `build.gradle` (Android) or that you're passing to `sync`/`checkForUpdate`, is in fact correct. You can run `appcenter codepush deployment list <ownerName>/<appName> --displayKeys` to view the correct keys for your app deployments. |
717
- | Update not being discovered | Double-check that the version of your running app (like `1.0.0`) matches the version you specified when releasing the update to CodePush. Additionally, make sure that you are releasing to the same deployment that your app is configured to sync with. |
718
- | Update not being displayed after restart | If you're not calling `sync` on app start (like within `componentDidMount` of your root component), then you need to explicitly call `notifyApplicationReady` on app start, otherwise, the plugin will think your update failed and roll it back. |
719
- | I've released an update for iOS but my Android app also shows an update and it breaks it | Be sure you have different deployment keys for each platform in order to receive updates correctly |
720
- | I've released new update but changes are not reflected | Be sure that you are running app in modes other than Debug. In Debug mode, React Native app always downloads JS bundle generated by packager, so JS bundle downloaded by CodePush does not apply. |
721
- | No JS bundle is being found when running your app against the iOS simulator | By default, React Native doesn't generate your JS bundle when running against the simulator. Therefore, if you're using `[CodePush bundleURL]`, and targetting the iOS simulator, you may be getting a `nil` result. This issue will be fixed in RN 0.22.0, but only for release builds. You can unblock this scenario right now by making [this change](https://github.com/facebook/react-native/commit/9ae3714f4bebdd2bcab4d7fdbf23acebdc5ed2ba) locally. |
722
-
723
- ### Continuous Integration / Delivery
724
-
725
- In addition to being able to use the CodePush CLI to "manually" release updates, we believe that it's important to create a repeatable and sustainable solution for contiously delivering updates to your app. That way, it's simple enough for you and/or your team to create and maintain the rhythm of performing agile deployments. In order to assist with setting up a CodePush-based CD pipeline, refer to the following integrations with various CI servers:
726
-
727
- - [Visual Studio Team Services](https://marketplace.visualstudio.com/items?itemName=ms-vsclient.code-push) - _NOTE: VSTS also has extensions for publishing to [HockeyApp](https://marketplace.visualstudio.com/items?itemName=ms.hockeyapp) and the [Google Play](https://github.com/microsoft/google-play-vsts-extension) store, so it provides a pretty great mobile CD solution in general._
728
- - [Travis CI](https://github.com/mondora/code-push-travis-cli)
729
-
730
- Additionally, if you'd like more details of what a complete mobile CI/CD workflow can look like, which includes CodePush, check out this [excellent article](https://medium.com/zeemee-engineering/zeemee-engineering-and-the-quest-for-the-holy-mobile-dev-grail-1310be4953d1) by the [ZeeMee engineering team](https://www.zeemee.com/).
481
+ **Example:**
482
+ ```bash
483
+ npx code-push bundle --platform android --entry-file index.js
731
484
 
732
- ### TypeScript Consumption
485
+ # Expo project
486
+ npx code-push bundle --framework expo --platform android --entry-file index.js
487
+ ```
488
+ - `--framework`(`-f`): Framework type (expo)
733
489
 
734
- This module ships its `*.d.ts` file as part of its NPM package, which allows you to simply `import` it, and receive intellisense in supporting editors (like Visual Studio Code), as well as compile-time type checking if you're using TypeScript. For the most part, this behavior should just work out of the box, however, if you've specified `es6` as the value for either the `target` or `module` [compiler option](http://www.typescriptlang.org/docs/handbook/compiler-options.html) in your [`tsconfig.json`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file, then just make sure that you also set the `moduleResolution` option to `node`. This ensures that the TypeScript compiler will look within the `node_modules` for the type definitions of imported modules. Otherwise, you'll get an error like the following when trying to import the `react-native-code-push` module: `error TS2307: Cannot find module 'react-native-code-push'`.
490
+ By default, the bundle file is created in the `/build/bundleOutput` directory.
735
491
 
736
- ---
492
+ > [!NOTE]
493
+ > For Expo projects, the CLI uses `expo export:embed` command for bundling instead of React Native's bundle command.
737
494
 
738
- This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
495
+ (The file name represents a hash value of the bundle content.)