@algocare/react-native-code-push 9.0.0-beta.4 → 9.0.0-beta.6
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/createHistoryCommand/createReleaseHistory.js +40 -28
- package/cli/commands/createHistoryCommand/index.js +48 -27
- package/cli/commands/releaseCommand/addToReleaseHistory.js +52 -36
- package/cli/commands/releaseCommand/index.js +112 -60
- package/cli/commands/releaseCommand/release.js +72 -53
- package/cli/commands/showHistoryCommand/index.js +49 -26
- package/cli/commands/updateHistoryCommand/index.js +83 -44
- package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +42 -26
- package/cli/constant.js +7 -5
- package/cli/utils/fsUtils.js +35 -20
- package/code-push.config.example.supabase.ts +100 -100
- package/code-push.config.js +109 -0
- package/code-push.config.ts +16 -4
- package/package.json +3 -2
- package/tsconfig.json +16 -10
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const path = require('path')
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* @param app {"user" | "device"}
|
|
6
6
|
* @param targetVersion {string}
|
|
7
7
|
* @param setReleaseHistory {
|
|
8
8
|
* function(
|
|
@@ -17,37 +17,49 @@ const path = require('path');
|
|
|
17
17
|
* @returns {Promise<void>}
|
|
18
18
|
*/
|
|
19
19
|
async function createReleaseHistory(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
app,
|
|
21
|
+
targetVersion,
|
|
22
|
+
setReleaseHistory,
|
|
23
|
+
platform,
|
|
24
|
+
identifier
|
|
24
25
|
) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const BINARY_RELEASE = {
|
|
27
|
+
enabled: true,
|
|
28
|
+
mandatory: false,
|
|
29
|
+
downloadUrl: '',
|
|
30
|
+
packageHash: '',
|
|
31
|
+
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
/** @type {ReleaseHistoryInterface} */
|
|
34
|
+
// not use
|
|
35
|
+
const INITIAL_HISTORY = {
|
|
36
|
+
[targetVersion]: BINARY_RELEASE,
|
|
37
|
+
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
try {
|
|
40
|
+
const JSON_FILE_NAME = `${targetVersion}.json`
|
|
41
|
+
const JSON_FILE_PATH = path.resolve(process.cwd(), JSON_FILE_NAME)
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
console.log(
|
|
44
|
+
`log: creating JSON file... ("${JSON_FILE_NAME}")\n`,
|
|
45
|
+
JSON.stringify({}, null, 2)
|
|
46
|
+
)
|
|
47
|
+
fs.writeFileSync(JSON_FILE_PATH, JSON.stringify({}))
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
await setReleaseHistory(
|
|
50
|
+
targetVersion,
|
|
51
|
+
JSON_FILE_PATH,
|
|
52
|
+
{},
|
|
53
|
+
app,
|
|
54
|
+
platform,
|
|
55
|
+
identifier
|
|
56
|
+
)
|
|
45
57
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
fs.unlinkSync(JSON_FILE_PATH)
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error('Error occurred while creating new history:', error)
|
|
61
|
+
process.exit(1)
|
|
62
|
+
}
|
|
51
63
|
}
|
|
52
64
|
|
|
53
65
|
module.exports = { createReleaseHistory: createReleaseHistory }
|
|
@@ -1,29 +1,50 @@
|
|
|
1
|
-
const { program, Option } = require(
|
|
2
|
-
const { findAndReadConfigFile } = require(
|
|
3
|
-
const { createReleaseHistory } = require(
|
|
4
|
-
const {
|
|
1
|
+
const { program, Option } = require('commander')
|
|
2
|
+
const { findAndReadConfigFile } = require('../../utils/fsUtils')
|
|
3
|
+
const { createReleaseHistory } = require('./createReleaseHistory')
|
|
4
|
+
const { COMPILED_CONFIG_FILE_NAME } = require('../../constant')
|
|
5
5
|
|
|
6
|
-
program
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
program
|
|
7
|
+
.command('create-history')
|
|
8
|
+
.description('Creates a new release history for the binary app.')
|
|
9
|
+
.requiredOption(
|
|
10
|
+
'-a, --app <string>',
|
|
11
|
+
'(Required) The target app: user or device'
|
|
12
|
+
)
|
|
13
|
+
.requiredOption(
|
|
14
|
+
'-b, --binary-version <string>',
|
|
15
|
+
'(Required) The target binary version'
|
|
16
|
+
)
|
|
17
|
+
.addOption(
|
|
18
|
+
new Option('-p, --platform <type>', 'platform')
|
|
19
|
+
.choices(['ios', 'android'])
|
|
20
|
+
.default('ios')
|
|
21
|
+
)
|
|
22
|
+
.option(
|
|
23
|
+
'-i, --identifier <string>',
|
|
24
|
+
'reserved characters to distinguish the release.'
|
|
25
|
+
)
|
|
26
|
+
.option(
|
|
27
|
+
'-c, --config <path>',
|
|
28
|
+
'set config file name (JS/TS)',
|
|
29
|
+
COMPILED_CONFIG_FILE_NAME
|
|
30
|
+
)
|
|
31
|
+
/**
|
|
32
|
+
* @param {Object} options
|
|
33
|
+
* @param {string} options.app
|
|
34
|
+
* @param {string} options.binaryVersion
|
|
35
|
+
* @param {string} options.platform
|
|
36
|
+
* @param {string} options.identifier
|
|
37
|
+
* @param {string} options.config
|
|
38
|
+
* @return {void}
|
|
39
|
+
*/
|
|
40
|
+
.action(async (options) => {
|
|
41
|
+
const config = await findAndReadConfigFile(process.cwd(), options.config)
|
|
22
42
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
await createReleaseHistory(
|
|
44
|
+
options.app,
|
|
45
|
+
options.binaryVersion,
|
|
46
|
+
config.setReleaseHistory,
|
|
47
|
+
options.platform,
|
|
48
|
+
options.identifier
|
|
49
|
+
)
|
|
50
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const path = require(
|
|
2
|
-
const fs = require(
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const fs = require('fs')
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* @param app {"user" | "device"}
|
|
6
6
|
* @param appVersion {string}
|
|
7
7
|
* @param binaryVersion {string}
|
|
8
8
|
* @param bundleDownloadUrl {string}
|
|
@@ -28,48 +28,64 @@ const fs = require("fs");
|
|
|
28
28
|
* @returns {Promise<void>}
|
|
29
29
|
*/
|
|
30
30
|
async function addToReleaseHistory(
|
|
31
|
-
|
|
31
|
+
app,
|
|
32
|
+
appVersion,
|
|
33
|
+
binaryVersion,
|
|
34
|
+
bundleDownloadUrl,
|
|
35
|
+
packageHash,
|
|
36
|
+
getReleaseHistory,
|
|
37
|
+
setReleaseHistory,
|
|
38
|
+
platform,
|
|
39
|
+
identifier,
|
|
40
|
+
mandatory,
|
|
41
|
+
enable
|
|
42
|
+
) {
|
|
43
|
+
const releaseHistory = await getReleaseHistory(
|
|
44
|
+
app,
|
|
32
45
|
binaryVersion,
|
|
33
|
-
bundleDownloadUrl,
|
|
34
|
-
packageHash,
|
|
35
|
-
getReleaseHistory,
|
|
36
|
-
setReleaseHistory,
|
|
37
46
|
platform,
|
|
38
|
-
identifier
|
|
39
|
-
|
|
40
|
-
enable,
|
|
41
|
-
) {
|
|
42
|
-
const releaseHistory = await getReleaseHistory(binaryVersion, platform, identifier);
|
|
47
|
+
identifier
|
|
48
|
+
)
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
const updateInfo = releaseHistory[appVersion]
|
|
51
|
+
if (updateInfo) {
|
|
52
|
+
console.error(`v${appVersion} is already released`)
|
|
53
|
+
process.exit(1)
|
|
54
|
+
}
|
|
49
55
|
|
|
50
|
-
|
|
56
|
+
const newReleaseHistory = structuredClone(releaseHistory)
|
|
51
57
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
newReleaseHistory[appVersion] = {
|
|
59
|
+
enabled: enable,
|
|
60
|
+
mandatory: mandatory,
|
|
61
|
+
downloadUrl: bundleDownloadUrl,
|
|
62
|
+
packageHash: packageHash,
|
|
63
|
+
}
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
try {
|
|
66
|
+
const JSON_FILE_NAME = `${binaryVersion}.json`
|
|
67
|
+
const JSON_FILE_PATH = path.resolve(process.cwd(), JSON_FILE_NAME)
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
console.log(
|
|
70
|
+
`log: creating JSON file... ("${JSON_FILE_NAME}")\n`,
|
|
71
|
+
JSON.stringify(newReleaseHistory, null, 2)
|
|
72
|
+
)
|
|
73
|
+
fs.writeFileSync(JSON_FILE_PATH, JSON.stringify(newReleaseHistory))
|
|
65
74
|
|
|
66
|
-
|
|
75
|
+
await setReleaseHistory(
|
|
76
|
+
binaryVersion,
|
|
77
|
+
JSON_FILE_PATH,
|
|
78
|
+
newReleaseHistory,
|
|
79
|
+
app,
|
|
80
|
+
platform,
|
|
81
|
+
identifier
|
|
82
|
+
)
|
|
67
83
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
84
|
+
fs.unlinkSync(JSON_FILE_PATH)
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('Error occurred while updating history:', error)
|
|
87
|
+
process.exit(1)
|
|
88
|
+
}
|
|
73
89
|
}
|
|
74
90
|
|
|
75
91
|
module.exports = { addToReleaseHistory: addToReleaseHistory }
|
|
@@ -1,66 +1,118 @@
|
|
|
1
|
-
const { program, Option } = require(
|
|
2
|
-
const { findAndReadConfigFile } = require(
|
|
3
|
-
const { release } = require(
|
|
4
|
-
const {
|
|
1
|
+
const { program, Option } = require('commander')
|
|
2
|
+
const { findAndReadConfigFile } = require('../../utils/fsUtils')
|
|
3
|
+
const { release } = require('./release')
|
|
4
|
+
const {
|
|
5
|
+
OUTPUT_BUNDLE_DIR,
|
|
6
|
+
COMPILED_CONFIG_FILE_NAME,
|
|
7
|
+
ROOT_OUTPUT_DIR,
|
|
8
|
+
ENTRY_FILE,
|
|
9
|
+
} = require('../../constant')
|
|
5
10
|
|
|
6
|
-
program
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
11
|
+
program
|
|
12
|
+
.command('release')
|
|
13
|
+
.description(
|
|
14
|
+
'Deploys a new CodePush update for a target binary app.\nAfter creating the CodePush bundle, it uploads the file and updates the ReleaseHistory information.\n`bundleUploader`, `getReleaseHistory`, and `setReleaseHistory` functions should be implemented in the config file.'
|
|
15
|
+
)
|
|
16
|
+
.requiredOption(
|
|
17
|
+
'-a, --app <string>',
|
|
18
|
+
'(Required) The target app: user or device'
|
|
19
|
+
)
|
|
20
|
+
.requiredOption(
|
|
21
|
+
'-b, --binary-version <string>',
|
|
22
|
+
'(Required) The target binary version'
|
|
23
|
+
)
|
|
24
|
+
.requiredOption(
|
|
25
|
+
'-v, --app-version <string>',
|
|
26
|
+
'(Required) The app version to be released. It must be greater than the binary version.'
|
|
27
|
+
)
|
|
28
|
+
.addOption(
|
|
29
|
+
new Option('-p, --platform <type>', 'platform')
|
|
30
|
+
.choices(['ios', 'android'])
|
|
31
|
+
.default('ios')
|
|
32
|
+
)
|
|
33
|
+
.option(
|
|
34
|
+
'-i, --identifier <string>',
|
|
35
|
+
'reserved characters to distinguish the release.'
|
|
36
|
+
)
|
|
37
|
+
.option(
|
|
38
|
+
'-c, --config <path>',
|
|
39
|
+
'set config file name (JS/TS)',
|
|
40
|
+
COMPILED_CONFIG_FILE_NAME
|
|
41
|
+
)
|
|
42
|
+
.option(
|
|
43
|
+
'-o, --output-path <string>',
|
|
44
|
+
'path to output root directory',
|
|
45
|
+
ROOT_OUTPUT_DIR
|
|
46
|
+
)
|
|
47
|
+
.option('-e, --entry-file <string>', 'path to JS/TS entry file', ENTRY_FILE)
|
|
48
|
+
.option(
|
|
49
|
+
'-j, --js-bundle-name <string>',
|
|
50
|
+
'JS bundle file name (default-ios: "main.jsbundle" / default-android: "index.android.bundle")'
|
|
51
|
+
)
|
|
52
|
+
.option(
|
|
53
|
+
'-m, --mandatory <bool>',
|
|
54
|
+
'make the release to be mandatory',
|
|
55
|
+
parseBoolean,
|
|
56
|
+
false
|
|
57
|
+
)
|
|
58
|
+
.option(
|
|
59
|
+
'--enable <bool>',
|
|
60
|
+
'make the release to be enabled',
|
|
61
|
+
parseBoolean,
|
|
62
|
+
true
|
|
63
|
+
)
|
|
64
|
+
.option('--skip-bundle <bool>', 'skip bundle process', parseBoolean, false)
|
|
65
|
+
.option('--skip-cleanup <bool>', 'skip cleanup process', parseBoolean, false)
|
|
66
|
+
.option(
|
|
67
|
+
'--output-bundle-dir <string>',
|
|
68
|
+
'name of directory containing the bundle file created by the "bundle" command',
|
|
69
|
+
OUTPUT_BUNDLE_DIR
|
|
70
|
+
)
|
|
71
|
+
/**
|
|
72
|
+
* @param {Object} options
|
|
73
|
+
* @param {string} options.app
|
|
74
|
+
* @param {string} options.binaryVersion
|
|
75
|
+
* @param {string} options.appVersion
|
|
76
|
+
* @param {string} options.platform
|
|
77
|
+
* @param {string} options.identifier
|
|
78
|
+
* @param {string} options.config
|
|
79
|
+
* @param {string} options.outputPath
|
|
80
|
+
* @param {string} options.entryFile
|
|
81
|
+
* @param {string} options.bundleName
|
|
82
|
+
* @param {string} options.mandatory
|
|
83
|
+
* @param {string} options.enable
|
|
84
|
+
* @param {string} options.skipBundle
|
|
85
|
+
* @param {string} options.skipCleanup
|
|
86
|
+
* @param {string} options.outputBundleDir
|
|
87
|
+
* @return {void}
|
|
88
|
+
*/
|
|
89
|
+
.action(async (options) => {
|
|
90
|
+
const config = await findAndReadConfigFile(process.cwd(), options.config)
|
|
40
91
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
92
|
+
await release(
|
|
93
|
+
config.bundleUploader,
|
|
94
|
+
config.getReleaseHistory,
|
|
95
|
+
config.setReleaseHistory,
|
|
96
|
+
options.app,
|
|
97
|
+
options.binaryVersion,
|
|
98
|
+
options.appVersion,
|
|
99
|
+
options.platform,
|
|
100
|
+
options.identifier,
|
|
101
|
+
options.outputPath,
|
|
102
|
+
options.entryFile,
|
|
103
|
+
options.bundleName,
|
|
104
|
+
options.mandatory,
|
|
105
|
+
options.enable,
|
|
106
|
+
options.skipBundle,
|
|
107
|
+
options.skipCleanup,
|
|
108
|
+
`${options.outputPath}/${options.outputBundleDir}`
|
|
109
|
+
)
|
|
58
110
|
|
|
59
|
-
|
|
60
|
-
|
|
111
|
+
console.log('🚀 Release completed.')
|
|
112
|
+
})
|
|
61
113
|
|
|
62
114
|
function parseBoolean(value) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
115
|
+
if (value === 'true') return true
|
|
116
|
+
if (value === 'false') return false
|
|
117
|
+
else return undefined
|
|
66
118
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const { bundleCodePush } = require(
|
|
3
|
-
const { addToReleaseHistory } = require(
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const { bundleCodePush } = require('../bundleCommand/bundleCodePush')
|
|
3
|
+
const { addToReleaseHistory } = require('./addToReleaseHistory')
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @param bundleUploader {
|
|
@@ -23,6 +23,7 @@ const { addToReleaseHistory } = require("./addToReleaseHistory");
|
|
|
23
23
|
* platform: "ios" | "android",
|
|
24
24
|
* identifier?: string
|
|
25
25
|
* ): Promise<void>}
|
|
26
|
+
* @param app {"user" | "device"}
|
|
26
27
|
* @param binaryVersion {string}
|
|
27
28
|
* @param appVersion {string}
|
|
28
29
|
* @param platform {"ios" | "android"}
|
|
@@ -38,57 +39,75 @@ const { addToReleaseHistory } = require("./addToReleaseHistory");
|
|
|
38
39
|
* @return {Promise<void>}
|
|
39
40
|
*/
|
|
40
41
|
async function release(
|
|
41
|
-
|
|
42
|
+
bundleUploader,
|
|
43
|
+
getReleaseHistory,
|
|
44
|
+
setReleaseHistory,
|
|
45
|
+
app,
|
|
46
|
+
binaryVersion,
|
|
47
|
+
appVersion,
|
|
48
|
+
platform,
|
|
49
|
+
identifier,
|
|
50
|
+
outputPath,
|
|
51
|
+
entryFile,
|
|
52
|
+
jsBundleName,
|
|
53
|
+
mandatory,
|
|
54
|
+
enable,
|
|
55
|
+
skipBundle,
|
|
56
|
+
skipCleanup,
|
|
57
|
+
bundleDirectory
|
|
58
|
+
) {
|
|
59
|
+
const bundleFileName = skipBundle
|
|
60
|
+
? readBundleFileNameFrom(bundleDirectory)
|
|
61
|
+
: await bundleCodePush(
|
|
62
|
+
platform,
|
|
63
|
+
outputPath,
|
|
64
|
+
entryFile,
|
|
65
|
+
jsBundleName,
|
|
66
|
+
bundleDirectory
|
|
67
|
+
)
|
|
68
|
+
const bundleFilePath = `${bundleDirectory}/${bundleFileName}`
|
|
69
|
+
|
|
70
|
+
const downloadUrl = await (async () => {
|
|
71
|
+
try {
|
|
72
|
+
console.log('Uploading Bundle File...')
|
|
73
|
+
const { downloadUrl } = await bundleUploader(
|
|
74
|
+
bundleFilePath,
|
|
75
|
+
app,
|
|
76
|
+
platform,
|
|
77
|
+
identifier
|
|
78
|
+
)
|
|
79
|
+
console.log('Bundle File uploaded:', downloadUrl)
|
|
80
|
+
return downloadUrl
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error(
|
|
83
|
+
'Failed to upload the bundle file. Exiting the program.',
|
|
84
|
+
error
|
|
85
|
+
)
|
|
86
|
+
process.exit(1)
|
|
87
|
+
}
|
|
88
|
+
})()
|
|
89
|
+
|
|
90
|
+
await addToReleaseHistory(
|
|
91
|
+
app,
|
|
92
|
+
appVersion,
|
|
93
|
+
binaryVersion,
|
|
94
|
+
downloadUrl,
|
|
95
|
+
bundleFileName,
|
|
42
96
|
getReleaseHistory,
|
|
43
97
|
setReleaseHistory,
|
|
44
|
-
binaryVersion,
|
|
45
|
-
appVersion,
|
|
46
98
|
platform,
|
|
47
99
|
identifier,
|
|
48
|
-
outputPath,
|
|
49
|
-
entryFile,
|
|
50
|
-
jsBundleName,
|
|
51
100
|
mandatory,
|
|
52
|
-
enable
|
|
53
|
-
|
|
54
|
-
skipCleanup,
|
|
55
|
-
bundleDirectory,
|
|
56
|
-
) {
|
|
57
|
-
const bundleFileName = skipBundle
|
|
58
|
-
? readBundleFileNameFrom(bundleDirectory)
|
|
59
|
-
: await bundleCodePush(platform, outputPath, entryFile, jsBundleName, bundleDirectory);
|
|
60
|
-
const bundleFilePath = `${bundleDirectory}/${bundleFileName}`;
|
|
61
|
-
|
|
62
|
-
const downloadUrl = await (async () => {
|
|
63
|
-
try {
|
|
64
|
-
const { downloadUrl } = await bundleUploader(bundleFilePath, platform, identifier);
|
|
65
|
-
return downloadUrl
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.error('Failed to upload the bundle file. Exiting the program.', error)
|
|
68
|
-
process.exit(1)
|
|
69
|
-
}
|
|
70
|
-
})();
|
|
101
|
+
enable
|
|
102
|
+
)
|
|
71
103
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
downloadUrl,
|
|
76
|
-
bundleFileName,
|
|
77
|
-
getReleaseHistory,
|
|
78
|
-
setReleaseHistory,
|
|
79
|
-
platform,
|
|
80
|
-
identifier,
|
|
81
|
-
mandatory,
|
|
82
|
-
enable,
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
if (!skipCleanup) {
|
|
86
|
-
cleanUpOutputs(outputPath);
|
|
87
|
-
}
|
|
104
|
+
if (!skipCleanup) {
|
|
105
|
+
cleanUpOutputs(outputPath)
|
|
106
|
+
}
|
|
88
107
|
}
|
|
89
108
|
|
|
90
109
|
function cleanUpOutputs(dir) {
|
|
91
|
-
|
|
110
|
+
fs.rmSync(dir, { recursive: true })
|
|
92
111
|
}
|
|
93
112
|
|
|
94
113
|
/**
|
|
@@ -96,14 +115,14 @@ function cleanUpOutputs(dir) {
|
|
|
96
115
|
* @return {string}
|
|
97
116
|
*/
|
|
98
117
|
function readBundleFileNameFrom(bundleDirectory) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
const files = fs.readdirSync(bundleDirectory)
|
|
119
|
+
if (files.length !== 1) {
|
|
120
|
+
console.error('The bundlePath must contain only one file.')
|
|
121
|
+
process.exit(1)
|
|
122
|
+
}
|
|
123
|
+
const path = require('path')
|
|
124
|
+
const bundleFilePath = path.join(bundleDirectory, files[0])
|
|
125
|
+
return path.basename(bundleFilePath)
|
|
107
126
|
}
|
|
108
127
|
|
|
109
128
|
module.exports = { release: release }
|