@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,203 @@
1
+ /**
2
+ * code based on appcenter-cli
3
+ */
4
+
5
+ import childProcess from "child_process";
6
+ import fs from "fs";
7
+ import path from "path";
8
+ import shell from "shelljs";
9
+
10
+ /**
11
+ * Run Hermes compile CLI command
12
+ *
13
+ * @param bundleName {string} JS bundle file name
14
+ * @param outputPath {string} Path to output .hbc file
15
+ * @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)
16
+ * @param extraHermesFlags {string[]} Additional options to pass to `hermesc` command
17
+ * @return {Promise<void>}
18
+ */
19
+ export async function runHermesEmitBinaryCommand(
20
+ bundleName: string,
21
+ outputPath: string,
22
+ sourcemapOutput: string,
23
+ extraHermesFlags: string[] = [],
24
+ ): Promise<void> {
25
+ const hermesArgs: string[] = [
26
+ '-emit-binary',
27
+ '-out',
28
+ path.join(outputPath, bundleName + '.hbc'),
29
+ path.join(outputPath, bundleName),
30
+ ...extraHermesFlags,
31
+ ];
32
+ if (sourcemapOutput) {
33
+ hermesArgs.push('-output-source-map');
34
+ }
35
+
36
+ console.log('Converting JS bundle to byte code via Hermes, running command:\n');
37
+
38
+ return new Promise<void>((resolve, reject) => {
39
+ try {
40
+ const hermesCommand = getHermesCommand();
41
+
42
+ const disableAllWarningsArg = '-w';
43
+ shell.exec(`${hermesCommand} ${hermesArgs.join(' ')} ${disableAllWarningsArg}`);
44
+
45
+ // Copy HBC bundle to overwrite JS bundle
46
+ const source = path.join(outputPath, bundleName + '.hbc');
47
+ const destination = path.join(outputPath, bundleName);
48
+ shell.cp(source, destination);
49
+ shell.rm(source);
50
+ resolve();
51
+ } catch (e) {
52
+ reject(e);
53
+ }
54
+ }).then(() => {
55
+ if (!sourcemapOutput) {
56
+ // skip source map compose if source map is not enabled
57
+ return;
58
+ }
59
+
60
+ // compose-source-maps.js file path
61
+ const composeSourceMapsPath = getComposeSourceMapsPath();
62
+ if (composeSourceMapsPath === null) {
63
+ throw new Error('react-native compose-source-maps.js scripts is not found');
64
+ }
65
+
66
+ const jsCompilerSourceMapFile = path.join(outputPath, bundleName + '.hbc' + '.map');
67
+ if (!fs.existsSync(jsCompilerSourceMapFile)) {
68
+ throw new Error(`sourcemap file ${jsCompilerSourceMapFile} is not found`);
69
+ }
70
+
71
+ return new Promise((resolve, reject) => {
72
+ const composeSourceMapsArgs = [
73
+ composeSourceMapsPath,
74
+ sourcemapOutput,
75
+ jsCompilerSourceMapFile,
76
+ '-o',
77
+ sourcemapOutput,
78
+ ];
79
+ const composeSourceMapsProcess = childProcess.spawn('node', composeSourceMapsArgs);
80
+ console.log(`${composeSourceMapsPath} ${composeSourceMapsArgs.join(' ')}`);
81
+
82
+ composeSourceMapsProcess.stdout.on('data', (data) => {
83
+ console.log(data.toString().trim());
84
+ });
85
+
86
+ composeSourceMapsProcess.stderr.on('data', (data) => {
87
+ console.error(data.toString().trim());
88
+ });
89
+
90
+ composeSourceMapsProcess.on('close', (exitCode, signal) => {
91
+ if (exitCode !== 0) {
92
+ reject(new Error(`"compose-source-maps" command failed (exitCode=${exitCode}, signal=${signal}).`));
93
+ }
94
+
95
+ // Delete the HBC sourceMap, otherwise it will be included in 'code-push' bundle as well
96
+ fs.unlink(jsCompilerSourceMapFile, (err) => {
97
+ if (err != null) {
98
+ console.error(err);
99
+ reject(err);
100
+ }
101
+
102
+ resolve();
103
+ });
104
+ });
105
+ });
106
+ });
107
+ }
108
+
109
+ function getHermesCommand(): string {
110
+ const fileExists = (file: string): boolean => {
111
+ try {
112
+ return fs.statSync(file).isFile();
113
+ } catch (e) {
114
+ return false;
115
+ }
116
+ };
117
+
118
+ const hermescExecutable = path.join(getHermesCompilerPath(), getHermesOSBin(), getHermesOSExe());
119
+ if (fileExists(hermescExecutable)) {
120
+ return hermescExecutable;
121
+ }
122
+ throw new Error('Hermes engine binary not found. Please upgrade to react-native 0.69 or later');
123
+ }
124
+
125
+ function getHermesOSBin() {
126
+ switch (process.platform) {
127
+ case 'win32':
128
+ return 'win64-bin';
129
+ case 'darwin':
130
+ return 'osx-bin';
131
+ case 'freebsd':
132
+ case 'linux':
133
+ case 'sunos':
134
+ default:
135
+ return 'linux64-bin';
136
+ }
137
+ }
138
+
139
+ function getHermesOSExe(): string {
140
+ const hermesExecutableName = 'hermesc';
141
+ switch (process.platform) {
142
+ case 'win32':
143
+ return hermesExecutableName + '.exe';
144
+ default:
145
+ return hermesExecutableName;
146
+ }
147
+ }
148
+
149
+ function getComposeSourceMapsPath(): string | null {
150
+ // detect if compose-source-maps.js script exists
151
+ const composeSourceMaps = path.join(getReactNativePackagePath(), 'scripts', 'compose-source-maps.js');
152
+ if (fs.existsSync(composeSourceMaps)) {
153
+ return composeSourceMaps;
154
+ }
155
+ return null;
156
+ }
157
+
158
+ function getReactNativePackagePath(): string {
159
+ const result = childProcess.spawnSync('node', [
160
+ '--print',
161
+ "require.resolve('react-native/package.json')",
162
+ ]);
163
+ const packagePath = path.dirname(result.stdout.toString());
164
+ if (result.status === 0 && directoryExistsSync(packagePath)) {
165
+ return packagePath;
166
+ }
167
+
168
+ return path.join('node_modules', 'react-native');
169
+ }
170
+
171
+ function getHermescDirPathInHermesCompilerPackage() {
172
+ const result = childProcess.spawnSync('node', [
173
+ '--print',
174
+ "require.resolve('hermes-compiler/package.json')",
175
+ ]);
176
+ const packagePath = path.dirname(result.stdout.toString());
177
+ const hermescDirPath = path.join(packagePath, 'hermesc');
178
+ if (result.status === 0 && directoryExistsSync(hermescDirPath)) {
179
+ return hermescDirPath;
180
+ }
181
+ return null;
182
+ }
183
+
184
+ function getHermesCompilerPath() {
185
+ const hermescDirPath = getHermescDirPathInHermesCompilerPackage();
186
+ if (hermescDirPath) {
187
+ // Since react-native 0.83, Hermes compiler executables are in 'hermes-compiler' package
188
+ return hermescDirPath
189
+ } else {
190
+ return path.join(getReactNativePackagePath(), 'sdks', 'hermesc');
191
+ }
192
+ }
193
+
194
+ function directoryExistsSync(dirname: string): boolean {
195
+ try {
196
+ return fs.statSync(dirname).isDirectory();
197
+ } catch (err: unknown) {
198
+ if ((err as any).code !== 'ENOENT') {
199
+ throw err;
200
+ }
201
+ }
202
+ return false;
203
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * code based on appcenter-cli
3
+ */
4
+
5
+ import fs from "fs";
6
+ import path from "path";
7
+ import { createRequire } from "module";
8
+ import shell from "shelljs";
9
+
10
+ /**
11
+ * Run `react-native bundle` CLI command
12
+ *
13
+ * @param bundleName {string} JS bundle file name
14
+ * @param entryFile {string} App code entry file name (default: index.ts)
15
+ * @param outputPath {string} Path to output JS bundle file and assets
16
+ * @param platform {string} Platform (ios | android)
17
+ * @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)
18
+ * @param extraBundlerOptions {string[]} Additional options to pass to `react-native bundle` command
19
+ * @return {void}
20
+ */
21
+ export function runReactNativeBundleCommand(
22
+ bundleName: string,
23
+ outputPath: string,
24
+ platform: string,
25
+ sourcemapOutput: string,
26
+ entryFile: string,
27
+ extraBundlerOptions: string[] = [],
28
+ ): void {
29
+ function getCliPath(): string {
30
+ // pnpm hoisted 레이아웃에서는 react-native가 워크스페이스 루트로 호이스트되어
31
+ // cwd 상대 node_modules/.bin 경로가 존재하지 않을 수 있다. 로컬 .bin을 우선
32
+ // 사용하고, 없으면 Node resolution(상위 디렉토리 탐색)으로 패키지 bin을 찾는다.
33
+ const localBin = path.join('node_modules', '.bin', 'react-native');
34
+ if (fs.existsSync(localBin)) {
35
+ return localBin;
36
+ }
37
+
38
+ const requireFromCwd = createRequire(path.resolve('package.json'));
39
+ const packageJsonPath = requireFromCwd.resolve('react-native/package.json');
40
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
41
+ const binRelativePath = typeof packageJson.bin === 'string'
42
+ ? packageJson.bin
43
+ : packageJson.bin['react-native'];
44
+ return `node "${path.join(path.dirname(packageJsonPath), binRelativePath)}"`;
45
+ }
46
+
47
+ const reactNativeBundleArgs: string[] = [
48
+ 'bundle',
49
+ '--assets-dest',
50
+ outputPath,
51
+ '--bundle-output',
52
+ path.join(outputPath, bundleName),
53
+ '--dev',
54
+ 'false',
55
+ '--entry-file',
56
+ entryFile,
57
+ '--platform',
58
+ platform,
59
+ '--sourcemap-output',
60
+ sourcemapOutput,
61
+ ...extraBundlerOptions,
62
+ ];
63
+
64
+ console.log('Running "react-native bundle" command:\n');
65
+
66
+ shell.exec(`${getCliPath()} ${reactNativeBundleArgs.join(' ')}`);
67
+ }
package/cli/index.ts ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { program } from "commander";
4
+ import shell from "shelljs";
5
+ import { showLogo } from "./utils/showLogo.js";
6
+
7
+ /**
8
+ * npx code-push bundle
9
+ */
10
+ import "./commands/bundleCommand/index.js";
11
+
12
+ /**
13
+ * npx code-push create-history
14
+ */
15
+ import "./commands/createHistoryCommand/index.js";
16
+
17
+ /**
18
+ * npx code-push update-history
19
+ */
20
+ import "./commands/updateHistoryCommand/index.js";
21
+
22
+ /**
23
+ * npx code-push release
24
+ */
25
+ import "./commands/releaseCommand/index.js";
26
+
27
+ /**
28
+ * npx code-push show-history
29
+ */
30
+ import "./commands/showHistoryCommand/index.js";
31
+
32
+ /**
33
+ * npx code-push init
34
+ */
35
+ import "./commands/initCommand/index.js";
36
+
37
+ /**
38
+ * npx code-push create-pr-history
39
+ */
40
+ import "./commands/createPullRequestHistoryCommand/index.js";
41
+
42
+ /**
43
+ * npx code-push create-pr-release
44
+ */
45
+ import "./commands/createPullRequestReleaseCommand/index.js";
46
+
47
+ /**
48
+ * npx code-push remove-pr-history
49
+ */
50
+ import "./commands/removePullRequestHistoryCommand/index.js";
51
+
52
+ /**
53
+ * npx code-push get-package-hash
54
+ */
55
+ import "./commands/getPackageHashCommand/index.js";
56
+
57
+ shell.set("-e");
58
+ shell.set("+v");
59
+
60
+ program
61
+ .name("npx code-push")
62
+ .description("Command line interface for @algocare/react-native-code-push")
63
+ .version("1.0.0")
64
+ .action(() => {
65
+ showLogo();
66
+ });
67
+
68
+ program.parse();
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@algocare/code-push-cli",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "scripts": {
8
+ "clean": "rm -rf dist",
9
+ "build": "tsc -p tsconfig.json",
10
+ "typecheck": "tsc -p tsconfig.json --noEmit",
11
+ "test": "jest"
12
+ },
13
+ "dependencies": {
14
+ "commander": "^12.1.0",
15
+ "shelljs": "^0.10.0",
16
+ "xcode": "^3.0.1",
17
+ "yazl": "^3.3.1",
18
+ "yauzl": "^3.2.0"
19
+ },
20
+ "peerDependencies": {
21
+ "ts-node": ">=10"
22
+ },
23
+ "peerDependenciesMeta": {
24
+ "ts-node": {
25
+ "optional": true
26
+ }
27
+ },
28
+ "engines": {
29
+ "node": ">=18"
30
+ },
31
+ "devDependencies": {
32
+ "@types/yazl": "^3.3.0",
33
+ "@types/yauzl": "^2.10.3"
34
+ }
35
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Returns the current local timestamp in `YYYY-MM-DD HH:mm:ss` format.
3
+ * Recorded in release history entries as `createdAt` / `updatedAt`.
4
+ */
5
+ export function getTimestamp(): string {
6
+ const date = new Date();
7
+ const year = date.getFullYear();
8
+ const month = padWithZero(date.getMonth() + 1);
9
+ const day = padWithZero(date.getDate());
10
+ const hour = padWithZero(date.getHours());
11
+ const minute = padWithZero(date.getMinutes());
12
+ const second = padWithZero(date.getSeconds());
13
+
14
+ return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
15
+ }
16
+
17
+ function padWithZero(value: number): string {
18
+ return value < 10 ? `0${value}` : `${value}`;
19
+ }
@@ -2,23 +2,13 @@
2
2
  * code based on appcenter-cli
