@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
@@ -0,0 +1,44 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { createRequire } from "module";
4
+ const nodeRequire = createRequire(import.meta.url);
5
+ /**
6
+ * allows to require a config file with .ts extension
7
+ */
8
+ function requireConfig(filePath) {
9
+ const ext = path.extname(filePath);
10
+ if (ext === '.ts') {
11
+ try {
12
+ nodeRequire('ts-node/register');
13
+ }
14
+ catch {
15
+ console.error('ts-node not found. Please install ts-node as a devDependency.');
16
+ process.exit(1);
17
+ }
18
+ }
19
+ else if (ext === '.js') {
20
+ // do nothing
21
+ }
22
+ else {
23
+ throw new Error(`Unsupported file extension: ${ext}`);
24
+ }
25
+ return nodeRequire(filePath);
26
+ }
27
+ export function findAndReadConfigFile(startDir, configFileName) {
28
+ // If the default `code-push.config.ts` is not found, fall back to the compiled/plain-JS
29
+ // `code-push.config.js`. (algocare apps ship a JS config; an explicitly passed -c option is used as-is.)
30
+ const candidateFileNames = configFileName === 'code-push.config.ts'
31
+ ? [configFileName, 'code-push.config.js']
32
+ : [configFileName];
33
+ for (const candidate of candidateFileNames) {
34
+ let dir = startDir;
35
+ while (dir !== path.parse(dir).root) {
36
+ const configPath = path.join(dir, candidate);
37
+ if (fs.existsSync(configPath)) {
38
+ return requireConfig(configPath);
39
+ }
40
+ dir = path.dirname(dir);
41
+ }
42
+ }
43
+ throw new Error(`${configFileName} not found.`);
44
+ }
@@ -1,165 +1,85 @@
1
1
  /**
2
2
  * code based on appcenter-cli
3
3
  */
4
-
5
4
  /**
6
5
  * NOTE!!! This utility file is duplicated for use by the CodePush service (for server-driven hashing/
7
6
  * integrity checks) and Management SDK (for end-to-end code signing), please keep them in sync.
8
7
  */
9
-
10
- const crypto = require('crypto');
11
- const fs = require('fs');
12
- const path = require('path');
13
- const { isDirectory } = require('./file-utils');
14
- const { walk } = require('./promisfied-fs');
15
-
8
+ import crypto from "crypto";
9
+ import fs from "fs";
10
+ import path from "path";
11
+ import { isDirectory } from "./file-utils.js";
12
+ import { walk } from "./promisfied-fs.js";
16
13
  // Do not throw an exception if either of these modules are missing, as they may not be needed by the
17
14
  // consumer of this file.
18
15
  const HASH_ALGORITHM = 'sha256';
19
16
  class PackageManifest {
20
- /**
21
- * @type {Map<string, string>}
22
- * @private
23
- */
24
17
  _map;
25
-
26
- /**
27
- * @param map {Map<string, string>?}
28
- * @public
29
- */
30
18
  constructor(map) {
31
19
  if (map == null) {
32
20
  map = new Map();
33
21
  }
34
22
  this._map = map;
35
23
  }
36
-
37
- /**
38
- * @return {Map<string, string>}
39
- * @public
40
- */
41
24
  toMap() {
42
25
  return this._map;
43
26
  }
44
-
45
- /**
46
- * @return {string}
47
- * @public
48
- */
49
27
  computePackageHash() {
50
- /**
51
- * @type {string[]}
52
- */
53
28
  let entries = [];
54
29
  this._map.forEach((hash, name) => {
55
30
  entries.push(name + ':' + hash);
56
31
  });
57
-
58
32
  // Make sure this list is alphabetically ordered so that other clients
59
33
  // can also compute this hash easily given the update contents.
60
34
  entries = entries.sort();
61
-
62
35
  return crypto.createHash(HASH_ALGORITHM).update(JSON.stringify(entries)).digest('hex');
63
36
  }
64
-
65
- /**
66
- * @return {string}
67
- * @public
68
- */
69
37
  serialize() {
70
38
  const obj = {};
71
-
72
39
  this._map.forEach(function (value, key) {
73
40
  obj[key] = value;
74
41
  });
75
-
76
42
  return JSON.stringify(obj);
77
43
  }
78
-
79
- /**
80
- * @param filePath {string}
81
- * @return {string}
82
- * @public
83
- */
84
44
  static normalizePath(filePath) {
85
45
  //replace all backslashes coming from cli running on windows machines by slashes
86
46
  return filePath.replace(/\\/g, '/');
87
47
  }
88
-
89
- /**
90
- * @param relativeFilePath {string}
91
- * @return {boolean}
92
- * @public
93
- */
94
48
  static isIgnored(relativeFilePath) {
95
49
  const __MACOSX = '__MACOSX/';
96
50
  const DS_STORE = '.DS_Store';
97
- const CODEPUSH_METADATA = '.codepushrelease';
98
- return (
99
- relativeFilePath.startsWith(__MACOSX) ||
51
+ return (relativeFilePath.startsWith(__MACOSX) ||
100
52
  relativeFilePath === DS_STORE ||
101
- relativeFilePath.endsWith('/' + DS_STORE) ||
102
- relativeFilePath === CODEPUSH_METADATA ||
103
- relativeFilePath.endsWith('/' + CODEPUSH_METADATA)
104
- );
53
+ relativeFilePath.endsWith('/' + DS_STORE));
105
54
  }
106
55
  }
