@algocare/react-native-code-push 10.0.1 → 10.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.
- package/cli/commands/common.js +3 -7
- package/cli/commands/createHistoryCommand/createReleaseHistory.js +2 -12
- package/cli/commands/createHistoryCommand/createReleaseHistoryList.js +2 -12
- package/cli/commands/createHistoryCommand/index.js +1 -3
- package/cli/commands/releaseCommand/addToReleaseHistory.js +2 -11
- package/cli/commands/releaseCommand/index.js +1 -3
- package/cli/commands/releaseCommand/release.js +1 -8
- package/cli/commands/showHistoryCommand/index.js +1 -2
- package/cli/commands/updateHistoryCommand/index.js +1 -3
- package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +2 -12
- package/cli/utils/version.js +2 -13
- package/code-push.config.js +7 -32
- package/package.json +1 -1
package/cli/commands/common.js
CHANGED
|
@@ -106,15 +106,13 @@ async function getAppVersionValueFromList(
|
|
|
106
106
|
binaryVersion,
|
|
107
107
|
app,
|
|
108
108
|
platform,
|
|
109
|
-
identifier,
|
|
110
109
|
count = 5
|
|
111
110
|
) {
|
|
112
111
|
const [currentAppVersionList] = await getAppVersions(
|
|
113
112
|
getReleaseHistory,
|
|
114
113
|
binaryVersion,
|
|
115
114
|
app,
|
|
116
|
-
platform
|
|
117
|
-
identifier
|
|
115
|
+
platform
|
|
118
116
|
)
|
|
119
117
|
|
|
120
118
|
if (!currentAppVersionList.length) {
|
|
@@ -203,15 +201,13 @@ async function getAppVersionValueFromInput(
|
|
|
203
201
|
getReleaseHistory,
|
|
204
202
|
binaryVersion,
|
|
205
203
|
app,
|
|
206
|
-
platform
|
|
207
|
-
identifier
|
|
204
|
+
platform
|
|
208
205
|
) {
|
|
209
206
|
const [currentAppVersionList, lastAppVersion] = await getAppVersions(
|
|
210
207
|
getReleaseHistory,
|
|
211
208
|
binaryVersion,
|
|
212
209
|
app,
|
|
213
|
-
platform
|
|
214
|
-
identifier
|
|
210
|
+
platform
|
|
215
211
|
)
|
|
216
212
|
|
|
217
213
|
const message = lastAppVersion
|
|
@@ -10,18 +10,15 @@ const path = require('path')
|
|
|
10
10
|
* jsonFilePath: string,
|
|
11
11
|
* releaseInfo: ReleaseHistoryInterface,
|
|
12
12
|
* platform: string,
|
|
13
|
-
* identifier: string
|
|
14
13
|
* ): Promise<void>}
|
|
15
14
|
* @param platform {"ios" | "android"}
|
|
16
|
-
* @param identifier {string}
|
|
17
15
|
* @returns {Promise<void>}
|
|
18
16
|
*/
|
|
19
17
|
async function createReleaseHistory(
|
|
20
18
|
app,
|
|
21
19
|
targetVersion,
|
|
22
20
|
setReleaseHistory,
|
|
23
|
-
platform
|
|
24
|
-
identifier
|
|
21
|
+
platform
|
|
25
22
|
) {
|
|
26
23
|
try {
|
|
27
24
|
const JSON_FILE_NAME = `${targetVersion}.json`
|
|
@@ -33,14 +30,7 @@ async function createReleaseHistory(
|
|
|
33
30
|
)
|
|
34
31
|
fs.writeFileSync(JSON_FILE_PATH, JSON.stringify({}))
|
|
35
32
|
|
|
36
|
-
await setReleaseHistory(
|
|
37
|
-
targetVersion,
|
|
38
|
-
JSON_FILE_PATH,
|
|
39
|
-
{},
|
|
40
|
-
app,
|
|
41
|
-
platform,
|
|
42
|
-
identifier
|
|
43
|
-
)
|
|
33
|
+
await setReleaseHistory(targetVersion, JSON_FILE_PATH, {}, app, platform)
|
|
44
34
|
|
|
45
35
|
fs.unlinkSync(JSON_FILE_PATH)
|
|
46
36
|
} catch (error) {
|
|
@@ -5,12 +5,10 @@ const path = require('path')
|
|
|
5
5
|
* @param app {"user" | "device"}
|
|
6
6
|
* @param targetVersion {string}
|
|
7
7
|
* @param platform {"ios" | "android"}
|
|
8
|
-
* @param identifier {string}
|
|
9
8
|
* @param getBinaryVersionList {
|
|
10
9
|
* function(
|
|
11
10
|
* app: string,
|
|
12
11
|
* platform: string,
|
|
13
|
-
* identifier: string
|
|
14
12
|
* ): Promise<{ [version: string]: string }>
|
|
15
13
|
* }
|
|
16
14
|
* @param setBinaryVersionList {
|
|
@@ -18,7 +16,6 @@ const path = require('path')
|
|
|
18
16
|
* targetVersion: string,
|
|
19
17
|
* app: string,
|
|
20
18
|
* platform: string,
|
|
21
|
-
* identifier: string
|
|
22
19
|
* ): Promise<void>
|
|
23
20
|
* }
|
|
24
21
|
* @returns {Promise<void>}
|
|
@@ -27,7 +24,6 @@ async function createReleaseHistoryList(
|
|
|
27
24
|
app,
|
|
28
25
|
targetVersion,
|
|
29
26
|
platform,
|
|
30
|
-
identifier,
|
|
31
27
|
getBinaryVersionList,
|
|
32
28
|
setBinaryVersionList
|
|
33
29
|
) {
|
|
@@ -35,7 +31,7 @@ async function createReleaseHistoryList(
|
|
|
35
31
|
const JSON_FILE_NAME = 'list.json'
|
|
36
32
|
const JSON_FILE_PATH = path.resolve(process.cwd(), JSON_FILE_NAME)
|
|
37
33
|
|
|
38
|
-
const currentList = await getBinaryVersionList(app, platform
|
|
34
|
+
const currentList = await getBinaryVersionList(app, platform)
|
|
39
35
|
|
|
40
36
|
if (currentList[targetVersion]) {
|
|
41
37
|
console.error(`Version ${targetVersion} is already released`)
|
|
@@ -44,13 +40,7 @@ async function createReleaseHistoryList(
|
|
|
44
40
|
|
|
45
41
|
fs.writeFileSync(JSON_FILE_PATH, JSON.stringify(currentList))
|
|
46
42
|
|
|
47
|
-
await setBinaryVersionList(
|
|
48
|
-
targetVersion,
|
|
49
|
-
JSON_FILE_PATH,
|
|
50
|
-
app,
|
|
51
|
-
platform,
|
|
52
|
-
identifier
|
|
53
|
-
)
|
|
43
|
+
await setBinaryVersionList(targetVersion, JSON_FILE_PATH, app, platform)
|
|
54
44
|
|
|
55
45
|
fs.unlinkSync(JSON_FILE_PATH)
|
|
56
46
|
} catch (error) {
|
|
@@ -45,15 +45,13 @@ program
|
|
|
45
45
|
answers.app,
|
|
46
46
|
answers.binaryVersion,
|
|
47
47
|
config.setReleaseHistory,
|
|
48
|
-
answers.platform
|
|
49
|
-
answers.identifier
|
|
48
|
+
answers.platform
|
|
50
49
|
)
|
|
51
50
|
|
|
52
51
|
await createReleaseHistoryList(
|
|
53
52
|
answers.app,
|
|
54
53
|
answers.binaryVersion,
|
|
55
54
|
answers.platform,
|
|
56
|
-
answers.identifier,
|
|
57
55
|
config.getBinaryVersionList,
|
|
58
56
|
config.setBinaryVersionList
|
|
59
57
|
)
|
|
@@ -19,10 +19,8 @@ const fs = require('fs')
|
|
|
19
19
|
* jsonFilePath: string,
|
|
20
20
|
* releaseInfo: ReleaseHistoryInterface,
|
|
21
21
|
* platform: string,
|
|
22
|
-
* identifier?: string
|
|
23
22
|
* ): Promise<void>}
|
|
24
23
|
* @param platform {"ios" | "android"}
|
|
25
|
-
* @param identifier {string?}
|
|
26
24
|
* @param mandatory {boolean?}
|
|
27
25
|
* @param enable {boolean?}
|
|
28
26
|
* @returns {Promise<void>}
|
|
@@ -36,16 +34,10 @@ async function addToReleaseHistory(
|
|
|
36
34
|
getReleaseHistory,
|
|
37
35
|
setReleaseHistory,
|
|
38
36
|
platform,
|
|
39
|
-
identifier,
|
|
40
37
|
mandatory,
|
|
41
38
|
enable
|
|
42
39
|
) {
|
|
43
|
-
const releaseHistory = await getReleaseHistory(
|
|
44
|
-
app,
|
|
45
|
-
binaryVersion,
|
|
46
|
-
platform,
|
|
47
|
-
identifier
|
|
48
|
-
)
|
|
40
|
+
const releaseHistory = await getReleaseHistory(app, binaryVersion, platform)
|
|
49
41
|
|
|
50
42
|
const updateInfo = releaseHistory[appVersion]
|
|
51
43
|
if (updateInfo) {
|
|
@@ -77,8 +69,7 @@ async function addToReleaseHistory(
|
|
|
77
69
|
JSON_FILE_PATH,
|
|
78
70
|
newReleaseHistory,
|
|
79
71
|
app,
|
|
80
|
-
platform
|
|
81
|
-
identifier
|
|
72
|
+
platform
|
|
82
73
|
)
|
|
83
74
|
|
|
84
75
|
fs.unlinkSync(JSON_FILE_PATH)
|
|
@@ -121,8 +121,7 @@ program
|
|
|
121
121
|
getReleaseHistory,
|
|
122
122
|
binaryVersion,
|
|
123
123
|
app,
|
|
124
|
-
platform
|
|
125
|
-
identifier
|
|
124
|
+
platform
|
|
126
125
|
)
|
|
127
126
|
|
|
128
127
|
answers = {
|
|
@@ -142,7 +141,6 @@ program
|
|
|
142
141
|
answers.binaryVersion,
|
|
143
142
|
answers.appVersion,
|
|
144
143
|
answers.platform,
|
|
145
|
-
answers.identifier,
|
|
146
144
|
options.outputPath,
|
|
147
145
|
options.entryFile,
|
|
148
146
|
options.bundleName,
|
|
@@ -7,13 +7,11 @@ const { addToReleaseHistory } = require('./addToReleaseHistory')
|
|
|
7
7
|
* function(
|
|
8
8
|
* source: string,
|
|
9
9
|
* platform: "ios" | "android",
|
|
10
|
-
* identifier?: string
|
|
11
10
|
* ): Promise<{ downloadUrl: string }>}
|
|
12
11
|
* @param getReleaseHistory {
|
|
13
12
|
* function(
|
|
14
13
|
* targetBinaryVersion: string,
|
|
15
14
|
* platform: "ios" | "android",
|
|
16
|
-
* identifier?: string
|
|
17
15
|
* ): Promise<ReleaseHistoryInterface>}
|
|
18
16
|
* @param setReleaseHistory {
|
|
19
17
|
* function(
|
|
@@ -21,13 +19,11 @@ const { addToReleaseHistory } = require('./addToReleaseHistory')
|
|
|
21
19
|
* jsonFilePath: string,
|
|
22
20
|
* releaseInfo: ReleaseHistoryInterface,
|
|
23
21
|
* platform: "ios" | "android",
|
|
24
|
-
* identifier?: string
|
|
25
22
|
* ): Promise<void>}
|
|
26
23
|
* @param app {"user" | "device"}
|
|
27
24
|
* @param binaryVersion {string}
|
|
28
25
|
* @param appVersion {string}
|
|
29
26
|
* @param platform {"ios" | "android"}
|
|
30
|
-
* @param identifier {string?}
|
|
31
27
|
* @param outputPath {string}
|
|
32
28
|
* @param entryFile {string}
|
|
33
29
|
* @param jsBundleName {string}
|
|
@@ -46,7 +42,6 @@ async function release(
|
|
|
46
42
|
binaryVersion,
|
|
47
43
|
appVersion,
|
|
48
44
|
platform,
|
|
49
|
-
identifier,
|
|
50
45
|
outputPath,
|
|
51
46
|
entryFile,
|
|
52
47
|
jsBundleName,
|
|
@@ -73,8 +68,7 @@ async function release(
|
|
|
73
68
|
const { downloadUrl } = await bundleUploader(
|
|
74
69
|
bundleFilePath,
|
|
75
70
|
app,
|
|
76
|
-
platform
|
|
77
|
-
identifier
|
|
71
|
+
platform
|
|
78
72
|
)
|
|
79
73
|
console.log('Bundle File uploaded:', downloadUrl)
|
|
80
74
|
return downloadUrl
|
|
@@ -96,7 +90,6 @@ async function release(
|
|
|
96
90
|
getReleaseHistory,
|
|
97
91
|
setReleaseHistory,
|
|
98
92
|
platform,
|
|
99
|
-
identifier,
|
|
100
93
|
mandatory,
|
|
101
94
|
enable
|
|
102
95
|
)
|
|
@@ -47,8 +47,7 @@ program
|
|
|
47
47
|
config.getReleaseHistory,
|
|
48
48
|
binaryVersion,
|
|
49
49
|
app,
|
|
50
|
-
platform
|
|
51
|
-
identifier
|
|
50
|
+
platform
|
|
52
51
|
)
|
|
53
52
|
|
|
54
53
|
const answers = {
|
|
@@ -74,7 +73,6 @@ program
|
|
|
74
73
|
config.getReleaseHistory,
|
|
75
74
|
config.setReleaseHistory,
|
|
76
75
|
answers.platform,
|
|
77
|
-
answers.identifier,
|
|
78
76
|
options.mandatory,
|
|
79
77
|
options.enable
|
|
80
78
|
)
|
|
@@ -9,7 +9,6 @@ const path = require('path')
|
|
|
9
9
|
* function(
|
|
10
10
|
* targetBinaryVersion: string,
|
|
11
11
|
* platform: string,
|
|
12
|
-
* identifier?: string
|
|
13
12
|
* ): Promise<ReleaseHistoryInterface>}
|
|
14
13
|
* @param setReleaseHistory {
|
|
15
14
|
* function(
|
|
@@ -17,10 +16,8 @@ const path = require('path')
|
|
|
17
16
|
* jsonFilePath: string,
|
|
18
17
|
* releaseInfo: ReleaseHistoryInterface,
|
|
19
18
|
* platform: string,
|
|
20
|
-
* identifier?: string
|
|
21
19
|
* ): Promise<void>}
|
|
22
20
|
* @param platform {"ios" | "android"}
|
|
23
|
-
* @param identifier {string?}
|
|
24
21
|
* @param mandatory {boolean?}
|
|
25
22
|
* @param enable {boolean?}
|
|
26
23
|
* @returns {Promise<void>}
|
|
@@ -32,16 +29,10 @@ async function updateReleaseHistory(
|
|
|
32
29
|
getReleaseHistory,
|
|
33
30
|
setReleaseHistory,
|
|
34
31
|
platform,
|
|
35
|
-
identifier,
|
|
36
32
|
mandatory,
|
|
37
33
|
enable
|
|
38
34
|
) {
|
|
39
|
-
const releaseHistory = await getReleaseHistory(
|
|
40
|
-
app,
|
|
41
|
-
binaryVersion,
|
|
42
|
-
platform,
|
|
43
|
-
identifier
|
|
44
|
-
)
|
|
35
|
+
const releaseHistory = await getReleaseHistory(app, binaryVersion, platform)
|
|
45
36
|
|
|
46
37
|
const updateInfo = releaseHistory[appVersion]
|
|
47
38
|
if (!updateInfo) throw new Error(`v${appVersion} is not released`)
|
|
@@ -64,8 +55,7 @@ async function updateReleaseHistory(
|
|
|
64
55
|
JSON_FILE_PATH,
|
|
65
56
|
releaseHistory,
|
|
66
57
|
app,
|
|
67
|
-
platform
|
|
68
|
-
identifier
|
|
58
|
+
platform
|
|
69
59
|
)
|
|
70
60
|
|
|
71
61
|
fs.unlinkSync(JSON_FILE_PATH)
|
package/cli/utils/version.js
CHANGED
|
@@ -15,19 +15,8 @@ async function getBinaryVersions(
|
|
|
15
15
|
]
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
async function getAppVersions(
|
|
19
|
-
getReleaseHistory,
|
|
20
|
-
binaryVersion,
|
|
21
|
-
app,
|
|
22
|
-
platform,
|
|
23
|
-
identifier
|
|
24
|
-
) {
|
|
25
|
-
const releaseHistory = await getReleaseHistory(
|
|
26
|
-
app,
|
|
27
|
-
binaryVersion,
|
|
28
|
-
platform,
|
|
29
|
-
identifier
|
|
30
|
-
)
|
|
18
|
+
async function getAppVersions(getReleaseHistory, binaryVersion, app, platform) {
|
|
19
|
+
const releaseHistory = await getReleaseHistory(app, binaryVersion, platform)
|
|
31
20
|
return [Object.keys(releaseHistory), Object.keys(releaseHistory).pop()]
|
|
32
21
|
}
|
|
33
22
|
|
package/code-push.config.js
CHANGED
|
@@ -14,18 +14,8 @@ const s3Client = new S3Client({
|
|
|
14
14
|
},
|
|
15
15
|
})
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
? process.env.AWS_S3_BUCKET_PRD || 'codepush-bucket'
|
|
20
|
-
: process.env.AWS_S3_BUCKET_STG || 'codepush-bucket'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function getCDNUrl(identifier) {
|
|
24
|
-
const BUCKET_NAME = getBucketName(identifier)
|
|
25
|
-
return identifier === 'prd'
|
|
26
|
-
? process.env.CDN_URL_PRD || `https://${BUCKET_NAME}.s3.amazonaws.com`
|
|
27
|
-
: process.env.CDN_URL_STG || `https://${BUCKET_NAME}.s3.amazonaws.com`
|
|
28
|
-
}
|
|
17
|
+
const BUCKET_NAME = process.env.AWS_S3_BUCKET || 'codepush-bucket'
|
|
18
|
+
const CDN_URL = process.env.CDN_URL || `https://${BUCKET_NAME}.s3.amazonaws.com`
|
|
29
19
|
|
|
30
20
|
function historyJsonFileRemotePath(app, platform, binaryVersion) {
|
|
31
21
|
return `histories/${app}/${platform}/${binaryVersion}.json`
|
|
@@ -36,12 +26,10 @@ function bundleFileRemotePath(app, platform, fileName) {
|
|
|
36
26
|
}
|
|
37
27
|
|
|
38
28
|
const Config = {
|
|
39
|
-
bundleUploader: async (source, app, platform
|
|
29
|
+
bundleUploader: async (source, app, platform) => {
|
|
40
30
|
const fileName = source.split('/').pop()
|
|
41
31
|
const fileContent = fs.readFileSync(source)
|
|
42
32
|
const remotePath = bundleFileRemotePath(app, platform, fileName)
|
|
43
|
-
const BUCKET_NAME = getBucketName(identifier)
|
|
44
|
-
const CDN_URL = getCDNUrl(identifier)
|
|
45
33
|
|
|
46
34
|
try {
|
|
47
35
|
await s3Client.send(
|
|
@@ -63,8 +51,7 @@ const Config = {
|
|
|
63
51
|
throw error
|
|
64
52
|
}
|
|
65
53
|
},
|
|
66
|
-
getReleaseHistory: async (app, targetBinaryVersion, platform
|
|
67
|
-
const CDN_URL = getCDNUrl(identifier)
|
|
54
|
+
getReleaseHistory: async (app, targetBinaryVersion, platform) => {
|
|
68
55
|
const remoteJsonPath = historyJsonFileRemotePath(
|
|
69
56
|
app,
|
|
70
57
|
platform,
|
|
@@ -79,8 +66,7 @@ const Config = {
|
|
|
79
66
|
jsonFilePath,
|
|
80
67
|
releaseInfo,
|
|
81
68
|
app,
|
|
82
|
-
platform
|
|
83
|
-
identifier
|
|
69
|
+
platform
|
|
84
70
|
) => {
|
|
85
71
|
const fileContent = fs.readFileSync(jsonFilePath, 'utf8')
|
|
86
72
|
const remoteJsonPath = historyJsonFileRemotePath(
|
|
@@ -88,8 +74,6 @@ const Config = {
|
|
|
88
74
|
platform,
|
|
89
75
|
targetBinaryVersion
|
|
90
76
|
)
|
|
91
|
-
const BUCKET_NAME = getBucketName(identifier)
|
|
92
|
-
const CDN_URL = getCDNUrl(identifier)
|
|
93
77
|
|
|
94
78
|
try {
|
|
95
79
|
await s3Client.send(
|
|
@@ -111,8 +95,7 @@ const Config = {
|
|
|
111
95
|
throw error
|
|
112
96
|
}
|
|
113
97
|
},
|
|
114
|
-
getBinaryVersionList: async (app, platform
|
|
115
|
-
const CDN_URL = getCDNUrl(identifier)
|
|
98
|
+
getBinaryVersionList: async (app, platform) => {
|
|
116
99
|
const remoteJsonPath = `histories/${app}/${platform}/list.json`
|
|
117
100
|
let currentList = {}
|
|
118
101
|
try {
|
|
@@ -127,16 +110,8 @@ const Config = {
|
|
|
127
110
|
}
|
|
128
111
|
return currentList
|
|
129
112
|
},
|
|
130
|
-
setBinaryVersionList: async (
|
|
131
|
-
targetVersion,
|
|
132
|
-
jsonFilePath,
|
|
133
|
-
app,
|
|
134
|
-
platform,
|
|
135
|
-
identifier
|
|
136
|
-
) => {
|
|
113
|
+
setBinaryVersionList: async (targetVersion, jsonFilePath, app, platform) => {
|
|
137
114
|
const remoteJsonPath = `histories/${app}/${platform}/list.json`
|
|
138
|
-
const BUCKET_NAME = getBucketName(identifier)
|
|
139
|
-
const CDN_URL = getCDNUrl(identifier)
|
|
140
115
|
|
|
141
116
|
const currentList = JSON.parse(fs.readFileSync(jsonFilePath, 'utf8'))
|
|
142
117
|
const targetVersionPath = historyJsonFileRemotePath(
|