3
3
  */
4
4
 
5
- const fs = require('fs');
5
+ import fs from "fs";
6
6
 
7
- /**
8
- *
9
- * @param path {string}
10
- * @return {boolean}
11
- */
12
- function isDirectory(path) {
7
+ export function isDirectory(path: string): boolean {
13
8
  return fs.statSync(path).isDirectory();
14
9
  }
15
10
 
16
- /**
17
- *
18
- * @param length {number}
19
- * @return {string}
20
- */
21
- function generateRandomFilename(length) {
11
+ export function generateRandomFilename(length: number): string {
22
12
  let filename = '';
23
13
  const validChar = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
24
14
 
@@ -29,14 +19,7 @@ function generateRandomFilename(length) {
29
19
  return filename;
30
20
  }
31
21
 
32
- /**
33
- *
34
- * @param filePath {string}
35
- * @return {string}
36
- */
37
- function normalizePath(filePath) {
22
+ export function normalizePath(filePath: string): string {
38
23
  //replace all backslashes coming from cli running on windows machines by slashes
39
24
  return filePath.replace(/\\/g, '/');
40
25
  }
41
-
42
- module.exports = { isDirectory, generateRandomFilename, normalizePath };
@@ -0,0 +1,50 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { createRequire } from "module";
4
+ import type { CliConfigInterface } from "../../typings/react-native-code-push.d.ts";
5
+
6
+ const nodeRequire = createRequire(import.meta.url);
7
+
8
+ /**
9
+ * allows to require a config file with .ts extension
10
+ */
11
+ function requireConfig(filePath: string): CliConfigInterface {
12
+ const ext = path.extname(filePath);
13
+
14
+ if (ext === '.ts') {
15
+ try {
16
+ nodeRequire('ts-node/register');
17
+ } catch {
18
+ console.error('ts-node not found. Please install ts-node as a devDependency.');
19
+ process.exit(1);
20
+ }
21
+ } else if (ext === '.js') {
22
+ // do nothing
23
+ } else {
24
+ throw new Error(`Unsupported file extension: ${ext}`);
25
+ }
26
+
27
+ return nodeRequire(filePath) as CliConfigInterface;
28
+ }
29
+
30
+ export function findAndReadConfigFile(startDir: string, configFileName: string): CliConfigInterface {
31
+ // If the default `code-push.config.ts` is not found, fall back to the compiled/plain-JS
32
+ // `code-push.config.js`. (algocare apps ship a JS config; an explicitly passed -c option is used as-is.)
33
+ const candidateFileNames = configFileName === 'code-push.config.ts'
34
+ ? [configFileName, 'code-push.config.js']
35
+ : [configFileName];
36
+
37
+ for (const candidate of candidateFileNames) {
38
+ let dir = startDir;
39
+
40
+ while (dir !== path.parse(dir).root) {
41
+ const configPath = path.join(dir, candidate);
42
+ if (fs.existsSync(configPath)) {
43
+ return requireConfig(configPath);
44
+ }
45
+ dir = path.dirname(dir);
46
+ }
47
+ }
48
+
49
+ throw new Error(`${configFileName} not found.`);
50
+ }
@@ -0,0 +1,143 @@
1
+ /**
2
+ * code based on appcenter-cli
3
+ */
4
+
5
+ /**
6
+ * NOTE!!! This utility file is duplicated for use by the CodePush service (for server-driven hashing/
7
+ * integrity checks) and Management SDK (for end-to-end code signing), please keep them in sync.
8
+ */
9
+
10
+ import crypto from "crypto";
11
+ import fs from "fs";
12
+ import path from "path";
13
+ import { isDirectory } from "./file-utils.js";
14
+ import { walk } from "./promisfied-fs.js";
15
+
16
+ // Do not throw an exception if either of these modules are missing, as they may not be needed by the
17
+ // consumer of this file.
18
+ const HASH_ALGORITHM = 'sha256';
19
+ class PackageManifest {
20
+ private _map: Map<string, string>;
21
+
22
+ constructor(map?: Map<string, string>) {
23
+ if (map == null) {
24
+ map = new Map();
25
+ }
26
+ this._map = map;
27
+ }
28
+
29
+ toMap(): Map<string, string> {
30
+ return this._map;
31
+ }
32
+
33
+ computePackageHash(): string {
34
+ let entries: string[] = [];
35
+ this._map.forEach((hash, name) => {
36
+ entries.push(name + ':' + hash);
37
+ });
38
+
39
+ // Make sure this list is alphabetically ordered so that other clients
40
+ // can also compute this hash easily given the update contents.
41
+ entries = entries.sort();
42
+
43
+ return crypto.createHash(HASH_ALGORITHM).update(JSON.stringify(entries)).digest('hex');
44
+ }
45
+
46
+ serialize(): string {
47
+ const obj: Record<string, string> = {};
48
+
49
+ this._map.forEach(function (value, key) {
50
+ obj[key] = value;
51
+ });
52
+
53
+ return JSON.stringify(obj);
54
+ }
55
+
56
+ static normalizePath(filePath: string): string {
57
+ //replace all backslashes coming from cli running on windows machines by slashes
58
+ return filePath.replace(/\\/g, '/');
59
+ }
60
+
61
+ static isIgnored(relativeFilePath: string): boolean {
62
+ const __MACOSX = '__MACOSX/';
63
+ const DS_STORE = '.DS_Store';
64
+ return (
65
+ relativeFilePath.startsWith(__MACOSX) ||
66
+ relativeFilePath === DS_STORE ||
67
+ relativeFilePath.endsWith('/' + DS_STORE)
68
+ );
69
+ }
70
+ }
71
+
72
+ export async function generatePackageHashFromDirectory(directoryPath: string, basePath: string) {
73
+ try {
74
+ if (!isDirectory(directoryPath)) {
75
+ throw new Error('Not a directory. Please either create a directory, or use hashFile().');
76
+ }
77
+ } catch (error) {
78
+ throw new Error('Directory does not exist. Please either create a directory, or use hashFile().');
79
+ }
80
+
81
+ /**
82
+ * @type {PackageManifest}
83
+ */
84
+ const manifest = await generatePackageManifestFromDirectory(directoryPath, basePath);
85
+ return manifest.computePackageHash();
86
+ }
87
+
88
+ function generatePackageManifestFromDirectory(directoryPath: string, basePath: string): Promise<PackageManifest> {
89
+ // eslint-disable-next-line no-async-promise-executor
90
+ return new Promise(async (resolve, reject) => {
91
+ const fileHashesMap = new Map<string, string>();
92
+
93
+ const files: string[] = await walk(directoryPath);
94
+
95
+ if (!files || files.length === 0) {
96
+ reject('Error: Cannot sign the release because no files were found.');
97
+ return;
98
+ }
99
+
100
+ // Hash the files sequentially, because streaming them in parallel is not necessarily faster
101
+ const generateManifestPromise = files.reduce<Promise<unknown>>((soFar, filePath) => {
102
+ return soFar.then(() => {
103
+ const relativePath: string = PackageManifest.normalizePath(path.relative(basePath, filePath));
104
+ if (!PackageManifest.isIgnored(relativePath)) {
105
+ return hashFile(filePath).then((hash) => {
106
+ fileHashesMap.set(relativePath, hash);
107
+ });
108
+ }
109
+ });
110
+ }, Promise.resolve(null));
111
+
112
+ generateManifestPromise.then(() => {
113
+ resolve(new PackageManifest(fileHashesMap));
114
+ }, reject);
115
+ });
116
+ }
117
+
118
+ function hashFile(filePath: string): Promise<string> {
119
+ const readStream: fs.ReadStream = fs.createReadStream(filePath);
120
+ return hashStream(readStream);
121
+ }
122
+
123
+ function hashStream(readStream: fs.ReadStream): Promise<string> {
124
+ return new Promise((resolve, reject) => {
125
+ const _hashStream = crypto.createHash(HASH_ALGORITHM)
126
+
127
+ readStream
128
+ .on('error', (error) => {
129
+ _hashStream.end();
130
+ reject(error);
131
+ })
132
+ .on('end', () => {
133
+ _hashStream.end();
134
+
135
+ const buffer = _hashStream.read();
136
+ const hash: string = buffer.toString('hex');
137
+
138
+ resolve(hash);
139
+ });
140
+
141
+ readStream.pipe(_hashStream);
142
+ });
143
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * code based on appcenter-cli
3
+ */
4
+
5
+ import { promises as fs } from "fs";
6
+ import path from "path";
7
+
8
+ export async function walk(dir: string): Promise<string[]> {
9
+ const stats = await fs.stat(dir);
10
+ if (stats.isDirectory()) {
11
+ let files: string[] = [];
12
+ for (const file of await fs.readdir(dir)) {
13
+ files = files.concat(await walk(path.join(dir, file)));
14
+ }
15
+ return files;
16
+ } else {
17
+ return [dir];
18
+ }
19
+ }
@@ -1,4 +1,4 @@
1
- function showLogo() {
1
+ export function showLogo() {
2
2
  const logo = `
3
3
 
4
4
  +------------------------------------------------------------------+
@@ -10,14 +10,12 @@ function showLogo() {
10
10
  | \\____/\\____/\\__,_/\\___/_/ \\__,_/____/_/ /_/ |
11
11
  | |
12
12
  | |
13
- | 🚀 @algocare/react-native-code-push |
13
+ | 🚀 @bravemobile/react-native-code-push |
14
14
  +------------------------------------------------------------------+
15
15
 
16
16
  Please refer to help command for more information.
17
17
 
18
18
  (interactive mode is not supported yet.)
19
- `
20
- console.log(logo)
19
+ `;
20
+ console.log(logo);
21
21
  }
22
-
23
- module.exports = { showLogo }