107
-
108
- /**
109
- *
110
- * @param directoryPath {string}
111
- * @param basePath {string}
112
- * @return {Promise<string>}
113
- */
114
- async function generatePackageHashFromDirectory(directoryPath, basePath) {
56
+ export async function generatePackageHashFromDirectory(directoryPath, basePath) {
115
57
  try {
116
58
  if (!isDirectory(directoryPath)) {
117
59
  throw new Error('Not a directory. Please either create a directory, or use hashFile().');
118
60
  }
119
- } catch (error) {
61
+ }
62
+ catch (error) {
120
63
  throw new Error('Directory does not exist. Please either create a directory, or use hashFile().');
121
64
  }
122
-
123
65
  /**
124
66
  * @type {PackageManifest}
125
67
  */
126
68
  const manifest = await generatePackageManifestFromDirectory(directoryPath, basePath);
127
69
  return manifest.computePackageHash();
128
70
  }
129
-
130
- /**
131
- *
132
- * @param directoryPath {string}
133
- * @param basePath {string}
134
- * @return {Promise<PackageManifest>}
135
- */
136
71
  function generatePackageManifestFromDirectory(directoryPath, basePath) {
137
72
  // eslint-disable-next-line no-async-promise-executor
138
73
  return new Promise(async (resolve, reject) => {
139
- /**
140
- * @type {Map<string, string>}
141
- */
142
74
  const fileHashesMap = new Map();
143
-
144
- /**
145
- * @type {string[]}
146
- */
147
75
  const files = await walk(directoryPath);
148
-
149
76
  if (!files || files.length === 0) {
150
77
  reject('Error: Cannot sign the release because no files were found.');
151
78
  return;
152
79
  }
153
-
154
- /**
155
- * @type {Promise<void>}
156
- */
157
80
  // Hash the files sequentially, because streaming them in parallel is not necessarily faster
158
81
  const generateManifestPromise = files.reduce((soFar, filePath) => {
159
82
  return soFar.then(() => {
160
- /**
161
- * @type {string}
162
- */
163
83
  const relativePath = PackageManifest.normalizePath(path.relative(basePath, filePath));
164
84
  if (!PackageManifest.isIgnored(relativePath)) {
165
85
  return hashFile(filePath).then((hash) => {
@@ -168,60 +88,29 @@ function generatePackageManifestFromDirectory(directoryPath, basePath) {
168
88
  }
169
89
  });
170
90
  }, Promise.resolve(null));
171
-
172
91
  generateManifestPromise.then(() => {
173
92
  resolve(new PackageManifest(fileHashesMap));
174
93
  }, reject);
175
94
  });
176
95
  }
177
-
178
- /**
179
- *
180
- * @param filePath {string}
181
- * @return {Promise<string>}
182
- */
183
96
  function hashFile(filePath) {
184
- /**
185
- * @type {fs.ReadStream}
186
- */
187
97
  const readStream = fs.createReadStream(filePath);
188
98
  return hashStream(readStream);
189
99
  }
190
-
191
- /**
192
- *
193
- * @param readStream {stream.Readable}
194
- * @return {Promise<string>}
195
- */
196
100
  function hashStream(readStream) {
197
101
  return new Promise((resolve, reject) => {
198
- /**
199
- * @type {stream.Transform}
200
- */
201
- const _hashStream = crypto.createHash(HASH_ALGORITHM)
202
-
102
+ const _hashStream = crypto.createHash(HASH_ALGORITHM);
203
103
  readStream
204
104
  .on('error', (error) => {
205
- _hashStream.end();
206
- reject(error);
207
- })
105
+ _hashStream.end();
106
+ reject(error);
107
+ })
208
108
  .on('end', () => {
209
- _hashStream.end();
210
-
211
- /**
212
- * @type {Buffer}
213
- */
214
- const buffer = _hashStream.read();
215
- /**
216
- * @type {string}
217
- */
218
- const hash = buffer.toString('hex');
219
-
220
- resolve(hash);
221
- });
222
-
109
+ _hashStream.end();
110
+ const buffer = _hashStream.read();
111
+ const hash = buffer.toString('hex');
112
+ resolve(hash);
113
+ });
223
114
  readStream.pipe(_hashStream);
224
115
  });
225
116
  }
