@algocare/react-native-code-push 10.3.2 → 11.0.1
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.
- package/CodePush.js +440 -293
- package/cli/commands/common.js +1 -1
- package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +3 -3
- package/cli/commands/createPullRequestHistoryCommand/index.js +1 -2
- package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +23 -7
- package/cli/commands/releaseCommand/index.js +6 -3
- package/cli/index.js +0 -5
- package/package.json +1 -1
- package/typings/react-native-code-push.d.ts +487 -465
- package/cli/commands/getDevelopmentKeyCommand/index.js +0 -31
package/cli/commands/common.js
CHANGED
|
@@ -3,12 +3,12 @@ const path = require('path')
|
|
|
3
3
|
|
|
4
4
|
async function createPullRequestHistory(
|
|
5
5
|
setReleaseHistory,
|
|
6
|
-
|
|
6
|
+
binaryVersion,
|
|
7
7
|
app,
|
|
8
8
|
platform
|
|
9
9
|
) {
|
|
10
10
|
try {
|
|
11
|
-
const JSON_FILE_NAME = `${
|
|
11
|
+
const JSON_FILE_NAME = `${binaryVersion}.json`
|
|
12
12
|
const JSON_FILE_PATH = path.resolve(process.cwd(), JSON_FILE_NAME)
|
|
13
13
|
|
|
14
14
|
console.log(
|
|
@@ -17,7 +17,7 @@ async function createPullRequestHistory(
|
|
|
17
17
|
)
|
|
18
18
|
fs.writeFileSync(JSON_FILE_PATH, JSON.stringify({}))
|
|
19
19
|
|
|
20
|
-
await setReleaseHistory(
|
|
20
|
+
await setReleaseHistory(binaryVersion, JSON_FILE_PATH, {}, app, platform)
|
|
21
21
|
|
|
22
22
|
fs.unlinkSync(JSON_FILE_PATH)
|
|
23
23
|
} catch (error) {
|
|
@@ -8,7 +8,6 @@ program
|
|
|
8
8
|
.description('Creates a new pull request history.')
|
|
9
9
|
.option('-a, --app <string>', 'target app (user/device)')
|
|
10
10
|
.option('-p, --platform <string>', 'target platform (ios/android)')
|
|
11
|
-
.option('-r, --pr-number <number>', 'pull request number')
|
|
12
11
|
.option(
|
|
13
12
|
'-c, --config <path>',
|
|
14
13
|
'set config file name (JS/TS)',
|
|
@@ -22,7 +21,7 @@ program
|
|
|
22
21
|
|
|
23
22
|
await createPullRequestHistory(
|
|
24
23
|
setReleaseHistory,
|
|
25
|
-
options.
|
|
24
|
+
options.binaryVersion,
|
|
26
25
|
options.app,
|
|
27
26
|
options.platform
|
|
28
27
|
)
|
|
@@ -13,12 +13,17 @@ async function addToPullRequestRelease(
|
|
|
13
13
|
setReleaseHistory,
|
|
14
14
|
getReleaseHistory
|
|
15
15
|
) {
|
|
16
|
-
const releaseHistory = await getReleaseHistory(app,
|
|
17
|
-
const latestReleaseHistoryNumber = Object.keys(releaseHistory).at(-1)
|
|
16
|
+
const releaseHistory = await getReleaseHistory(app, binaryVersion, platform)
|
|
18
17
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const latestReleaseHistoryKeys = Object.keys(releaseHistory)
|
|
19
|
+
const releaseHistoryWithPRNumber = latestReleaseHistoryKeys.filter((key) =>
|
|
20
|
+
key.includes(prNumber)
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const newReleaseHistoryNumber = getNewReleaseHistoryNumber(
|
|
24
|
+
releaseHistoryWithPRNumber,
|
|
25
|
+
prNumber
|
|
26
|
+
)
|
|
22
27
|
const newReleaseHistory = structuredClone(releaseHistory)
|
|
23
28
|
|
|
24
29
|
newReleaseHistory[newReleaseHistoryNumber] = {
|
|
@@ -30,7 +35,7 @@ async function addToPullRequestRelease(
|
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
try {
|
|
33
|
-
const JSON_FILE_NAME = `${
|
|
38
|
+
const JSON_FILE_NAME = `${binaryVersion}.json`
|
|
34
39
|
const JSON_FILE_PATH = path.resolve(process.cwd(), JSON_FILE_NAME)
|
|
35
40
|
|
|
36
41
|
console.log(
|
|
@@ -40,12 +45,13 @@ async function addToPullRequestRelease(
|
|
|
40
45
|
fs.writeFileSync(JSON_FILE_PATH, JSON.stringify(newReleaseHistory))
|
|
41
46
|
|
|
42
47
|
await setReleaseHistory(
|
|
43
|
-
|
|
48
|
+
binaryVersion,
|
|
44
49
|
JSON_FILE_PATH,
|
|
45
50
|
newReleaseHistory,
|
|
46
51
|
app,
|
|
47
52
|
platform
|
|
48
53
|
)
|
|
54
|
+
process.stdout.write(packageHash)
|
|
49
55
|
} catch (error) {
|
|
50
56
|
console.error('Error occurred while updating history:', error)
|
|
51
57
|
process.exit(1)
|
|
@@ -55,3 +61,13 @@ async function addToPullRequestRelease(
|
|
|
55
61
|
module.exports = {
|
|
56
62
|
addToPullRequestRelease,
|
|
57
63
|
}
|
|
64
|
+
|
|
65
|
+
function getNewReleaseHistoryNumber(releaseHistoryWithPRNumber, prNumber) {
|
|
66
|
+
if (releaseHistoryWithPRNumber.length) {
|
|
67
|
+
const [, latestVersion] = releaseHistoryWithPRNumber.at(-1).split('-')
|
|
68
|
+
const newVersion = `${prNumber}-${Number(latestVersion[0]) + 1}.0.0`
|
|
69
|
+
return newVersion
|
|
70
|
+
} else {
|
|
71
|
+
return `${prNumber}-1.0.0`
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -22,7 +22,7 @@ program
|
|
|
22
22
|
)
|
|
23
23
|
.option('-a, --app <string>', 'target app (user/device)')
|
|
24
24
|
.option('-p, --platform <string>', 'target platform (ios/android)')
|
|
25
|
-
.option('-i, --identifier <string>', 'target env identifier (stg/prd)')
|
|
25
|
+
.option('-i, --identifier <string>', 'target env identifier (dev/stg/prd)')
|
|
26
26
|
.option('-b, --binary-version <string>', 'target binary version (x.y.z)')
|
|
27
27
|
.option('-v, --app-version <string>', 'target codepush version (x.y.z)')
|
|
28
28
|
.option(
|
|
@@ -67,8 +67,11 @@ program
|
|
|
67
67
|
throw new Error('Device app is not supported on iOS')
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
if (
|
|
71
|
-
|
|
70
|
+
if (
|
|
71
|
+
options.identifier &&
|
|
72
|
+
!['dev', 'stg', 'prd'].includes(options.identifier)
|
|
73
|
+
) {
|
|
74
|
+
throw new Error('Identifier must be either "dev" or "stg" or "prd"')
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
|
package/cli/index.js
CHANGED