@algocare/react-native-code-push 10.0.0 → 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 +44 -58
- package/cli/commands/createHistoryCommand/createReleaseHistory.js +2 -12
- package/cli/commands/createHistoryCommand/createReleaseHistoryList.js +2 -12
- package/cli/commands/createHistoryCommand/index.js +3 -5
- package/cli/commands/releaseCommand/addToReleaseHistory.js +2 -11
- package/cli/commands/releaseCommand/index.js +5 -7
- package/cli/commands/releaseCommand/release.js +1 -8
- package/cli/commands/showHistoryCommand/index.js +3 -4
- package/cli/commands/updateHistoryCommand/index.js +5 -7
- 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
|
@@ -39,7 +39,7 @@ async function getIdentifierValue() {
|
|
|
39
39
|
return identifier
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
async function
|
|
42
|
+
async function getBinaryVersionValueFromList(
|
|
43
43
|
getBinaryVersionList,
|
|
44
44
|
app,
|
|
45
45
|
platform,
|
|
@@ -89,9 +89,6 @@ async function getBinaryVersionValue(
|
|
|
89
89
|
if (!semverRegex.test(input)) {
|
|
90
90
|
return 'Please enter a valid version number (x.y.z)'
|
|
91
91
|
}
|
|
92
|
-
if (currentBinaryVersionList.includes(input)) {
|
|
93
|
-
return `Version ${input} already exists`
|
|
94
|
-
}
|
|
95
92
|
return true
|
|
96
93
|
},
|
|
97
94
|
},
|
|
@@ -104,58 +101,18 @@ async function getBinaryVersionValue(
|
|
|
104
101
|
return binaryVersion
|
|
105
102
|
}
|
|
106
103
|
|
|
107
|
-
async function
|
|
108
|
-
getBinaryVersionList,
|
|
109
|
-
app,
|
|
110
|
-
platform,
|
|
111
|
-
identifier
|
|
112
|
-
) {
|
|
113
|
-
const [currentBinaryVersionList, lastBinaryVersion] = await getBinaryVersions(
|
|
114
|
-
getBinaryVersionList,
|
|
115
|
-
app,
|
|
116
|
-
platform,
|
|
117
|
-
identifier
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
const message = lastBinaryVersion
|
|
121
|
-
? `Enter the target binary version (current latest: ${lastBinaryVersion})`
|
|
122
|
-
: 'Enter the target binary version (there is no latest version)'
|
|
123
|
-
|
|
124
|
-
const { binaryVersion } = await inquirer.prompt([
|
|
125
|
-
{
|
|
126
|
-
type: 'input',
|
|
127
|
-
name: 'binaryVersion',
|
|
128
|
-
message,
|
|
129
|
-
validate: (input) => {
|
|
130
|
-
const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
|
|
131
|
-
if (!semverRegex.test(input)) {
|
|
132
|
-
return 'Please enter a valid version number (x.y.z)'
|
|
133
|
-
}
|
|
134
|
-
if (currentBinaryVersionList.includes(input)) {
|
|
135
|
-
return `Version ${input} already exists`
|
|
136
|
-
}
|
|
137
|
-
return true
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
])
|
|
141
|
-
|
|
142
|
-
return binaryVersion
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
async function getAppVersionValue(
|
|
104
|
+
async function getAppVersionValueFromList(
|
|
146
105
|
getReleaseHistory,
|
|
147
106
|
binaryVersion,
|
|
148
107
|
app,
|
|
149
108
|
platform,
|
|
150
|
-
identifier,
|
|
151
109
|
count = 5
|
|
152
110
|
) {
|
|
153
111
|
const [currentAppVersionList] = await getAppVersions(
|
|
154
112
|
getReleaseHistory,
|
|
155
113
|
binaryVersion,
|
|
156
114
|
app,
|
|
157
|
-
platform
|
|
158
|
-
identifier
|
|
115
|
+
platform
|
|
159
116
|
)
|
|
160
117
|
|
|
161
118
|
if (!currentAppVersionList.length) {
|
|
@@ -194,9 +151,6 @@ async function getAppVersionValue(
|
|
|
194
151
|
if (!semverRegex.test(input)) {
|
|
195
152
|
return 'Please enter a valid version number (x.y.z)'
|
|
196
153
|
}
|
|
197
|
-
if (currentAppVersionList.includes(input)) {
|
|
198
|
-
return `Version ${input} already exists`
|
|
199
|
-
}
|
|
200
154
|
return true
|
|
201
155
|
},
|
|
202
156
|
},
|
|
@@ -209,19 +163,51 @@ async function getAppVersionValue(
|
|
|
209
163
|
return appVersion
|
|
210
164
|
}
|
|
211
165
|
|
|
212
|
-
async function
|
|
213
|
-
|
|
214
|
-
binaryVersion,
|
|
166
|
+
async function getBinaryVersionValueFromInput(
|
|
167
|
+
getBinaryVersionList,
|
|
215
168
|
app,
|
|
216
169
|
platform,
|
|
217
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
|
|
218
205
|
) {
|
|
219
206
|
const [currentAppVersionList, lastAppVersion] = await getAppVersions(
|
|
220
207
|
getReleaseHistory,
|
|
221
208
|
binaryVersion,
|
|
222
209
|
app,
|
|
223
|
-
platform
|
|
224
|
-
identifier
|
|
210
|
+
platform
|
|
225
211
|
)
|
|
226
212
|
|
|
227
213
|
const message = lastAppVersion
|
|
@@ -252,8 +238,8 @@ module.exports = {
|
|
|
252
238
|
getAppValue,
|
|
253
239
|
getPlatformValue,
|
|
254
240
|
getIdentifierValue,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
241
|
+
getBinaryVersionValueFromList,
|
|
242
|
+
getAppVersionValueFromList,
|
|
243
|
+
getBinaryVersionValueFromInput,
|
|
244
|
+
getAppVersionValueFromInput,
|
|
259
245
|
}
|
|
@@ -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) {
|
|
@@ -7,7 +7,7 @@ const {
|
|
|
7
7
|
getAppValue,
|
|
8
8
|
getPlatformValue,
|
|
9
9
|
getIdentifierValue,
|
|
10
|
-
|
|
10
|
+
getBinaryVersionValueFromInput,
|
|
11
11
|
} = require('../common')
|
|
12
12
|
|
|
13
13
|
program
|
|
@@ -27,7 +27,7 @@ program
|
|
|
27
27
|
// identifier
|
|
28
28
|
const identifier = await getIdentifierValue()
|
|
29
29
|
// binaryVersion
|
|
30
|
-
const binaryVersion = await
|
|
30
|
+
const binaryVersion = await getBinaryVersionValueFromInput(
|
|
31
31
|
config.getBinaryVersionList,
|
|
32
32
|
app,
|
|
33
33
|
platform,
|
|
@@ -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)
|
|
@@ -11,8 +11,8 @@ const {
|
|
|
11
11
|
getAppValue,
|
|
12
12
|
getPlatformValue,
|
|
13
13
|
getIdentifierValue,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
getBinaryVersionValueFromInput,
|
|
15
|
+
getAppVersionValueFromInput,
|
|
16
16
|
} = require('../common')
|
|
17
17
|
|
|
18
18
|
program
|
|
@@ -110,19 +110,18 @@ program
|
|
|
110
110
|
// identifier
|
|
111
111
|
const identifier = await getIdentifierValue()
|
|
112
112
|
// binaryVersion
|
|
113
|
-
const binaryVersion = await
|
|
113
|
+
const binaryVersion = await getBinaryVersionValueFromInput(
|
|
114
114
|
getBinaryVersionList,
|
|
115
115
|
app,
|
|
116
116
|
platform,
|
|
117
117
|
identifier
|
|
118
118
|
)
|
|
119
119
|
// appVersion
|
|
120
|
-
const appVersion = await
|
|
120
|
+
const appVersion = await getAppVersionValueFromInput(
|
|
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
|
)
|
|
@@ -5,7 +5,7 @@ const {
|
|
|
5
5
|
getAppValue,
|
|
6
6
|
getPlatformValue,
|
|
7
7
|
getIdentifierValue,
|
|
8
|
-
|
|
8
|
+
getBinaryVersionValueFromList,
|
|
9
9
|
} = require('../common')
|
|
10
10
|
|
|
11
11
|
program
|
|
@@ -27,7 +27,7 @@ program
|
|
|
27
27
|
// identifier
|
|
28
28
|
const identifier = await getIdentifierValue()
|
|
29
29
|
// binaryVersion
|
|
30
|
-
const binaryVersion = await
|
|
30
|
+
const binaryVersion = await getBinaryVersionValueFromList(
|
|
31
31
|
config.getBinaryVersionList,
|
|
32
32
|
app,
|
|
33
33
|
platform,
|
|
@@ -44,8 +44,7 @@ program
|
|
|
44
44
|
const releaseHistory = await config.getReleaseHistory(
|
|
45
45
|
answers.app,
|
|
46
46
|
answers.binaryVersion,
|
|
47
|
-
answers.platform
|
|
48
|
-
answers.identifier
|
|
47
|
+
answers.platform
|
|
49
48
|
)
|
|
50
49
|
|
|
51
50
|
console.log(JSON.stringify(releaseHistory, null, 2))
|
|
@@ -6,8 +6,8 @@ const {
|
|
|
6
6
|
getAppValue,
|
|
7
7
|
getPlatformValue,
|
|
8
8
|
getIdentifierValue,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
getBinaryVersionValueFromList,
|
|
10
|
+
getAppVersionValueFromList,
|
|
11
11
|
} = require('../common')
|
|
12
12
|
|
|
13
13
|
program
|
|
@@ -36,19 +36,18 @@ program
|
|
|
36
36
|
// identifier
|
|
37
37
|
const identifier = await getIdentifierValue()
|
|
38
38
|
// binaryVersion
|
|
39
|
-
const binaryVersion = await
|
|
39
|
+
const binaryVersion = await getBinaryVersionValueFromList(
|
|
40
40
|
config.getBinaryVersionList,
|
|
41
41
|
app,
|
|
42
42
|
platform,
|
|
43
43
|
identifier
|
|
44
44
|
)
|
|
45
45
|
// appVersion
|
|
46
|
-
const appVersion = await
|
|
46
|
+
const appVersion = await getAppVersionValueFromList(
|
|
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(
|