226
-
227
- module.exports = { generatePackageHashFromDirectory };
@@ -1,29 +1,18 @@
1
1
  /**
2
2
  * code based on appcenter-cli
3
3
  */
4
-
5
- const { promises: fs } = require('fs');
6
- const path = require('path');
7
-
8
- /**
9
- *
10
- * @param dir {string}
11
- * @return {Promise<string[]>}
12
- */
13
- async function walk(dir) {
4
+ import { promises as fs } from "fs";
5
+ import path from "path";
6
+ export async function walk(dir) {
14
7
  const stats = await fs.stat(dir);
15
8
  if (stats.isDirectory()) {
16
- /**
17
- * @type {string[]}
18
- */
19
9
  let files = [];
20
10
  for (const file of await fs.readdir(dir)) {
21
11
  files = files.concat(await walk(path.join(dir, file)));
22
12
  }
23
13
  return files;
24
- } else {
14
+ }
15
+ else {
25
16
  return [dir];
26
17
  }
27
18
  }
28
-
29
- module.exports = { walk };
@@ -0,0 +1,21 @@
1
+ export function showLogo() {
2
+ const logo = `
3
+
4
+ +------------------------------------------------------------------+
5
+ | |
6
+ | ______ __ ____ __ |
7
+ | / ____/___ ____/ /__ / __ \\__ _______/ /_ |
8
+ | / / / __ \\/ __ / _ \\/ /_/ / / / / ___/ __ \\ |
9
+ | / /___/ /_/ / /_/ / __/ ____/ /_/ (__ ) / / / |
10
+ | \\____/\\____/\\__,_/\\___/_/ \\__,_/____/_/ /_/ |
11
+ | |
12
+ | |
13
+ | 🚀 @bravemobile/react-native-code-push |
14
+ +------------------------------------------------------------------+
15
+
16
+ Please refer to help command for more information.
17
+
18
+ (interactive mode is not supported yet.)
19
+ `;
20
+ console.log(logo);
21
+ }
@@ -0,0 +1,41 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import yauzl from "yauzl";
4
+ export function unzip(zipPath, outputDir) {
5
+ return new Promise((resolve, reject) => {
6
+ yauzl.open(zipPath, { lazyEntries: true }, (err, zipFile) => {
7
+ if (err)
8
+ return reject(err);
9
+ zipFile.readEntry();
10
+ zipFile.on("entry", (entry) => {
11
+ const fullPath = path.join(outputDir, entry.fileName);
12
+ // Handle directory entry
13
+ if (/\/$/.test(entry.fileName)) {
14
+ fs.mkdir(fullPath, { recursive: true }, (err) => {
15
+ if (err)
16
+ return reject(err);
17
+ zipFile.readEntry();
18
+ });
19
+ return;
20
+ }
21
+ // Handle file entry
22
+ zipFile.openReadStream(entry, (err, readStream) => {
23
+ if (err)
24
+ return reject(err);
25
+ fs.mkdir(path.dirname(fullPath), { recursive: true }, (err) => {
26
+ if (err)
27
+ return reject(err);
28
+ const writeStream = fs.createWriteStream(fullPath);
29
+ readStream.pipe(writeStream);
30
+ // Continue to the next entry after writing
31
+ writeStream.on("close", () => {
32
+ zipFile.readEntry();
33
+ });
34
+ });
35
+ });
36
+ });
37
+ zipFile.on("end", resolve);
38
+ zipFile.on("error", reject);
39
+ });
40
+ });
41
+ }
@@ -1,30 +1,15 @@
1
1
  /**
2
2
  * code based on appcenter-cli
3
3
  */
4
-
5
- const fs = require('fs');
6
- const path = require('path');
7
- const yazl = require('yazl');
8
- const { generateRandomFilename, normalizePath, isDirectory } = require('./file-utils');
9
- const { walk } = require('./promisfied-fs');
10
-
11
- /**
12
- * @typedef {{ sourceLocation: string, targetLocation: string }} ReleaseFile
13
- */
14
-
15
- /**
16
- * @param updateContentsPath {string}
17
- * @return {Promise<string>}
18
- */
19
- function zip(updateContentsPath) {
20
-
4
+ import fs from "fs";
5
+ import path from "path";
6
+ import yazl from "yazl";
7
+ import { generateRandomFilename, normalizePath, isDirectory } from "./file-utils.js";
8
+ import { walk } from "./promisfied-fs.js";
9
+ export function zip(updateContentsPath) {
21
10
  // eslint-disable-next-line no-async-promise-executor
22
11
  return new Promise(async (resolve, reject) => {
23
- /**
24
- * @type {ReleaseFile[]}
25
- */
26
12
  const releaseFiles = [];
27
-
28
13
  try {
29
14
  if (!isDirectory(updateContentsPath)) {
30
15
  releaseFiles.push({
@@ -32,58 +17,37 @@ function zip(updateContentsPath) {
32
17
  targetLocation: normalizePath(path.basename(updateContentsPath)), // Put the file in the root
33
18
  });
34
19
  }
35
- } catch (error) {
36
- error.message = error.message + ' Make sure you have added the platform you are making a release to.`.';
20
+ }
21
+ catch (error) {
22
+ if (error instanceof Error) {
23
+ error.message = error.message + " Make sure you have added the platform you are making a release to.`.";
24
+ }
37
25
  reject(error);
38
26
  }
39
-
40
- /**
41
- * @type {string}
42
- */
43
27
  const directoryPath = updateContentsPath;
44
28
  const baseDirectoryPath = path.join(directoryPath, '..'); // For legacy reasons, put the root directory in the zip
45
-
46
- /**
47
- * @type {string[]}
48
- */
49
29
  const files = await walk(updateContentsPath);
50
-
51
30
  files.forEach((filePath) => {
52
- /**
53
- * @type {string}
54
- */
55
31
  const relativePath = path.relative(baseDirectoryPath, filePath);
56
32
  releaseFiles.push({
57
33
  sourceLocation: filePath,
58
34
  targetLocation: normalizePath(relativePath),
59
35
  });
60
36
  });
61
-
62
- /**
63
- * @type {string}
64
- */
65
37
  const packagePath = path.join(process.cwd(), generateRandomFilename(15) + '.zip');
66
38
  const zipFile = new yazl.ZipFile();
67
- /**
68
- * @type {fs.WriteStream}
69
- */
70
39
  const writeStream = fs.createWriteStream(packagePath);
71
-
72
40
  zipFile.outputStream
73
41
  .pipe(writeStream)
74
42
  .on('error', (error) => {
75
- reject(error);
76
- })
43
+ reject(error);
44
+ })
77
45
  .on('close', () => {
78
- resolve(packagePath);
79
- });
80
-
46
+ resolve(packagePath);
47
+ });
81
48
  releaseFiles.forEach((releaseFile) => {
82
49
  zipFile.addFile(releaseFile.sourceLocation, releaseFile.targetLocation);
83
50
  });
84
-
85
51
  zipFile.end();
86
52
  });
