@algocare/react-native-code-push 11.0.3 → 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.
@@ -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.3",
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",