@algocare/react-native-code-push 11.0.2 → 11.1.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.
@@ -51,7 +51,6 @@ async function addToPullRequestRelease(
51
51
  app,
52
52
  platform
53
53
  )
54
- process.stdout.write(packageHash)
55
54
  } catch (error) {
56
55
  console.error('Error occurred while updating history:', error)
57
56
  process.exit(1)
@@ -65,6 +65,8 @@ async function createPullRequestRelease(
65
65
  if (!skipCleanup) {
66
66
  cleanUpOutputs(outputPath)
67
67
  }
68
+
69
+ return bundleFileName
68
70
  }
69
71
 
70
72
  function cleanUpOutputs(dir) {
@@ -48,7 +48,7 @@ program
48
48
  const { bundleUploader, setReleaseHistory, getReleaseHistory } =
49
49
  await findAndReadConfigFile(process.cwd(), options.config)
50
50
 
51
- await createPullRequestRelease(
51
+ const bundleFileName = await createPullRequestRelease(
52
52
  bundleUploader,
53
53
  setReleaseHistory,
54
54
  getReleaseHistory,
@@ -65,4 +65,6 @@ program
65
65
  options.skipCleanup,
66
66
  options.outputBundleDir
67
67
  )
68
+
69
+ process.stdout.write(bundleFileName)
68
70
  })
@@ -0,0 +1,44 @@
1
+ const { program } = require('commander')
2
+ const { findAndReadConfigFile } = require('../../utils/fsUtils')
3
+ const { COMPILED_CONFIG_FILE_NAME } = require('../../constant')
4
+
5
+ program
6
+ .command('get-package-hash')
7
+ .description(
8
+ 'Retrieves and prints the package hash of a specific binary version.\n`getReleaseHistory` function should be implemented in the config file.'
9
+ )
10
+ .option('-a, --app <string>', 'target app (user/device)')
11
+ .option('-p, --platform <string>', 'target platform (ios/android)')
12
+ .option('-b, --binary-version <string>', 'target binary version (x.y.z)')
13
+ .option('-r, --pr-number <number>', 'pull request number')
14
+ .option(
15
+ '-c, --config <path>',
16
+ 'configuration file name (JS/TS)',
17
+ COMPILED_CONFIG_FILE_NAME
18
+ )
19
+ .action(async (options) => {
20
+ const { getReleaseHistory } = await findAndReadConfigFile(
21
+ process.cwd(),
22
+ options.config
23
+ )
24
+
25
+ const releaseHistory = await getReleaseHistory(
26
+ options.app,
27
+ options.binaryVersion,
28
+ options.platform
29
+ )
30
+
31
+ const filteredReleaseHistory = Object.entries(releaseHistory)
32
+ .filter(([key]) => key.includes(options.prNumber))
33
+ .reduce((acc, [key, value]) => {
34
+ acc[key] = value
35
+ return acc
36
+ }, {})
37
+
38
+ console.log(JSON.stringify(filteredReleaseHistory, null, 2))
39
+
40
+ const latestReleaseVersion = Object.keys(filteredReleaseHistory).at(-1)
41
+ process.stdout.write(
42
+ filteredReleaseHistory[latestReleaseVersion].packageHash
43
+ )
44
+ })
package/cli/index.js CHANGED
@@ -55,4 +55,9 @@ require('./commands/createPullRequestReleaseCommand')
55
55
  */
56
56
  require('./commands/removePullRequestHistoryCommand')
57
57
 
58
+ /**
59
+ * npx code-push get-package-hash
60
+ */
61
+ require('./commands/getPackageHashCommand')
62
+
58
63
  program.parse()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algocare/react-native-code-push",
3
- "version": "11.0.2",
3
+ "version": "11.1.0",
4
4
  "description": "React Native plugin for the CodePush service",
5
5
  "main": "CodePush.js",
6
6
  "typings": "typings/react-native-code-push.d.ts",