@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,245 +0,0 @@
1
- const inquirer = require('inquirer').default
2
- const { getBinaryVersions, getAppVersions } = require('../utils/version')
3
- const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
4
-
5
- async function getAppValue() {
6
- const { app } = await inquirer.prompt([
7
- {
8
- type: 'list',
9
- name: 'app',
10
- message: 'Select the target app',
11
- choices: ['user', 'device', 'b2c-device', 'home-device', 'home-mobile'],
12
- },
13
- ])
14
- return app
15
- }
16
-
17
- async function getPlatformValue(app) {
18
- const platformAnswer = await inquirer.prompt([
19
- {
20
- type: 'list',
21
- name: 'platform',
22
- message: 'Select the target platform',
23
- choices: ['ios', 'android'],
24
- when: () => app === 'user',
25
- },
26
- ])
27
- return app === 'user' ? platformAnswer.platform : 'android'
28
- }
29
-
30
- async function getIdentifierValue() {
31
- const { identifier } = await inquirer.prompt([
32
- {
33
- type: 'list',
34
- name: 'identifier',
35
- message: 'Select the target env identifier',
36
- choices: ['dev', 'stg', 'prd'],
37
- },
38
- ])
39
- return identifier
40
- }
41
-
42
- async function getBinaryVersionValueFromList(
43
- getBinaryVersionList,
44
- app,
45
- platform,
46
- identifier,
47
- count = 5
48
- ) {
49
- const [currentBinaryVersionList] = await getBinaryVersions(
50
- getBinaryVersionList,
51
- app,
52
- platform,
53
- identifier
54
- )
55
-
56
- if (!currentBinaryVersionList.length) {
57
- console.log('There is no binary version list')
58
- return []
59
- }
60
-
61
- if (typeof count !== 'number' || count < 1) {
62
- console.warn('count must be a number and greater than 1')
63
- return []
64
- }
65
-
66
- const latestBinaryVersion = currentBinaryVersionList.slice(-count)
67
- const binaryVersionChoices = [
68
- ...latestBinaryVersion,
69
- new inquirer.Separator(),
70
- 'Enter manually',
71
- ]
72
- const binaryVersionSelectionAnswer = await inquirer.prompt([
73
- {
74
- type: 'list',
75
- name: 'versionChoice',
76
- message:
77
- 'This is last 5 versions. Select a binary version or enter manually',
78
- choices: binaryVersionChoices,
79
- },
80
- ])
81
- let binaryVersion
82
- if (binaryVersionSelectionAnswer.versionChoice === 'Enter manually') {
83
- const binaryVersionAnswer = await inquirer.prompt([
84
- {
85
- type: 'input',
86
- name: 'binaryVersion',
87
- message: 'Enter the target binary version',
88
- validate: (input) => {
89
- if (!semverRegex.test(input)) {
90
- return 'Please enter a valid version number (x.y.z)'
91
- }
92
- return true
93
- },
94
- },
95
- ])
96
- binaryVersion = binaryVersionAnswer.binaryVersion
97
- } else {
98
- binaryVersion = binaryVersionSelectionAnswer.versionChoice
99
- }
100
-
101
- return binaryVersion
102
- }
103
-
104
- async function getAppVersionValueFromList(
105
- getReleaseHistory,
106
- binaryVersion,
107
- app,
108
- platform,
109
- count = 5
110
- ) {
111
- const [currentAppVersionList] = await getAppVersions(
112
- getReleaseHistory,
113
- binaryVersion,
114
- app,
115
- platform
116
- )
117
-
118
- if (!currentAppVersionList.length) {
119
- console.log('There is no app version list')
120
- return
121
- }
122
-
123
- if (typeof count !== 'number' || count < 1) {
124
- console.warn('count must be a number and greater than 1')
125
- return
126
- }
127
-
128
- const latestAppVersion = currentAppVersionList.slice(-count)
129
- const appVersionChoices = [
130
- ...latestAppVersion,
131
- new inquirer.Separator(),
132
- 'Enter manually',
133
- ]
134
- const appVersionSelectionAnswer = await inquirer.prompt([
135
- {
136
- type: 'list',
137
- name: 'appVersionChoice',
138
- message:
139
- 'This is last 5 versions. Select a binary version or enter manually',
140
- choices: appVersionChoices,
141
- },
142
- ])
143
- let appVersion
144
- if (appVersionSelectionAnswer.versionChoice === 'Enter manually') {
145
- const appVersionAnswer = await inquirer.prompt([
146
- {
147
- type: 'input',
148
- name: 'appVersion',
149
- message: 'Enter the target app version',
150
- validate: (input) => {
151
- if (!semverRegex.test(input)) {
152
- return 'Please enter a valid version number (x.y.z)'
153
- }
154
- return true
155
- },
156
- },
157
- ])
158
- appVersion = appVersionAnswer.appVersion
159
- } else {
160
- appVersion = appVersionSelectionAnswer.appVersionChoice
161
- }
162
-
163
- return appVersion
164
- }
165
-
166
- async function getBinaryVersionValueFromInput(
167
- getBinaryVersionList,
168
- app,
169
- platform,
170
- identifier
171
- ) {
172
- const [, lastBinaryVersion] = await getBinaryVersions(
173
- getBinaryVersionList,
174
- app,
175
- platform,
176
- identifier
177
- )
178
-
179
- const message = lastBinaryVersion
180
- ? `Enter the target binary version (current latest: ${lastBinaryVersion})`
181
- : 'Enter the target binary version (there is no latest version)'
182
-
183
- const { binaryVersion } = await inquirer.prompt([
184
- {
185
- type: 'input',
186
- name: 'binaryVersion',
187
- message,
188
- validate: (input) => {
189
- if (!semverRegex.test(input)) {
190
- return 'Please enter a valid version number (x.y.z)'
191
- }
192
- return true
193
- },
194
- },
195
- ])
196
-
197
- return binaryVersion
198
- }
199
-
200
- async function getAppVersionValueFromInput(
201
- getReleaseHistory,
202
- binaryVersion,
203
- app,
204
- platform
205
- ) {
206
- const [currentAppVersionList, lastAppVersion] = await getAppVersions(
207
- getReleaseHistory,
208
- binaryVersion,
209
- app,
210
- platform
211
- )
212
-
213
- const message = lastAppVersion
214
- ? `Enter the target app version (current latest: ${lastAppVersion})`
215
- : 'Enter the target app version (there is no latest version)'
216
-
217
- const { appVersion } = await inquirer.prompt([
218
- {
219
- type: 'input',
220
- name: 'appVersion',
221
- message,
222
- validate: (input) => {
223
- if (!semverRegex.test(input)) {
224
- return 'Please enter a valid version number (x.y.z)'
225
- }
226
- if (currentAppVersionList.includes(input)) {
227
- return `Version ${input} already exists`
228
- }
229
- return true
230
- },
231
- },
232
- ])
233
-
234
- return appVersion
235
- }
236
-
237
- module.exports = {
238
- getAppValue,
239
- getPlatformValue,
240
- getIdentifierValue,
241
- getBinaryVersionValueFromList,
242
- getAppVersionValueFromList,
243
- getBinaryVersionValueFromInput,
244
- getAppVersionValueFromInput,
245
- }
@@ -1,42 +0,0 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
-
4
- /**
5
- * @param app {"user" | "device"}
6
- * @param targetVersion {string}
7
- * @param setReleaseHistory {
8
- * function(
9
- * targetBinaryVersion: string,
10
- * jsonFilePath: string,
11
- * releaseInfo: ReleaseHistoryInterface,
12
- * platform: string,
13
- * ): Promise<void>}
14
- * @param platform {"ios" | "android"}
15
- * @returns {Promise<void>}
16
- */
17
- async function createReleaseHistory(
18
- app,
19
- targetVersion,
20
- setReleaseHistory,
21
- platform
22
- ) {
23
- try {
24
- const JSON_FILE_NAME = `${targetVersion}.json`
25
- const JSON_FILE_PATH = path.resolve(process.cwd(), JSON_FILE_NAME)
26
-
27
- console.log(
28
- `log: creating JSON file... ("${JSON_FILE_NAME}")\n`,
29
- JSON.stringify({}, null, 2)
30
- )
31
- fs.writeFileSync(JSON_FILE_PATH, JSON.stringify({}))
32
-
33
- await setReleaseHistory(targetVersion, JSON_FILE_PATH, {}, app, platform)
34
-
35
- fs.unlinkSync(JSON_FILE_PATH)
36
- } catch (error) {
37
- console.error('Error occurred while creating new history:', error)
38
- process.exit(1)
39
- }
40
- }
41
-
42
- module.exports = { createReleaseHistory: createReleaseHistory }
@@ -1,52 +0,0 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
-
4
- /**
5
- * @param app {"user" | "device"}
6
- * @param targetVersion {string}
7
- * @param platform {"ios" | "android"}
8
- * @param getBinaryVersionList {
9
- * function(
10
- * app: string,
11
- * platform: string,
12
- * ): Promise<{ [version: string]: string }>
13
- * }
14
- * @param setBinaryVersionList {
15
- * function(
16
- * targetVersion: string,
17
- * app: string,
18
- * platform: string,
19
- * ): Promise<void>
20
- * }
21
- * @returns {Promise<void>}
22
- */
23
- async function createReleaseHistoryList(
24
- app,
25
- targetVersion,
26
- platform,
27
- getBinaryVersionList,
28
- setBinaryVersionList
29
- ) {
30
- try {
31
- const JSON_FILE_NAME = 'list.json'
32
- const JSON_FILE_PATH = path.resolve(process.cwd(), JSON_FILE_NAME)
33
-
34
- const currentList = await getBinaryVersionList(app, platform)
35
-
36
- if (currentList[targetVersion]) {
37
- console.error(`Version ${targetVersion} is already released`)
38
- process.exit(1)
39
- }
40
-
41
- fs.writeFileSync(JSON_FILE_PATH, JSON.stringify(currentList))
42
-
43
- await setBinaryVersionList(targetVersion, JSON_FILE_PATH, app, platform)
44
-
45
- fs.unlinkSync(JSON_FILE_PATH)
46
- } catch (error) {
47
- console.error('Error occurred while creating new history list:', error)
48
- process.exit(1)
49
- }
50
- }
51
-
52
- module.exports = { createReleaseHistoryList }
@@ -1,95 +0,0 @@
1
- const { program } = require('commander')
2
- const { findAndReadConfigFile } = require('../../utils/fsUtils')
3
- const { createReleaseHistory } = require('./createReleaseHistory')
4
- const { createReleaseHistoryList } = require('./createReleaseHistoryList')
5
- const { COMPILED_CONFIG_FILE_NAME } = require('../../constant')
6
- const {
7
- getAppValue,
8
- getPlatformValue,
9
- getIdentifierValue,
10
- getBinaryVersionValueFromInput,
11
- } = require('../common')
12
-
13
- program
14
- .command('create-history')
15
- .description('Creates a new release history for the binary app.')
16
- .option('-a, --app <string>', 'target app (user/device/b2c-device/home-device/home-mobile)')
17
- .option('-p, --platform <string>', 'target platform (ios/android)')
18
- .option('-i, --identifier <string>', 'target env identifier (dev/stg/prd)')
19
- .option('-b, --binary-version <string>', 'target binary version (x.y.z)')
20
- .option(
21
- '-c, --config <path>',
22
- 'set config file name (JS/TS)',
23
- COMPILED_CONFIG_FILE_NAME
24
- )
25
- .action(async (options) => {
26
- if (
27
- options.app &&
28
- !['user', 'device', 'b2c-device', 'home-device', 'home-mobile'].includes(options.app)
29
- ) {
30
- throw new Error('App must be either "user" or "device" or "b2c-device" or "home-device" or "home-mobile"')
31
- }
32
-
33
- if (options.platform && !['ios', 'android'].includes(options.platform)) {
34
- throw new Error('Platform must be either "ios" or "android"')
35
- }
36
-
37
- if (options.app !== 'user' && options.app !== 'home-mobile' && options.platform === 'ios') {
38
- throw new Error('Only user and home-mobile apps are supported on iOS')
39
- }
40
-
41
- if (
42
- options.identifier &&
43
- !['dev', 'stg', 'prd'].includes(options.identifier)
44
- ) {
45
- throw new Error('Identifier must be either "dev" or "stg" or "prd"')
46
- }
47
-
48
- const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
49
- if (options.binaryVersion && !semverRegex.test(options.binaryVersion)) {
50
- throw new Error('Binary version must be a valid semver format (x.y.z)')
51
- }
52
-
53
- const { setReleaseHistory, getBinaryVersionList, setBinaryVersionList } =
54
- await findAndReadConfigFile(process.cwd(), options.config)
55
-
56
- const app = options.app || (await getAppValue())
57
-
58
- const platform =
59
- options.platform ||
60
- (app !== 'user' && 'android') ||
61
- (await getPlatformValue(app))
62
-
63
- const identifier = options.identifier || (await getIdentifierValue())
64
-
65
- const binaryVersion =
66
- options.binaryVersion ||
67
- (await getBinaryVersionValueFromInput(
68
- getBinaryVersionList,
69
- app,
70
- platform,
71
- identifier
72
- ))
73
-
74
- const answers = {
75
- app,
76
- platform,
77
- identifier,
78
- binaryVersion,
79
- }
80
-
81
- await createReleaseHistory(
82
- answers.app,
83
- answers.binaryVersion,
84
- setReleaseHistory,
85
- answers.platform
86
- )
87
-
88
- await createReleaseHistoryList(
89
- answers.app,
90
- answers.binaryVersion,
91
- answers.platform,
92
- getBinaryVersionList,
93
- setBinaryVersionList
94
- )
95
- })
@@ -1,34 +0,0 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
-
4
- async function createPullRequestHistory(
5
- setReleaseHistory,
6
- binaryVersion,
7
- app,
8
- platform
9
- ) {
10
- try {
11
- const JSON_FILE_NAME = `${binaryVersion}.json`
12
- const JSON_FILE_PATH = path.resolve(process.cwd(), JSON_FILE_NAME)
13
-
14
- console.log(
15
- `log: creating JSON file... ("${JSON_FILE_NAME}")\n`,
16
- JSON.stringify({}, null, 2)
17
- )
18
- fs.writeFileSync(JSON_FILE_PATH, JSON.stringify({}))
19
-
20
- await setReleaseHistory(binaryVersion, JSON_FILE_PATH, {}, app, platform)
21
-
22
- fs.unlinkSync(JSON_FILE_PATH)
23
- } catch (error) {
24
- console.error(
25
- 'Error occurred while creating new pull request history:',
26
- error
27
- )
28
- process.exit(1)
29
- }
30
- }
31
-
32
- module.exports = {
33
- createPullRequestHistory,
34
- }
@@ -1,29 +0,0 @@
1
- const { program } = require('commander')
2
- const { COMPILED_CONFIG_FILE_NAME } = require('../../constant')
3
- const { findAndReadConfigFile } = require('../../utils/fsUtils')
4
- const { createPullRequestHistory } = require('./createPullRequestHistory')
5
-
6
- program
7
- .command('create-pr-history')
8
- .description('Creates a new pull request history.')
9
- .option('-a, --app <string>', 'target app (user/device/b2c-device/home-device/home-mobile)')
10
- .option('-p, --platform <string>', 'target platform (ios/android)')
11
- .option('-b, --binary-version <string>', 'target binary version (x.y.z)')
12
- .option(
13
- '-c, --config <path>',
14
- 'set config file name (JS/TS)',
15
- COMPILED_CONFIG_FILE_NAME
16
- )
17
- .action(async (options) => {
18
- const { setReleaseHistory } = await findAndReadConfigFile(
19
- process.cwd(),
20
- options.config
21
- )
22
-
23
- await createPullRequestHistory(
24
- setReleaseHistory,
25
- options.binaryVersion,
26
- options.app,
27
- options.platform
28
- )
29
- })
@@ -1,74 +0,0 @@
1
- const path = require('path')
2
- const fs = require('fs')
3
- const { getTimestamp } = require('../../utils/datetime')
4
-
5
- async function addToPullRequestRelease(
6
- app,
7
- binaryVersion,
8
- prNumber,
9
- bundleDownloadUrl,
10
- packageHash,
11
- platform,
12
- mandatory,
13
- enable,
14
- setReleaseHistory,
15
- getReleaseHistory
16
- ) {
17
- const releaseHistory = await getReleaseHistory(app, binaryVersion, platform)
18
-
19
- const latestReleaseHistoryKeys = Object.keys(releaseHistory)
20
- const releaseHistoryWithPRNumber = latestReleaseHistoryKeys.filter((key) =>
21
- key.includes(prNumber)
22
- )
23
-
24
- const newReleaseHistoryNumber = getNewReleaseHistoryNumber(
25
- releaseHistoryWithPRNumber,
26
- prNumber
27
- )
28
- const newReleaseHistory = structuredClone(releaseHistory)
29
-
30
- newReleaseHistory[newReleaseHistoryNumber] = {
31
- binaryVersion,
32
- enabled: enable,
33
- mandatory,
34
- downloadUrl: bundleDownloadUrl,
35
- packageHash,
36
- createdAt: getTimestamp(),
37
- }
38
-
39
- try {
40
- const JSON_FILE_NAME = `${binaryVersion}.json`
41
- const JSON_FILE_PATH = path.resolve(process.cwd(), JSON_FILE_NAME)
42
-
43
- console.log(
44
- `log: creating JSON file... ("${JSON_FILE_NAME}")\n`,
45
- JSON.stringify(newReleaseHistory, null, 2)
46
- )
47
- fs.writeFileSync(JSON_FILE_PATH, JSON.stringify(newReleaseHistory))
48
-
49
- await setReleaseHistory(
50
- binaryVersion,
51
- JSON_FILE_PATH,
52
- newReleaseHistory,
53
- app,
54
- platform
55
- )
56
- } catch (error) {
57
- console.error('Error occurred while updating history:', error)
58
- process.exit(1)
59
- }
60
- }
61
-
62
- module.exports = {
63
- addToPullRequestRelease,
64
- }
65
-
66
- function getNewReleaseHistoryNumber(releaseHistoryWithPRNumber, prNumber) {
67
- if (releaseHistoryWithPRNumber.length) {
68
- const [, latestVersion] = releaseHistoryWithPRNumber.at(-1).split('-')
69
- const newVersion = `${prNumber}-${Number(latestVersion[0]) + 1}.0.0`
70
- return newVersion
71
- } else {
72
- return `${prNumber}-1.0.0`
73
- }
74
- }
@@ -1,91 +0,0 @@
1
- const fs = require('fs')
2
- const { bundleCodePush } = require('../bundleCommand/bundleCodePush')
3
- const { addToPullRequestRelease } = require('./addToPullRequestRelease')
4
-
5
- async function createPullRequestRelease(
6
- bundleUploader,
7
- setReleaseHistory,
8
- getReleaseHistory,
9
- app,
10
- binaryVersion,
11
- prNumber,
12
- platform,
13
- outputPath,
14
- entryFile,
15
- jsBundleName,
16
- mandatory,
17
- enable,
18
- skipBundle,
19
- skipCleanup,
20
- bundleDirectory
21
- ) {
22
- const bundleFileName = skipBundle
23
- ? readBundleFileNameFrom(bundleDirectory)
24
- : await bundleCodePush(
25
- platform,
26
- outputPath,
27
- entryFile,
28
- jsBundleName,
29
- bundleDirectory
30
- )
31
- const bundleFilePath = `${bundleDirectory}/${bundleFileName}`
32
-
33
- const downloadUrl = await (async () => {
34
- try {
35
- console.log('Uploading Bundle File...')
36
- const { downloadUrl } = await bundleUploader(
37
- bundleFilePath,
38
- app,
39
- platform
40
- )
41
- console.log('Bundle File uploaded:', downloadUrl)
42
- return downloadUrl
43
- } catch (error) {
44
- console.error(
45
- 'Failed to upload the bundle file. Exiting the program.',
46
- error
47
- )
48
- process.exit(1)
49
- }
50
- })()
51
-
52
- await addToPullRequestRelease(
53
- app,
54
- binaryVersion,
55
- prNumber,
56
- downloadUrl,
57
- bundleFileName,
58
- platform,
59
- mandatory,
60
- enable,
61
- setReleaseHistory,
62
- getReleaseHistory
63
- )
64
-
65
- if (!skipCleanup) {
66
- cleanUpOutputs(outputPath)
67
- }
68
- }
69
-
70
- function cleanUpOutputs(dir) {
71
- fs.rmSync(dir, { recursive: true })
72
- }
73
-
74
- /**
75
- * @param bundleDirectory {string}
76
- * @return {string}
77
- */
78
- function readBundleFileNameFrom(bundleDirectory) {
79
- const files = fs.readdirSync(bundleDirectory)
80
- if (files.length !== 1) {
81
- console.error('The bundlePath must contain only one file.')
82
- process.exit(1)
83
- }
84
- const path = require('path')
85
- const bundleFilePath = path.join(bundleDirectory, files[0])
86
- return path.basename(bundleFilePath)
87
- }
88
-
89
- module.exports = {
90
- createPullRequestRelease,
91
- }