87
53
  }
88
-
89
- module.exports = zip;
@@ -2,15 +2,11 @@
2
2
  * code based on appcenter-cli
3
3
  */
4
4
 
5
- const os = require('os');
5
+ import os from "os";
6
6
 
7
7
  /**
8
8
  * Return the path of the temporary directory for react-native bundling
9
- *
10
- * @return {string}
11
9
  */
12
- function getReactTempDir() {
10
+ export function getReactTempDir(): string {
13
11
  return `${os.tmpdir()}/react-*`;
14
12
  }
15
-
16
- module.exports = { getReactTempDir };
@@ -0,0 +1,26 @@
1
+ import path from "path";
2
+ import shell from "shelljs";
3
+ import { zip } from "../utils/zip.js";
4
+ import { generatePackageHashFromDirectory } from "../utils/hash-utils.js";
5
+
6
+ /**
7
+ * Create a CodePush bundle file and return the information.
8
+ *
9
+ * @param contentsPath {string} The directory path containing the contents to be made into a CodePush bundle (usually the 'build/CodePush' directory))
10
+ * @param bundleDirectory {string} The directory path to save the CodePush bundle file
11
+ * @return {Promise<{ bundleFileName: string }>}
12
+ */
13
+ export async function makeCodePushBundle(contentsPath: string, bundleDirectory: string): Promise<{ bundleFileName: string }> {
14
+ const updateContentsZipPath = await zip(contentsPath);
15
+
16
+ const packageHash = await generatePackageHashFromDirectory(contentsPath, path.join(contentsPath, '..'));
17
+
18
+ shell.mkdir('-p', `./${bundleDirectory}`);
19
+ shell.mv(updateContentsZipPath, `./${bundleDirectory}/${packageHash}`);
20
+
21
+ return {
22
+ // To allow the "release" command to get the file and hash value from the result of the "bundle" command,
23
+ // use the hash value as the name of the file.
24
+ bundleFileName: packageHash,
25
+ };
26
+ }
@@ -0,0 +1,10 @@
1
+ import shell from "shelljs";
2
+
3
+ /**
4
+ * @param deleteDirs {string[]} Directories to delete
5
+ * @param makeDir {string} Directory path to create
6
+ */
7
+ export function prepareToBundleJS({ deleteDirs, makeDir }: { deleteDirs: string[], makeDir: string }) {
8
+ shell.rm('-rf', deleteDirs);
9
+ shell.mkdir('-p', makeDir);
10
+ }
@@ -0,0 +1,45 @@
1
+ import path from "path";
2
+ import shell from "shelljs";
3
+
4
+ /**
5
+ * Run `expo bundle` CLI command
6
+ *
7
+ * @param bundleName {string} JS bundle file name
8
+ * @param entryFile {string} App code entry file name (default: index.ts)
9
+ * @param outputPath {string} Path to output JS bundle file and assets
10
+ * @param platform {string} Platform (ios | android)
11
+ * @param sourcemapOutput {string} Path to output sourcemap file (Warning: if sourcemapOutput points to the outputPath, the sourcemap will be included in the CodePush bundle and increase the deployment size)
12
+ * @return {void}
13
+ */
14
+ export function runExpoBundleCommand(
15
+ bundleName: string,
16
+ outputPath: string,
17
+ platform: string,
18
+ sourcemapOutput: string,
19
+ entryFile: string,
20
+ ): void {
21
+ function getCliPath(): string {
22
+ return path.join('node_modules', '.bin', 'expo');
23
+ }
24
+
25
+ const expoBundleArgs: string[] = [
26
+ 'export:embed',
27
+ '--assets-dest',
28
+ outputPath,
29
+ '--bundle-output',
30
+ path.join(outputPath, bundleName),
31
+ '--dev',
32
+ 'false',
33
+ '--entry-file',
34
+ entryFile,
35
+ '--platform',
36
+ platform,
37
+ '--sourcemap-output',
38
+ sourcemapOutput,
39
+ '--reset-cache',
40
+ ];
41
+
42
+ console.log('Running "expo export:embed" command:\n');
43
+
44
+ shell.exec(`${getCliPath()} ${expoBundleArgs.join(' ')}`);
45
+ }