@algocare/react-native-code-push 12.6.4 → 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 (296) 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 +68 -42
  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/.claude/commands/release.md +0 -78
  152. package/.claude/skills/npm-release/SKILL.md +0 -89
  153. package/CLAUDE.md +0 -83
  154. package/CONTRIBUTING.md +0 -134
  155. package/CodePush.js +0 -972
  156. package/SECURITY.md +0 -41
  157. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
  158. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +0 -12
  159. package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +0 -17
  160. package/android/codepush.gradle +0 -162
  161. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  162. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  163. package/android/gradlew +0 -164
  164. package/android/gradlew.bat +0 -90
  165. package/babel.config.js +0 -3
  166. package/cli/commands/bundleCommand/bundleCodePush.js +0 -57
  167. package/cli/commands/bundleCommand/index.js +0 -55
  168. package/cli/commands/common.js +0 -245
  169. package/cli/commands/createHistoryCommand/createReleaseHistory.js +0 -42
  170. package/cli/commands/createHistoryCommand/createReleaseHistoryList.js +0 -52
  171. package/cli/commands/createHistoryCommand/index.js +0 -95
  172. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +0 -34
  173. package/cli/commands/createPullRequestHistoryCommand/index.js +0 -29
  174. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +0 -74
  175. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +0 -91
  176. package/cli/commands/createPullRequestReleaseCommand/index.js +0 -68
  177. package/cli/commands/getPackageHashCommand/index.js +0 -42
  178. package/cli/commands/releaseCommand/addToReleaseHistory.js +0 -85
  179. package/cli/commands/releaseCommand/index.js +0 -151
  180. package/cli/commands/releaseCommand/release.js +0 -121
  181. package/cli/commands/removePullRequestHistoryCommand/index.js +0 -28
  182. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +0 -23
  183. package/cli/commands/showHistoryCommand/index.js +0 -88
  184. package/cli/commands/updateHistoryCommand/index.js +0 -123
  185. package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +0 -69
  186. package/cli/constant.js +0 -8
  187. package/cli/index.js +0 -63
  188. package/cli/utils/datetime.js +0 -22
  189. package/cli/utils/fsUtils.js +0 -64
  190. package/cli/utils/version.js +0 -26
  191. package/code-push.config.example.supabase.ts +0 -114
  192. package/code-push.config.js +0 -229
  193. package/code-push.config.ts +0 -175
  194. package/docs/api-android.md +0 -83
  195. package/docs/api-ios.md +0 -31
  196. package/docs/api-js.md +0 -592
  197. package/docs/multi-deployment-testing-android.md +0 -148
  198. package/docs/multi-deployment-testing-ios.md +0 -59
  199. package/docs/setup-android.md +0 -482
  200. package/docs/setup-ios.md +0 -280
  201. package/eslint.config.mjs +0 -32
  202. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
  203. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
  204. package/ios/CodePush/Base64/README.md +0 -47
  205. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
  206. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
  207. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
  208. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
  209. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
  210. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
  211. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
  212. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
  213. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
  214. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
  215. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
  216. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
  217. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
  218. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
  219. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
  220. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
  221. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
  222. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
  223. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
  224. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
  225. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
  226. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
  227. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
  228. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
  229. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
  230. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
  231. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
  232. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
  233. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
  234. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
  235. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
  236. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
  237. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
  238. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
  239. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
  240. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
  241. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
  242. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
  243. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
  244. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
  245. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
  246. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
  247. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
  248. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
  249. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
  250. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
  251. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
  252. package/ios/CodePush/JWT/LICENSE +0 -19
  253. package/ios/CodePush/JWT/README.md +0 -489
  254. package/ios/CodePush/SSZipArchive/Common.h +0 -81
  255. package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
  256. package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
  257. package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
  258. package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
  259. package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
  260. package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
  261. package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
  262. package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
  263. package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
  264. package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
  265. package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
  266. package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
  267. package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
  268. package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
  269. package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
  270. package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
  271. package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
  272. package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
  273. package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
  274. package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
  275. package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
  276. package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
  277. package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
  278. package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
  279. package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
  280. package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
  281. package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
  282. package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
  283. package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
  284. package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
  285. package/scripts/generateBundledResourcesHash.js +0 -125
  286. package/scripts/getFilesInFolder.js +0 -19
  287. package/scripts/recordFilesBeforeBundleCommand.js +0 -41
  288. package/scripts/release.sh +0 -86
  289. package/tsconfig.json +0 -20
  290. package/tslint.json +0 -32
  291. /package/{logging.js → src/logging.js} +0 -0
  292. /package/{versioning → src/versioning}/BaseVersioning.test.js +0 -0
  293. /package/{versioning → src/versioning}/IncrementalVersioning.js +0 -0
  294. /package/{versioning → src/versioning}/IncrementalVersioning.test.js +0 -0
  295. /package/{versioning → src/versioning}/SemverVersioning.js +0 -0
  296. /package/{versioning → src/versioning}/index.js +0 -0
