@algocare/react-native-code-push 12.1.0 → 12.2.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/CodePush.js +1 -0
- package/cli/commands/common.js +1 -1
- package/cli/commands/createHistoryCommand/index.js +51 -17
- package/cli/commands/releaseCommand/index.js +24 -35
- package/cli/commands/showHistoryCommand/index.js +49 -15
- package/cli/commands/updateHistoryCommand/index.js +64 -23
- package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +1 -1
- package/package.json +1 -1
package/CodePush.js
CHANGED
package/cli/commands/common.js
CHANGED
|
@@ -157,7 +157,7 @@ async function getAppVersionValueFromList(
|
|
|
157
157
|
])
|
|
158
158
|
appVersion = appVersionAnswer.appVersion
|
|
159
159
|
} else {
|
|
160
|
-
appVersion = appVersionSelectionAnswer.
|
|
160
|
+
appVersion = appVersionSelectionAnswer.appVersionChoice
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
return appVersion
|
|
@@ -13,26 +13,60 @@ const {
|
|
|
13
13
|
program
|
|
14
14
|
.command('create-history')
|
|
15
15
|
.description('Creates a new release history for the binary app.')
|
|
16
|
+
.option('-a, --app <string>', 'target app (user/device)')
|
|
17
|
+
.option('-p, --platform <string>', 'target platform (ios/android)')
|
|
18
|
+
.option('-i, --identifier <string>', 'target env identifier (dev/stg/prd)')
|
|
19
|
+
.option('-b, --binary-version <string>', 'target binary version (x.y.z)')
|
|
16
20
|
.option(
|
|
17
21
|
'-c, --config <path>',
|
|
18
22
|
'set config file name (JS/TS)',
|
|
19
23
|
COMPILED_CONFIG_FILE_NAME
|
|
20
24
|
)
|
|
21
25
|
.action(async (options) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
if (options.app && !['user', 'device'].includes(options.app)) {
|
|
27
|
+
throw new Error('App must be either "user" or "device"')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (options.platform && !['ios', 'android'].includes(options.platform)) {
|
|
31
|
+
throw new Error('Platform must be either "ios" or "android"')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (options.app === 'device' && options.platform === 'ios') {
|
|
35
|
+
throw new Error('Device app is not supported on iOS')
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (
|
|
39
|
+
options.identifier &&
|
|
40
|
+
!['dev', 'stg', 'prd'].includes(options.identifier)
|
|
41
|
+
) {
|
|
42
|
+
throw new Error('Identifier must be either "dev" or "stg" or "prd"')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
|
|
46
|
+
if (options.binaryVersion && !semverRegex.test(options.binaryVersion)) {
|
|
47
|
+
throw new Error('Binary version must be a valid semver format (x.y.z)')
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const { setReleaseHistory, getBinaryVersionList, setBinaryVersionList } =
|
|
51
|
+
await findAndReadConfigFile(process.cwd(), options.config)
|
|
52
|
+
|
|
53
|
+
const app = options.app || (await getAppValue())
|
|
54
|
+
|
|
55
|
+
const platform =
|
|
56
|
+
options.platform ||
|
|
57
|
+
(app === 'device' && 'android') ||
|
|
58
|
+
(await getPlatformValue(app))
|
|
59
|
+
|
|
60
|
+
const identifier = options.identifier || (await getIdentifierValue())
|
|
61
|
+
|
|
62
|
+
const binaryVersion =
|
|
63
|
+
options.binaryVersion ||
|
|
64
|
+
(await getBinaryVersionValueFromInput(
|
|
65
|
+
getBinaryVersionList,
|
|
66
|
+
app,
|
|
67
|
+
platform,
|
|
68
|
+
identifier
|
|
69
|
+
))
|
|
36
70
|
|
|
37
71
|
const answers = {
|
|
38
72
|
app,
|
|
@@ -44,7 +78,7 @@ program
|
|
|
44
78
|
await createReleaseHistory(
|
|
45
79
|
answers.app,
|
|
46
80
|
answers.binaryVersion,
|
|
47
|
-
|
|
81
|
+
setReleaseHistory,
|
|
48
82
|
answers.platform
|
|
49
83
|
)
|
|
50
84
|
|
|
@@ -52,7 +86,7 @@ program
|
|
|
52
86
|
answers.app,
|
|
53
87
|
answers.binaryVersion,
|
|
54
88
|
answers.platform,
|
|
55
|
-
|
|
56
|
-
|
|
89
|
+
getBinaryVersionList,
|
|
90
|
+
setBinaryVersionList
|
|
57
91
|
)
|
|
58
92
|
})
|
|
@@ -83,7 +83,6 @@ program
|
|
|
83
83
|
throw new Error('App version must be a valid semver format (x.y.z)')
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
let answers = {}
|
|
87
86
|
const {
|
|
88
87
|
bundleUploader,
|
|
89
88
|
getReleaseHistory,
|
|
@@ -91,49 +90,39 @@ program
|
|
|
91
90
|
getBinaryVersionList,
|
|
92
91
|
} = await findAndReadConfigFile(process.cwd(), options.config)
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
options.
|
|
98
|
-
|
|
99
|
-
(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
appVersion: options.appVersion,
|
|
107
|
-
}
|
|
108
|
-
} else {
|
|
109
|
-
// app
|
|
110
|
-
const app = await getAppValue()
|
|
111
|
-
// platform
|
|
112
|
-
const platform = await getPlatformValue(app)
|
|
113
|
-
// identifier
|
|
114
|
-
const identifier = await getIdentifierValue()
|
|
115
|
-
// binaryVersion
|
|
116
|
-
const binaryVersion = await getBinaryVersionValueFromInput(
|
|
93
|
+
const app = options.app || (await getAppValue())
|
|
94
|
+
|
|
95
|
+
const platform =
|
|
96
|
+
options.platform ||
|
|
97
|
+
(app === 'device' && 'android') ||
|
|
98
|
+
(await getPlatformValue(app))
|
|
99
|
+
|
|
100
|
+
const identifier = options.identifier || (await getIdentifierValue())
|
|
101
|
+
|
|
102
|
+
const binaryVersion =
|
|
103
|
+
options.binaryVersion ||
|
|
104
|
+
(await getBinaryVersionValueFromInput(
|
|
117
105
|
getBinaryVersionList,
|
|
118
106
|
app,
|
|
119
107
|
platform,
|
|
120
108
|
identifier
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
|
|
109
|
+
))
|
|
110
|
+
|
|
111
|
+
const appVersion =
|
|
112
|
+
options.appVersion ||
|
|
113
|
+
(await getAppVersionValueFromInput(
|
|
124
114
|
getReleaseHistory,
|
|
125
115
|
binaryVersion,
|
|
126
116
|
app,
|
|
127
117
|
platform
|
|
128
|
-
)
|
|
118
|
+
))
|
|
129
119
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
120
|
+
const answers = {
|
|
121
|
+
app,
|
|
122
|
+
platform,
|
|
123
|
+
identifier,
|
|
124
|
+
binaryVersion,
|
|
125
|
+
appVersion,
|
|
137
126
|
}
|
|
138
127
|
|
|
139
128
|
await release(
|
|
@@ -13,26 +13,60 @@ program
|
|
|
13
13
|
.description(
|
|
14
14
|
'Retrieves and prints the release history of a specific binary version.\n`getReleaseHistory` function should be implemented in the config file.'
|
|
15
15
|
)
|
|
16
|
+
.option('-a, --app <string>', 'target app (user/device)')
|
|
17
|
+
.option('-p, --platform <string>', 'target platform (ios/android)')
|
|
18
|
+
.option('-i, --identifier <string>', 'target env identifier (dev/stg/prd)')
|
|
19
|
+
.option('-b, --binary-version <string>', 'target binary version (x.y.z)')
|
|
16
20
|
.option(
|
|
17
21
|
'-c, --config <path>',
|
|
18
22
|
'configuration file name (JS/TS)',
|
|
19
23
|
COMPILED_CONFIG_FILE_NAME
|
|
20
24
|
)
|
|
21
25
|
.action(async (options) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
if (options.app && !['user', 'device'].includes(options.app)) {
|
|
27
|
+
throw new Error('App must be either "user" or "device"')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (options.platform && !['ios', 'android'].includes(options.platform)) {
|
|
31
|
+
throw new Error('Platform must be either "ios" or "android"')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (options.app === 'device' && options.platform === 'ios') {
|
|
35
|
+
throw new Error('Device app is not supported on iOS')
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (
|
|
39
|
+
options.identifier &&
|
|
40
|
+
!['dev', 'stg', 'prd'].includes(options.identifier)
|
|
41
|
+
) {
|
|
42
|
+
throw new Error('Identifier must be either "dev" or "stg" or "prd"')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
|
|
46
|
+
if (options.binaryVersion && !semverRegex.test(options.binaryVersion)) {
|
|
47
|
+
throw new Error('Binary version must be a valid semver format (x.y.z)')
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const { getBinaryVersionList, getReleaseHistory } =
|
|
51
|
+
await findAndReadConfigFile(process.cwd(), options.config)
|
|
52
|
+
|
|
53
|
+
const app = options.app || (await getAppValue())
|
|
54
|
+
|
|
55
|
+
const platform =
|
|
56
|
+
options.platform ||
|
|
57
|
+
(app === 'device' && 'android') ||
|
|
58
|
+
(await getPlatformValue(app))
|
|
59
|
+
|
|
60
|
+
const identifier = options.identifier || (await getIdentifierValue())
|
|
61
|
+
|
|
62
|
+
const binaryVersion =
|
|
63
|
+
options.binaryVersion ||
|
|
64
|
+
(await getBinaryVersionValueFromList(
|
|
65
|
+
getBinaryVersionList,
|
|
66
|
+
app,
|
|
67
|
+
platform,
|
|
68
|
+
identifier
|
|
69
|
+
))
|
|
36
70
|
|
|
37
71
|
const answers = {
|
|
38
72
|
app,
|
|
@@ -41,7 +75,7 @@ program
|
|
|
41
75
|
binaryVersion,
|
|
42
76
|
}
|
|
43
77
|
|
|
44
|
-
const releaseHistory = await
|
|
78
|
+
const releaseHistory = await getReleaseHistory(
|
|
45
79
|
answers.app,
|
|
46
80
|
answers.binaryVersion,
|
|
47
81
|
answers.platform
|
|
@@ -15,6 +15,11 @@ program
|
|
|
15
15
|
.description(
|
|
16
16
|
'Updates the release history for a specific binary version.\n`getReleaseHistory`, `setReleaseHistory` functions should be implemented in the config file.'
|
|
17
17
|
)
|
|
18
|
+
.option('-a, --app <string>', 'target app (user/device)')
|
|
19
|
+
.option('-p, --platform <string>', 'target platform (ios/android)')
|
|
20
|
+
.option('-i, --identifier <string>', 'target env identifier (dev/stg/prd)')
|
|
21
|
+
.option('-b, --binary-version <string>', 'target binary version (x.y.z)')
|
|
22
|
+
.option('-v, --app-version <string>', 'target codepush version (x.y.z)')
|
|
18
23
|
.option(
|
|
19
24
|
'-c, --config <path>',
|
|
20
25
|
'set config file name (JS/TS)',
|
|
@@ -28,27 +33,63 @@ program
|
|
|
28
33
|
)
|
|
29
34
|
.option('--no-enable', 'make the release to be disabled')
|
|
30
35
|
.action(async (options) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
)
|
|
36
|
+
if (options.app && !['user', 'device'].includes(options.app)) {
|
|
37
|
+
throw new Error('App must be either "user" or "device"')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (options.platform && !['ios', 'android'].includes(options.platform)) {
|
|
41
|
+
throw new Error('Platform must be either "ios" or "android"')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (options.app === 'device' && options.platform === 'ios') {
|
|
45
|
+
throw new Error('Device app is not supported on iOS')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (
|
|
49
|
+
options.identifier &&
|
|
50
|
+
!['dev', 'stg', 'prd'].includes(options.identifier)
|
|
51
|
+
) {
|
|
52
|
+
throw new Error('Identifier must be either "dev" or "stg" or "prd"')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/
|
|
56
|
+
if (options.binaryVersion && !semverRegex.test(options.binaryVersion)) {
|
|
57
|
+
throw new Error('Binary version must be a valid semver format (x.y.z)')
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (options.appVersion && !semverRegex.test(options.appVersion)) {
|
|
61
|
+
throw new Error('App version must be a valid semver format (x.y.z)')
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const { getBinaryVersionList, getReleaseHistory, setReleaseHistory } =
|
|
65
|
+
await findAndReadConfigFile(process.cwd(), options.config)
|
|
66
|
+
|
|
67
|
+
const app = options.app || (await getAppValue())
|
|
68
|
+
|
|
69
|
+
const platform =
|
|
70
|
+
options.platform ||
|
|
71
|
+
(app === 'device' && 'android') ||
|
|
72
|
+
(await getPlatformValue(app))
|
|
73
|
+
|
|
74
|
+
const identifier = options.identifier || (await getIdentifierValue())
|
|
75
|
+
|
|
76
|
+
const binaryVersion =
|
|
77
|
+
options.binaryVersion ||
|
|
78
|
+
(await getBinaryVersionValueFromList(
|
|
79
|
+
getBinaryVersionList,
|
|
80
|
+
app,
|
|
81
|
+
platform,
|
|
82
|
+
identifier
|
|
83
|
+
))
|
|
84
|
+
|
|
85
|
+
const appVersion =
|
|
86
|
+
options.appVersion ||
|
|
87
|
+
(await getAppVersionValueFromList(
|
|
88
|
+
getReleaseHistory,
|
|
89
|
+
binaryVersion,
|
|
90
|
+
app,
|
|
91
|
+
platform
|
|
92
|
+
))
|
|
52
93
|
|
|
53
94
|
const answers = {
|
|
54
95
|
app,
|
|
@@ -70,8 +111,8 @@ program
|
|
|
70
111
|
answers.app,
|
|
71
112
|
answers.appVersion,
|
|
72
113
|
answers.binaryVersion,
|
|
73
|
-
|
|
74
|
-
|
|
114
|
+
getReleaseHistory,
|
|
115
|
+
setReleaseHistory,
|
|
75
116
|
answers.platform,
|
|
76
117
|
options.mandatory,
|
|
77
118
|
options.enable
|
|
@@ -35,7 +35,7 @@ async function updateReleaseHistory(
|
|
|
35
35
|
const releaseHistory = await getReleaseHistory(app, binaryVersion, platform)
|
|
36
36
|
|
|
37
37
|
const updateInfo = releaseHistory[appVersion]
|
|
38
|
-
if (!updateInfo) throw new Error(
|
|
38
|
+
if (!updateInfo) throw new Error(`${appVersion} is not released`)
|
|
39
39
|
|
|
40
40
|
if (typeof mandatory === 'boolean') updateInfo.mandatory = mandatory
|
|
41
41
|
if (typeof enable === 'boolean') updateInfo.enabled = enable
|