@@ -1,123 +0,0 @@
1
- const { program } = require('commander')
2
- const { findAndReadConfigFile } = require('../../utils/fsUtils')
3
- const { updateReleaseHistory } = require('./updateReleaseHistory')
4
- const { COMPILED_CONFIG_FILE_NAME } = require('../../constant')
5
- const {
6
- getAppValue,
7
- getPlatformValue,
8
- getIdentifierValue,
9
- getBinaryVersionValueFromList,
10
- getAppVersionValueFromList,
11
- } = require('../common')
12
-
13
- program
14
- .command('update-history')
15
- .description(
16
- 'Updates the release history for a specific binary version.\n`getReleaseHistory`, `setReleaseHistory` functions should be implemented in the config file.'
17
- )
18
- .option('-a, --app <string>', 'target app (user/device/b2c-device/home-device/home-mobile)')
19
- .option('-p, --platform <string>', 'target platform (ios/android)')
20
- .option('-i, --identifier <string>', 'target env identifier (dev/stg/prd)')
21
- .option('-b, --binary-version <string>', 'target binary version (x.y.z)')
22
- .option('-v, --app-version <string>', 'target codepush version (x.y.z)')
23
- .option(
24
- '-c, --config <path>',
25
- 'set config file name (JS/TS)',
26
- COMPILED_CONFIG_FILE_NAME
27
- )
28
- .option('-m, --mandatory', 'make the release to be mandatory', false)
29
- .option(
30
- '-e, --enable',
31
- 'make the release to be enabled (use --no-enable to disable)',
32
- true
33
- )
34
- .option('--no-enable', 'make the release to be disabled')
35
- .action(async (options) => {
36
- if (
37
- options.app &&
38
- !['user', 'device', 'b2c-device', 'home-device'].includes(options.app)
39
- ) {
40
- throw new Error('App must be either "user" or "device" or "b2c-device" or "home-device" or "home-mobile"')
41
- }
42
-
43
- if (options.platform && !['ios', 'android'].includes(options.platform)) {
44
- throw new Error('Platform must be either "ios" or "android"')
45
- }
46
-
47
- if (options.app !== 'user' && options.app !== 'home-mobile' && options.platform === 'ios') {
48
- throw new Error('Only user and home-mobile apps are supported on iOS')
49
- }
50
-
51
- if (
52
- options.identifier &&
53
- !['dev', 'stg', 'prd'].includes(options.identifier)
54
- ) {
55
- throw new Error('Identifier must be either "dev" or "stg" or "prd"')
56
- }
57
-
58
- const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
59
- if (options.binaryVersion && !semverRegex.test(options.binaryVersion)) {
60
- throw new Error('Binary version must be a valid semver format (x.y.z)')
61
- }
62
-
63
- if (options.appVersion && !semverRegex.test(options.appVersion)) {
64
- throw new Error('App version must be a valid semver format (x.y.z)')
65
- }
66
-
67
- const { getBinaryVersionList, getReleaseHistory, setReleaseHistory } =
68
- await findAndReadConfigFile(process.cwd(), options.config)
69
-
70
- const app = options.app || (await getAppValue())
71
-
72
- const platform =
73
- options.platform ||
74
- (app !== 'user' && 'android') ||
75
- (await getPlatformValue(app))
76
-
77
- const identifier = options.identifier || (await getIdentifierValue())
78
-
79
- const binaryVersion =
80
- options.binaryVersion ||
81
- (await getBinaryVersionValueFromList(
82
- getBinaryVersionList,
83
- app,
84
- platform,
85
- identifier
86
- ))
87
-
88
- const appVersion =
89
- options.appVersion ||
90
- (await getAppVersionValueFromList(
91
- getReleaseHistory,
92
- binaryVersion,
93
- app,
94
- platform
95
- ))
96
-
97
- const answers = {
98
- app,
99
- platform,
100
- identifier,
101
- binaryVersion,
102
- appVersion,
103
- }
104
-
105
- if (
106
- typeof options.mandatory !== 'boolean' &&
107
- typeof options.enable !== 'boolean'
108
- ) {
109
- console.error('No options specified. Exiting the program.')
110
- process.exit(1)
111
- }
112
-
113
- await updateReleaseHistory(
114
- answers.app,
115
- answers.appVersion,
116
- answers.binaryVersion,
117
- getReleaseHistory,
118
- setReleaseHistory,
119
- answers.platform,
120
- options.mandatory,
121
- options.enable
122
- )
123
- })
@@ -1,69 +0,0 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
- const { getTimestamp } = require('../../utils/datetime')
4
- /**
5
- * @param app {"user" | "device"}
6
- * @param appVersion {string}
7
- * @param binaryVersion {string}
8
- * @param getReleaseHistory {
9
- * function(
10
- * targetBinaryVersion: string,
11
- * platform: string,
12
- * ): Promise<ReleaseHistoryInterface>}
13
- * @param setReleaseHistory {
14
- * function(
15
- * targetBinaryVersion: string,
16
- * jsonFilePath: string,
17
- * releaseInfo: ReleaseHistoryInterface,
18
- * platform: string,
19
- * ): Promise<void>}
20
- * @param platform {"ios" | "android"}
21
- * @param mandatory {boolean?}
22
- * @param enable {boolean?}
23
- * @returns {Promise<void>}
24
- */
25
- async function updateReleaseHistory(
26
- app,
27
- appVersion,
28
- binaryVersion,
29
- getReleaseHistory,
30
- setReleaseHistory,
31
- platform,
32
- mandatory,
33
- enable
34
- ) {
35
- const releaseHistory = await getReleaseHistory(app, binaryVersion, platform)
36
-
37
- const updateInfo = releaseHistory[appVersion]
38
- if (!updateInfo) throw new Error(`${appVersion} is not released`)
39
-
40
- if (typeof mandatory === 'boolean') updateInfo.mandatory = mandatory
41
- if (typeof enable === 'boolean') updateInfo.enabled = enable
42
- updateInfo.updatedAt = getTimestamp()
43
-
44
- try {
45
- const JSON_FILE_NAME = `${binaryVersion}.json`
46
- const JSON_FILE_PATH = path.resolve(process.cwd(), JSON_FILE_NAME)
47
-
48
- console.log(
49
- `log: creating JSON file... ("${JSON_FILE_NAME}")\n`,
50
- JSON.stringify(releaseHistory, null, 2)
51
- )
52
- fs.writeFileSync(JSON_FILE_PATH, JSON.stringify(releaseHistory))
53
-
54
- await setReleaseHistory(
55
- binaryVersion,
56
- JSON_FILE_PATH,
57
- releaseHistory,
58
- app,
59
- platform
60
- )
61
-
62
- fs.unlinkSync(JSON_FILE_PATH)
63
- } catch (error) {
64
- console.error('Error occurred while updating history:', error)
65
- process.exit(1)
66
- }
67
- }
68
-
69
- module.exports = { updateReleaseHistory: updateReleaseHistory }
package/cli/constant.js DELETED
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- CONFIG_FILE_NAME: 'code-push.config.ts',
3
- OUTPUT_BUNDLE_DIR: 'bundleOutput',
4
- ROOT_OUTPUT_DIR: 'build',
5
- ENTRY_FILE: 'index.js',
6
- COMPILED_CONFIG_FILE_NAME: 'code-push.config.js',
7
- PACKAGE_PATH: '/node_modules/@algocare/react-native-code-push/',
8
- }
package/cli/index.js DELETED
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { program } = require('commander')
4
- const shell = require('shelljs')
5
- const { showLogo } = require('./utils/showLogo')
6
-
7
- shell.set('-e')
8
- shell.set('+v')
9
-
10
- program
11
- .name('npx code-push')
12
- .description('Command line interface for @algocare/react-native-code-push')
13
- .version('1.0.0')
14
- .action(() => {
15
- showLogo()
16
- })
17
-
18
- /**
19
- * npx code-push bundle
20
- */
21
- require('./commands/bundleCommand')
22
-
23
- /**
24
- * npx code-push create-history
25
- */
26
- require('./commands/createHistoryCommand')
27
-
28
- /**
29
- * npx code-push update-history
30
- */
31
- require('./commands/updateHistoryCommand')
32
-
33
- /**
34
- * npx code-push release
35
- */
36
- require('./commands/releaseCommand')
37
-
38
- /**
39
- * npx code-push show-history
40
- */
41
- require('./commands/showHistoryCommand')
42
-
43
- /**
44
- * npx code-push create-pr-history
45
- */
46
- require('./commands/createPullRequestHistoryCommand')
47
-
48
- /**
49
- * npx code-push create-pr-release
50
- */
51
- require('./commands/createPullRequestReleaseCommand')
52
-
53
- /**
54
- * npx code-push remove-pr-history
55
- */
56
- require('./commands/removePullRequestHistoryCommand')
57
-
58
- /**
59
- * npx code-push get-package-hash
60
- */
61
- require('./commands/getPackageHashCommand')
62
-
63
- program.parse()
@@ -1,22 +0,0 @@
1
- const getTimestamp = () => {
2
- const date = new Date()
3
- const year = date.getFullYear()
4
- const month = padWithZero(date.getMonth() + 1)
5
- const day = padWithZero(date.getDate())
6
- const hour = padWithZero(date.getHours())
7
- const minute = padWithZero(date.getMinutes())
8
- const second = padWithZero(date.getSeconds())
9
-
10
- return `${year}-${month}-${day} ${hour}:${minute}:${second}`
11
- }
12
-
13
- const padWithZero = (value) => {
14
- if (value < 10) {
15
- return `0${value}`
16
- }
17
- return value
18
- }
19
-
20
- module.exports = {
21
- getTimestamp,
22
- }
@@ -1,64 +0,0 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
- const { PACKAGE_PATH } = require('../constant')
4
- /**
5
- * allows to require a config file with .ts extension
6
- * @param filePath {string}
7
- * @returns {*} FIXME type
8
- */
9
- async function requireConfig(filePath) {
10
- const ext = path.extname(filePath)
11
-
12
- if (ext === '.ts') {
13
- try {
14
- require('ts-node').register({
15
- transpileOnly: true,
16
- compilerOptions: {
17
- module: 'CommonJS',
18
- esModuleInterop: true,
19
- allowJs: true,
20
- resolveJsonModule: true,
21
- experimentalDecorators: true,
22
- emitDecoratorMetadata: true,
23
- },
24
- })
25
-
26
- const config = await import(filePath)
27
- return config.default || config
28
- } catch {
29
- console.error(
30
- 'ts-node not found. Please install ts-node as a devDependency.'
31
- )
32
- process.exit(1)
33
- }
34
- } else if (ext === '.js') {
35
- // do nothing
36
- } else {
37
- throw new Error(`Unsupported file extension: ${ext}`)
38
- }
39
- return require(filePath)
40
- }
41
-
42
- /**
43
- * @param startDir {string}
44
- * @param configFileName {string}
45
- * @returns {*|null} FIXME type
46
- */
47
- async function findAndReadConfigFile(startDir, configFileName) {
48
- let dir = `${startDir}${PACKAGE_PATH}`
49
-
50
- while (dir !== path.parse(dir).root) {
51
- const configPath = path.join(dir, configFileName)
52
-
53
- if (fs.existsSync(configPath)) {
54
- const config = await requireConfig(configPath)
55
- return config
56
- }
57
- dir = path.dirname(dir)
58
- }
59
-
60
- console.error(`${configFileName} not found.`)
61
- return null
62
- }
63
-
64
- module.exports = { findAndReadConfigFile }
@@ -1,26 +0,0 @@
1
- async function getBinaryVersions(
2
- getBinaryVersionList,
3
- app,
4
- platform,
5
- identifier
6
- ) {
7
- const currentVersionList = await getBinaryVersionList(
8
- app,
9
- platform,
10
- identifier
11
- )
12
- return [
13
- Object.keys(currentVersionList),
14
- Object.keys(currentVersionList).pop(),
15
- ]
16
- }
17
-
18
- async function getAppVersions(getReleaseHistory, binaryVersion, app, platform) {
19
- const releaseHistory = await getReleaseHistory(app, binaryVersion, platform)
20
- return [Object.keys(releaseHistory), Object.keys(releaseHistory).pop()]
21
- }
22
-
23
- module.exports = {
24
- getBinaryVersions,
25
- getAppVersions,
26
- }
@@ -1,114 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-nocheck
3
-
4
- import {
5
- CliConfigInterface,
6
- ReleaseHistoryInterface,
7
- } from "@bravemobile/react-native-code-push";
8
- import * as fs from "fs";
9
- import axios from "axios"; // install as devDependency
10
- import * as SupabaseSDK from "@supabase/supabase-js"; // install as devDependency
11
-
12
- const SUPABASE_URL = process.env.SUPABASE_URL;
13
- const SUPABASE_KEY = process.env.SUPABASE_KEY;
14
- const supabase = SupabaseSDK.createClient(SUPABASE_URL!, SUPABASE_KEY!);
15
- const BUCKET_NAME = "codePush";
16
- const STORAGE_HOST = `${SUPABASE_URL}/storage/v1/object/public`;
17
-
18
- function historyJsonFileRemotePath(
19
- platform: "ios" | "android",
20
- identifier: string,
21
- binaryVersion: string,
22
- ) {
23
- return `histories/${platform}/${identifier}/${binaryVersion}.json`;
24
- }
25
-
26
- function bundleFileRemotePath(
27
- platform: "ios" | "android",
28
- identifier: string,
29
- fileName: string,
30
- ) {
31
- return `bundles/${platform}/${identifier}/${fileName}`;
32
- }
33
-
34
- const Config: CliConfigInterface = {
35
- bundleUploader: async (
36
- source: string,
37
- platform: "ios" | "android",
38
- identifier = "staging",
39
- ): Promise<{downloadUrl: string}> => {
40
- const fileName = source.split("/").pop();
41
- const fileStream = fs.createReadStream(source);
42
- const remotePath = bundleFileRemotePath(platform, identifier, fileName!);
43
-
44
- const {data, error} = await supabase.storage
45
- .from(BUCKET_NAME)
46
- .upload(remotePath, fileStream, {
47
- contentType: "application/zip",
48
- duplex: "half",
49
- });
50
-
51
- if (error) {
52
- console.error("Error uploading file:", error.message);
53
- throw error;
54
- }
55
-
56
- console.log("Bundle File uploaded:", `${STORAGE_HOST}/${data.fullPath}`);
57
-
58
- return {
59
- downloadUrl: `${STORAGE_HOST}/${data.fullPath}`,
60
- };
61
- },
62
-
63
- getReleaseHistory: async (
64
- targetBinaryVersion: string,
65
- platform: "ios" | "android",
66
- identifier = "staging",
67
- ): Promise<ReleaseHistoryInterface> => {
68
- const remoteJsonPath = historyJsonFileRemotePath(
69
- platform,
70
- identifier,
71
- targetBinaryVersion,
72
- );
73
- const {data} = await axios.get(
74
- `${STORAGE_HOST}/${BUCKET_NAME}/${remoteJsonPath}`,
75
- );
76
- return data as ReleaseHistoryInterface;
77
- },
78
-
79
- setReleaseHistory: async (
80
- targetBinaryVersion: string,
81
- jsonFilePath: string,
82
- releaseInfo: ReleaseHistoryInterface,
83
- platform: "ios" | "android",
84
- identifier = "staging",
85
- ): Promise<void> => {
86
- // upload JSON file or call API using `releaseInfo` metadata.
87
-
88
- const fileContent = fs.readFileSync(jsonFilePath, "utf8");
89
- const remoteJsonPath = historyJsonFileRemotePath(
90
- platform,
91
- identifier,
92
- targetBinaryVersion,
93
- );
94
-
95
- const {data, error} = await supabase.storage
96
- .from(BUCKET_NAME)
97
- .upload(remoteJsonPath, Buffer.from(fileContent), {
98
- contentType: "application/json",
99
- cacheControl: "5",
100
- });
101
-
102
- if (error) {
103
- console.error("Error uploading file:", error.message);
104
- throw error;
105
- }
106
-
107
- console.log(
108
- "Release history File uploaded:",
109
- `${STORAGE_HOST}/${data.fullPath}`,
110
- );
111
- },
112
- };
113
-
114
- module.exports = Config;