@revopush/code-push-cli 0.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/.eslintrc.json +17 -0
- package/.idea/cli.iml +9 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +774 -0
- package/bin/script/acquisition-sdk.js +178 -0
- package/bin/script/cli.js +23 -0
- package/bin/script/command-executor.js +1290 -0
- package/bin/script/command-parser.js +1097 -0
- package/bin/script/commands/debug.js +125 -0
- package/bin/script/hash-utils.js +203 -0
- package/bin/script/index.js +5 -0
- package/bin/script/management-sdk.js +419 -0
- package/bin/script/react-native-utils.js +249 -0
- package/bin/script/sign.js +69 -0
- package/bin/script/types/cli.js +40 -0
- package/bin/script/types/rest-definitions.js +19 -0
- package/bin/script/types.js +4 -0
- package/bin/script/utils/file-utils.js +50 -0
- package/bin/test/acquisition-rest-mock.js +108 -0
- package/bin/test/acquisition-sdk.js +188 -0
- package/bin/test/cli.js +1342 -0
- package/bin/test/hash-utils.js +149 -0
- package/bin/test/management-sdk.js +338 -0
- package/package.json +68 -0
- package/prettier.config.js +7 -0
- package/script/acquisition-sdk.ts +273 -0
- package/script/cli.ts +27 -0
- package/script/command-executor.ts +1610 -0
- package/script/command-parser.ts +1310 -0
- package/script/commands/debug.ts +148 -0
- package/script/hash-utils.ts +241 -0
- package/script/index.ts +5 -0
- package/script/management-sdk.ts +575 -0
- package/script/react-native-utils.ts +283 -0
- package/script/sign.ts +80 -0
- package/script/types/cli.ts +232 -0
- package/script/types/rest-definitions.ts +152 -0
- package/script/types.ts +35 -0
- package/script/utils/file-utils.ts +46 -0
- package/test/acquisition-rest-mock.ts +125 -0
- package/test/acquisition-sdk.ts +272 -0
- package/test/cli.ts +1692 -0
- package/test/hash-utils.ts +170 -0
- package/test/management-sdk.ts +438 -0
- package/test/resources/TestApp/android/app/build.gradle +56 -0
- package/test/resources/TestApp/iOS/TestApp/Info.plist +49 -0
- package/test/resources/TestApp/index.android.js +2 -0
- package/test/resources/TestApp/index.ios.js +2 -0
- package/test/resources/TestApp/index.windows.js +2 -0
- package/test/resources/TestApp/package.json +6 -0
- package/test/resources/TestApp/windows/TestApp/Package.appxmanifest +46 -0
- package/test/resources/ignoredMetadata.zip +0 -0
- package/test/resources/test.zip +0 -0
- package/test/superagent-mock-config.js +58 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,1310 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import * as yargs from "yargs";
|
|
5
|
+
import * as cli from "../script/types/cli";
|
|
6
|
+
import * as chalk from "chalk";
|
|
7
|
+
import backslash = require("backslash");
|
|
8
|
+
import parseDuration = require("parse-duration");
|
|
9
|
+
|
|
10
|
+
const packageJson = require("../../package.json");
|
|
11
|
+
const ROLLOUT_PERCENTAGE_REGEX: RegExp = /^(100|[1-9][0-9]|[1-9])%?$/;
|
|
12
|
+
const USAGE_PREFIX = "Usage: code-push-standalone";
|
|
13
|
+
|
|
14
|
+
// Command categories are: access-key, app, release, deployment, deployment-key, login, logout, register
|
|
15
|
+
let isValidCommandCategory = false;
|
|
16
|
+
// Commands are the verb following the command category (e.g.: "add" in "app add").
|
|
17
|
+
let isValidCommand = false;
|
|
18
|
+
let wasHelpShown = false;
|
|
19
|
+
|
|
20
|
+
export function showHelp(showRootDescription?: boolean): void {
|
|
21
|
+
if (!wasHelpShown) {
|
|
22
|
+
if (showRootDescription) {
|
|
23
|
+
console.log(chalk.cyan(" _____ __ " + chalk.green(" ___ __ ")));
|
|
24
|
+
console.log(chalk.cyan(" / ___/__ ___/ /__" + chalk.green(" / _ \\__ _____ / / ")));
|
|
25
|
+
console.log(chalk.cyan("/ /__/ _ \\/ _ / -_)" + chalk.green(" ___/ // (_-</ _ \\")));
|
|
26
|
+
console.log(chalk.cyan("\\___/\\___/\\_,_/\\__/" + chalk.green("_/ \\_,_/___/_//_/")) + " CLI v" + packageJson.version);
|
|
27
|
+
console.log(chalk.cyan("======================================"));
|
|
28
|
+
console.log("");
|
|
29
|
+
console.log("CodePush is a service that enables you to deploy mobile app updates directly to your users' devices.\n");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
yargs.showHelp();
|
|
33
|
+
wasHelpShown = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function accessKeyAdd(commandName: string, yargs: yargs.Argv): void {
|
|
38
|
+
isValidCommand = true;
|
|
39
|
+
yargs
|
|
40
|
+
.usage(USAGE_PREFIX + " access-key " + commandName + " <accessKeyName>")
|
|
41
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
42
|
+
.example(
|
|
43
|
+
"access-key " + commandName + ' "VSTS Integration"',
|
|
44
|
+
'Creates a new access key with the name "VSTS Integration", which expires in 60 days'
|
|
45
|
+
)
|
|
46
|
+
.example(
|
|
47
|
+
"access-key " + commandName + ' "One time key" --ttl 5m',
|
|
48
|
+
'Creates a new access key with the name "One time key", which expires in 5 minutes'
|
|
49
|
+
)
|
|
50
|
+
.option("ttl", {
|
|
51
|
+
default: "60d",
|
|
52
|
+
demand: false,
|
|
53
|
+
description: "Duration string which specifies the amount of time that the access key should remain valid for (e.g 5m, 60d, 1y)",
|
|
54
|
+
type: "string",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
addCommonConfiguration(yargs);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function accessKeyPatch(commandName: string, yargs: yargs.Argv): void {
|
|
61
|
+
isValidCommand = true;
|
|
62
|
+
yargs
|
|
63
|
+
.usage(USAGE_PREFIX + " access-key " + commandName + " <accessKeyName>")
|
|
64
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
65
|
+
.example(
|
|
66
|
+
"access-key " + commandName + ' "Key for build server" --name "Key for CI machine"',
|
|
67
|
+
'Renames the access key named "Key for build server" to "Key for CI machine"'
|
|
68
|
+
)
|
|
69
|
+
.example(
|
|
70
|
+
"access-key " + commandName + ' "Key for build server" --ttl 7d',
|
|
71
|
+
'Updates the access key named "Key for build server" to expire in 7 days'
|
|
72
|
+
)
|
|
73
|
+
.option("name", {
|
|
74
|
+
default: null,
|
|
75
|
+
demand: false,
|
|
76
|
+
description: "Display name for the access key",
|
|
77
|
+
type: "string",
|
|
78
|
+
})
|
|
79
|
+
.option("ttl", {
|
|
80
|
+
default: null,
|
|
81
|
+
demand: false,
|
|
82
|
+
description: "Duration string which specifies the amount of time that the access key should remain valid for (e.g 5m, 60d, 1y)",
|
|
83
|
+
type: "string",
|
|
84
|
+
});
|
|
85
|
+
addCommonConfiguration(yargs);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function accessKeyList(commandName: string, yargs: yargs.Argv): void {
|
|
89
|
+
isValidCommand = true;
|
|
90
|
+
yargs
|
|
91
|
+
.usage(USAGE_PREFIX + " access-key " + commandName + " [options]")
|
|
92
|
+
.demand(/*count*/ 0, /*max*/ 0)
|
|
93
|
+
.example("access-key " + commandName, "Lists your access keys in tabular format")
|
|
94
|
+
.example("access-key " + commandName + " --format json", "Lists your access keys in JSON format")
|
|
95
|
+
.option("format", {
|
|
96
|
+
default: "table",
|
|
97
|
+
demand: false,
|
|
98
|
+
description: 'Output format to display your access keys with ("json" or "table")',
|
|
99
|
+
type: "string",
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
addCommonConfiguration(yargs);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function accessKeyRemove(commandName: string, yargs: yargs.Argv): void {
|
|
106
|
+
isValidCommand = true;
|
|
107
|
+
yargs
|
|
108
|
+
.usage(USAGE_PREFIX + " access-key " + commandName + " <accessKeyName>")
|
|
109
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
110
|
+
.example("access-key " + commandName + ' "VSTS Integration"', 'Removes the "VSTS Integration" access key');
|
|
111
|
+
|
|
112
|
+
addCommonConfiguration(yargs);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function addCommonConfiguration(yargs: yargs.Argv): void {
|
|
116
|
+
yargs
|
|
117
|
+
.wrap(/*columnLimit*/ null)
|
|
118
|
+
.string("_") // Interpret non-hyphenated arguments as strings (e.g. an app version of '1.10').
|
|
119
|
+
.fail((msg: string) => showHelp()); // Suppress the default error message.
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function appList(commandName: string, yargs: yargs.Argv): void {
|
|
123
|
+
isValidCommand = true;
|
|
124
|
+
yargs
|
|
125
|
+
.usage(USAGE_PREFIX + " app " + commandName + " [options]")
|
|
126
|
+
.demand(/*count*/ 0, /*max*/ 0)
|
|
127
|
+
.example("app " + commandName, "List your apps in tabular format")
|
|
128
|
+
.example("app " + commandName + " --format json", "List your apps in JSON format")
|
|
129
|
+
.option("format", {
|
|
130
|
+
default: "table",
|
|
131
|
+
demand: false,
|
|
132
|
+
description: 'Output format to display your apps with ("json" or "table")',
|
|
133
|
+
type: "string",
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
addCommonConfiguration(yargs);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function appRemove(commandName: string, yargs: yargs.Argv): void {
|
|
140
|
+
isValidCommand = true;
|
|
141
|
+
yargs
|
|
142
|
+
.usage(USAGE_PREFIX + " app " + commandName + " <appName>")
|
|
143
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
144
|
+
.example("app " + commandName + " MyApp", 'Removes app "MyApp"');
|
|
145
|
+
|
|
146
|
+
addCommonConfiguration(yargs);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function listCollaborators(commandName: string, yargs: yargs.Argv): void {
|
|
150
|
+
isValidCommand = true;
|
|
151
|
+
yargs
|
|
152
|
+
.usage(USAGE_PREFIX + " collaborator " + commandName + " <appName> [options]")
|
|
153
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
154
|
+
.example("collaborator " + commandName + " MyApp", 'Lists the collaborators for app "MyApp" in tabular format')
|
|
155
|
+
.example("collaborator " + commandName + " MyApp --format json", 'Lists the collaborators for app "MyApp" in JSON format')
|
|
156
|
+
.option("format", {
|
|
157
|
+
default: "table",
|
|
158
|
+
demand: false,
|
|
159
|
+
description: 'Output format to display collaborators with ("json" or "table")',
|
|
160
|
+
type: "string",
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
addCommonConfiguration(yargs);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function removeCollaborator(commandName: string, yargs: yargs.Argv): void {
|
|
167
|
+
isValidCommand = true;
|
|
168
|
+
yargs
|
|
169
|
+
.usage(USAGE_PREFIX + " collaborator " + commandName + " <appName> <email>")
|
|
170
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
171
|
+
.example("collaborator " + commandName + " MyApp foo@bar.com", 'Removes foo@bar.com as a collaborator from app "MyApp"');
|
|
172
|
+
|
|
173
|
+
addCommonConfiguration(yargs);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function sessionList(commandName: string, yargs: yargs.Argv): void {
|
|
177
|
+
isValidCommand = true;
|
|
178
|
+
yargs
|
|
179
|
+
.usage(USAGE_PREFIX + " session " + commandName + " [options]")
|
|
180
|
+
.demand(/*count*/ 0, /*max*/ 0)
|
|
181
|
+
.example("session " + commandName, "Lists your sessions in tabular format")
|
|
182
|
+
.example("session " + commandName + " --format json", "Lists your login sessions in JSON format")
|
|
183
|
+
.option("format", {
|
|
184
|
+
default: "table",
|
|
185
|
+
demand: false,
|
|
186
|
+
description: 'Output format to display your login sessions with ("json" or "table")',
|
|
187
|
+
type: "string",
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
addCommonConfiguration(yargs);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function sessionRemove(commandName: string, yargs: yargs.Argv): void {
|
|
194
|
+
isValidCommand = true;
|
|
195
|
+
yargs
|
|
196
|
+
.usage(USAGE_PREFIX + " session " + commandName + " <machineName>")
|
|
197
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
198
|
+
.example("session " + commandName + ' "John\'s PC"', 'Removes the existing login session from "John\'s PC"');
|
|
199
|
+
|
|
200
|
+
addCommonConfiguration(yargs);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function deploymentHistoryClear(commandName: string, yargs: yargs.Argv): void {
|
|
204
|
+
isValidCommand = true;
|
|
205
|
+
yargs
|
|
206
|
+
.usage(USAGE_PREFIX + " deployment " + commandName + " <appName> <deploymentName>")
|
|
207
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
208
|
+
.example(
|
|
209
|
+
"deployment " + commandName + " MyApp MyDeployment",
|
|
210
|
+
'Clears the release history associated with deployment "MyDeployment" from app "MyApp"'
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
addCommonConfiguration(yargs);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function deploymentList(commandName: string, yargs: yargs.Argv): void {
|
|
217
|
+
isValidCommand = true;
|
|
218
|
+
yargs
|
|
219
|
+
.usage(USAGE_PREFIX + " deployment " + commandName + " <appName> [options]")
|
|
220
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
221
|
+
.example("deployment " + commandName + " MyApp", 'Lists the deployments for app "MyApp" in tabular format')
|
|
222
|
+
.example("deployment " + commandName + " MyApp --format json", 'Lists the deployments for app "MyApp" in JSON format')
|
|
223
|
+
.option("format", {
|
|
224
|
+
default: "table",
|
|
225
|
+
demand: false,
|
|
226
|
+
description: 'Output format to display your deployments with ("json" or "table")',
|
|
227
|
+
type: "string",
|
|
228
|
+
})
|
|
229
|
+
.option("displayKeys", {
|
|
230
|
+
alias: "k",
|
|
231
|
+
default: false,
|
|
232
|
+
demand: false,
|
|
233
|
+
description: "Specifies whether to display the deployment keys",
|
|
234
|
+
type: "boolean",
|
|
235
|
+
});
|
|
236
|
+
addCommonConfiguration(yargs);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function deploymentRemove(commandName: string, yargs: yargs.Argv): void {
|
|
240
|
+
isValidCommand = true;
|
|
241
|
+
yargs
|
|
242
|
+
.usage(USAGE_PREFIX + " deployment " + commandName + " <appName> <deploymentName>")
|
|
243
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
244
|
+
.example("deployment " + commandName + " MyApp MyDeployment", 'Removes deployment "MyDeployment" from app "MyApp"');
|
|
245
|
+
|
|
246
|
+
addCommonConfiguration(yargs);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function deploymentHistory(commandName: string, yargs: yargs.Argv): void {
|
|
250
|
+
isValidCommand = true;
|
|
251
|
+
yargs
|
|
252
|
+
.usage(USAGE_PREFIX + " deployment " + commandName + " <appName> <deploymentName> [options]")
|
|
253
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
254
|
+
.example(
|
|
255
|
+
"deployment " + commandName + " MyApp MyDeployment",
|
|
256
|
+
'Displays the release history for deployment "MyDeployment" from app "MyApp" in tabular format'
|
|
257
|
+
)
|
|
258
|
+
.example(
|
|
259
|
+
"deployment " + commandName + " MyApp MyDeployment --format json",
|
|
260
|
+
'Displays the release history for deployment "MyDeployment" from app "MyApp" in JSON format'
|
|
261
|
+
)
|
|
262
|
+
.option("format", {
|
|
263
|
+
default: "table",
|
|
264
|
+
demand: false,
|
|
265
|
+
description: 'Output format to display the release history with ("json" or "table")',
|
|
266
|
+
type: "string",
|
|
267
|
+
})
|
|
268
|
+
.option("displayAuthor", {
|
|
269
|
+
alias: "a",
|
|
270
|
+
default: false,
|
|
271
|
+
demand: false,
|
|
272
|
+
description: "Specifies whether to display the release author",
|
|
273
|
+
type: "boolean",
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
addCommonConfiguration(yargs);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
yargs
|
|
280
|
+
.usage(USAGE_PREFIX + " <command>")
|
|
281
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option argument.
|
|
282
|
+
.command("access-key", "View and manage the access keys associated with your account", (yargs: yargs.Argv) => {
|
|
283
|
+
isValidCommandCategory = true;
|
|
284
|
+
yargs
|
|
285
|
+
.usage(USAGE_PREFIX + " access-key <command>")
|
|
286
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments.
|
|
287
|
+
.command("add", "Create a new access key associated with your account", (yargs: yargs.Argv) => accessKeyAdd("add", yargs))
|
|
288
|
+
.command("patch", "Update the name and/or TTL of an existing access key", (yargs: yargs.Argv) => accessKeyPatch("patch", yargs))
|
|
289
|
+
.command("remove", "Remove an existing access key", (yargs: yargs.Argv) => accessKeyRemove("remove", yargs))
|
|
290
|
+
.command("rm", "Remove an existing access key", (yargs: yargs.Argv) => accessKeyRemove("rm", yargs))
|
|
291
|
+
.command("list", "List the access keys associated with your account", (yargs: yargs.Argv) => accessKeyList("list", yargs))
|
|
292
|
+
.command("ls", "List the access keys associated with your account", (yargs: yargs.Argv) => accessKeyList("ls", yargs))
|
|
293
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
294
|
+
|
|
295
|
+
addCommonConfiguration(yargs);
|
|
296
|
+
})
|
|
297
|
+
.command("app", "View and manage your CodePush apps", (yargs: yargs.Argv) => {
|
|
298
|
+
isValidCommandCategory = true;
|
|
299
|
+
yargs
|
|
300
|
+
.usage(USAGE_PREFIX + " app <command>")
|
|
301
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments.
|
|
302
|
+
.command("add", "Add a new app to your account", (yargs: yargs.Argv): void => {
|
|
303
|
+
isValidCommand = true;
|
|
304
|
+
yargs
|
|
305
|
+
.usage(USAGE_PREFIX + " app add <appName>")
|
|
306
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
307
|
+
.example("app add MyApp", 'Adds app "MyApp"');
|
|
308
|
+
|
|
309
|
+
addCommonConfiguration(yargs);
|
|
310
|
+
})
|
|
311
|
+
.command("remove", "Remove an app from your account", (yargs: yargs.Argv) => appRemove("remove", yargs))
|
|
312
|
+
.command("rm", "Remove an app from your account", (yargs: yargs.Argv) => appRemove("rm", yargs))
|
|
313
|
+
.command("rename", "Rename an existing app", (yargs: yargs.Argv) => {
|
|
314
|
+
isValidCommand = true;
|
|
315
|
+
yargs
|
|
316
|
+
.usage(USAGE_PREFIX + " app rename <currentAppName> <newAppName>")
|
|
317
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
318
|
+
.example("app rename CurrentName NewName", 'Renames app "CurrentName" to "NewName"');
|
|
319
|
+
|
|
320
|
+
addCommonConfiguration(yargs);
|
|
321
|
+
})
|
|
322
|
+
.command("list", "Lists the apps associated with your account", (yargs: yargs.Argv) => appList("list", yargs))
|
|
323
|
+
.command("ls", "Lists the apps associated with your account", (yargs: yargs.Argv) => appList("ls", yargs))
|
|
324
|
+
.command("transfer", "Transfer the ownership of an app to another account", (yargs: yargs.Argv) => {
|
|
325
|
+
yargs
|
|
326
|
+
.usage(USAGE_PREFIX + " app transfer <appName> <email>")
|
|
327
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
328
|
+
.example("app transfer MyApp foo@bar.com", 'Transfers the ownership of app "MyApp" to an account with email "foo@bar.com"');
|
|
329
|
+
|
|
330
|
+
addCommonConfiguration(yargs);
|
|
331
|
+
})
|
|
332
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
333
|
+
|
|
334
|
+
addCommonConfiguration(yargs);
|
|
335
|
+
})
|
|
336
|
+
.command("collaborator", "View and manage app collaborators", (yargs: yargs.Argv) => {
|
|
337
|
+
isValidCommandCategory = true;
|
|
338
|
+
yargs
|
|
339
|
+
.usage(USAGE_PREFIX + " collaborator <command>")
|
|
340
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments.
|
|
341
|
+
.command("add", "Add a new collaborator to an app", (yargs: yargs.Argv): void => {
|
|
342
|
+
isValidCommand = true;
|
|
343
|
+
yargs
|
|
344
|
+
.usage(USAGE_PREFIX + " collaborator add <appName> <email>")
|
|
345
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
346
|
+
.example("collaborator add MyApp foo@bar.com", 'Adds foo@bar.com as a collaborator to app "MyApp"');
|
|
347
|
+
|
|
348
|
+
addCommonConfiguration(yargs);
|
|
349
|
+
})
|
|
350
|
+
.command("remove", "Remove a collaborator from an app", (yargs: yargs.Argv) => removeCollaborator("remove", yargs))
|
|
351
|
+
.command("rm", "Remove a collaborator from an app", (yargs: yargs.Argv) => removeCollaborator("rm", yargs))
|
|
352
|
+
.command("list", "List the collaborators for an app", (yargs: yargs.Argv) => listCollaborators("list", yargs))
|
|
353
|
+
.command("ls", "List the collaborators for an app", (yargs: yargs.Argv) => listCollaborators("ls", yargs))
|
|
354
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
355
|
+
|
|
356
|
+
addCommonConfiguration(yargs);
|
|
357
|
+
})
|
|
358
|
+
.command("debug", "View the CodePush debug logs for a running app", (yargs: yargs.Argv) => {
|
|
359
|
+
isValidCommandCategory = true;
|
|
360
|
+
isValidCommand = true;
|
|
361
|
+
yargs
|
|
362
|
+
.usage(USAGE_PREFIX + " debug <platform>")
|
|
363
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
364
|
+
.example("debug android", "View the CodePush debug logs for an Android emulator or device")
|
|
365
|
+
.example("debug ios", "View the CodePush debug logs for the iOS simulator");
|
|
366
|
+
|
|
367
|
+
addCommonConfiguration(yargs);
|
|
368
|
+
})
|
|
369
|
+
.command("deployment", "View and manage your app deployments", (yargs: yargs.Argv) => {
|
|
370
|
+
isValidCommandCategory = true;
|
|
371
|
+
yargs
|
|
372
|
+
.usage(USAGE_PREFIX + " deployment <command>")
|
|
373
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments.
|
|
374
|
+
.command("add", "Add a new deployment to an app", (yargs: yargs.Argv): void => {
|
|
375
|
+
isValidCommand = true;
|
|
376
|
+
yargs
|
|
377
|
+
.usage(USAGE_PREFIX + " deployment add <appName> <deploymentName>")
|
|
378
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
379
|
+
.example("deployment add MyApp MyDeployment", 'Adds deployment "MyDeployment" to app "MyApp"');
|
|
380
|
+
|
|
381
|
+
addCommonConfiguration(yargs);
|
|
382
|
+
})
|
|
383
|
+
.command("clear", "Clear the release history associated with a deployment", (yargs: yargs.Argv) =>
|
|
384
|
+
deploymentHistoryClear("clear", yargs)
|
|
385
|
+
)
|
|
386
|
+
.command("remove", "Remove a deployment from an app", (yargs: yargs.Argv) => deploymentRemove("remove", yargs))
|
|
387
|
+
.command("rm", "Remove a deployment from an app", (yargs: yargs.Argv) => deploymentRemove("rm", yargs))
|
|
388
|
+
.command("rename", "Rename an existing deployment", (yargs: yargs.Argv) => {
|
|
389
|
+
isValidCommand = true;
|
|
390
|
+
yargs
|
|
391
|
+
.usage(USAGE_PREFIX + " deployment rename <appName> <currentDeploymentName> <newDeploymentName>")
|
|
392
|
+
.demand(/*count*/ 3, /*max*/ 3) // Require exactly three non-option arguments
|
|
393
|
+
.example(
|
|
394
|
+
"deployment rename MyApp CurrentDeploymentName NewDeploymentName",
|
|
395
|
+
'Renames deployment "CurrentDeploymentName" to "NewDeploymentName"'
|
|
396
|
+
);
|
|
397
|
+
|
|
398
|
+
addCommonConfiguration(yargs);
|
|
399
|
+
})
|
|
400
|
+
.command("list", "List the deployments associated with an app", (yargs: yargs.Argv) => deploymentList("list", yargs))
|
|
401
|
+
.command("ls", "List the deployments associated with an app", (yargs: yargs.Argv) => deploymentList("ls", yargs))
|
|
402
|
+
.command("history", "Display the release history for a deployment", (yargs: yargs.Argv) => deploymentHistory("history", yargs))
|
|
403
|
+
.command("h", "Display the release history for a deployment", (yargs: yargs.Argv) => deploymentHistory("h", yargs))
|
|
404
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
405
|
+
|
|
406
|
+
addCommonConfiguration(yargs);
|
|
407
|
+
})
|
|
408
|
+
.command("link", "Link an additional authentication provider (e.g. GitHub) to an existing CodePush account", (yargs: yargs.Argv) => {
|
|
409
|
+
isValidCommandCategory = true;
|
|
410
|
+
isValidCommand = true;
|
|
411
|
+
yargs
|
|
412
|
+
.usage(USAGE_PREFIX + " link")
|
|
413
|
+
.demand(/*count*/ 0, /*max*/ 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
|
|
414
|
+
.example("link", "Links an account on the CodePush server")
|
|
415
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
416
|
+
|
|
417
|
+
addCommonConfiguration(yargs);
|
|
418
|
+
})
|
|
419
|
+
.command("login", "Authenticate with the CodePush server in order to begin managing your apps", (yargs: yargs.Argv) => {
|
|
420
|
+
isValidCommandCategory = true;
|
|
421
|
+
isValidCommand = true;
|
|
422
|
+
yargs
|
|
423
|
+
.usage(USAGE_PREFIX + " login [options]")
|
|
424
|
+
.demand(/*count*/ 0, /*max*/ 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
|
|
425
|
+
.example("login", "Logs in to the CodePush server")
|
|
426
|
+
.example("login --accessKey mykey", 'Logs in on behalf of the user who owns and created the access key "mykey"')
|
|
427
|
+
.option("accessKey", {
|
|
428
|
+
alias: "key",
|
|
429
|
+
default: null,
|
|
430
|
+
demand: false,
|
|
431
|
+
description:
|
|
432
|
+
"Access key to authenticate against the CodePush server with, instead of providing your username and password credentials",
|
|
433
|
+
type: "string",
|
|
434
|
+
})
|
|
435
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
436
|
+
|
|
437
|
+
addCommonConfiguration(yargs);
|
|
438
|
+
})
|
|
439
|
+
.command("logout", "Log out of the current session", (yargs: yargs.Argv) => {
|
|
440
|
+
isValidCommandCategory = true;
|
|
441
|
+
isValidCommand = true;
|
|
442
|
+
yargs
|
|
443
|
+
.usage(USAGE_PREFIX + " logout")
|
|
444
|
+
.demand(/*count*/ 0, /*max*/ 0)
|
|
445
|
+
.example("logout", "Logs out and ends your current session");
|
|
446
|
+
addCommonConfiguration(yargs);
|
|
447
|
+
})
|
|
448
|
+
.command("patch", "Update the metadata for an existing release", (yargs: yargs.Argv) => {
|
|
449
|
+
yargs
|
|
450
|
+
.usage(USAGE_PREFIX + " patch <appName> <deploymentName> [options]")
|
|
451
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
452
|
+
.example(
|
|
453
|
+
'patch MyApp Production --des "Updated description" -r 50%',
|
|
454
|
+
'Updates the description of the latest release for "MyApp" app\'s "Production" deployment and updates the rollout value to 50%'
|
|
455
|
+
)
|
|
456
|
+
.example(
|
|
457
|
+
'patch MyApp Production -l v3 --des "Updated description for v3"',
|
|
458
|
+
'Updates the description of the release with label v3 for "MyApp" app\'s "Production" deployment'
|
|
459
|
+
)
|
|
460
|
+
.option("label", {
|
|
461
|
+
alias: "l",
|
|
462
|
+
default: null,
|
|
463
|
+
demand: false,
|
|
464
|
+
description: "Label of the release to update. Defaults to the latest release within the specified deployment",
|
|
465
|
+
type: "string",
|
|
466
|
+
})
|
|
467
|
+
.option("description", {
|
|
468
|
+
alias: "des",
|
|
469
|
+
default: null,
|
|
470
|
+
demand: false,
|
|
471
|
+
description: "Description of the changes made to the app with this release",
|
|
472
|
+
type: "string",
|
|
473
|
+
})
|
|
474
|
+
.option("disabled", {
|
|
475
|
+
alias: "x",
|
|
476
|
+
default: null,
|
|
477
|
+
demand: false,
|
|
478
|
+
description: "Specifies whether this release should be immediately downloadable",
|
|
479
|
+
type: "boolean",
|
|
480
|
+
})
|
|
481
|
+
.option("mandatory", {
|
|
482
|
+
alias: "m",
|
|
483
|
+
default: null,
|
|
484
|
+
demand: false,
|
|
485
|
+
description: "Specifies whether this release should be considered mandatory",
|
|
486
|
+
type: "boolean",
|
|
487
|
+
})
|
|
488
|
+
.option("rollout", {
|
|
489
|
+
alias: "r",
|
|
490
|
+
default: null,
|
|
491
|
+
demand: false,
|
|
492
|
+
description:
|
|
493
|
+
"Percentage of users this release should be immediately available to. This attribute can only be increased from the current value.",
|
|
494
|
+
type: "string",
|
|
495
|
+
})
|
|
496
|
+
.option("targetBinaryVersion", {
|
|
497
|
+
alias: "t",
|
|
498
|
+
default: null,
|
|
499
|
+
demand: false,
|
|
500
|
+
description: "Semver expression that specifies the binary app version(s) this release is targeting (e.g. 1.1.0, ~1.2.3).",
|
|
501
|
+
type: "string",
|
|
502
|
+
})
|
|
503
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => {
|
|
504
|
+
return isValidRollout(argv);
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
addCommonConfiguration(yargs);
|
|
508
|
+
})
|
|
509
|
+
.command("promote", "Promote the latest release from one app deployment to another", (yargs: yargs.Argv) => {
|
|
510
|
+
yargs
|
|
511
|
+
.usage(USAGE_PREFIX + " promote <appName> <sourceDeploymentName> <destDeploymentName> [options]")
|
|
512
|
+
.demand(/*count*/ 3, /*max*/ 3) // Require exactly three non-option arguments
|
|
513
|
+
.example(
|
|
514
|
+
"promote MyApp Staging Production",
|
|
515
|
+
'Promotes the latest release within the "Staging" deployment of "MyApp" to "Production"'
|
|
516
|
+
)
|
|
517
|
+
.example(
|
|
518
|
+
'promote MyApp Staging Production --des "Production rollout" -r 25',
|
|
519
|
+
'Promotes the latest release within the "Staging" deployment of "MyApp" to "Production", with an updated description, and targeting only 25% of the users'
|
|
520
|
+
)
|
|
521
|
+
.option("description", {
|
|
522
|
+
alias: "des",
|
|
523
|
+
default: null,
|
|
524
|
+
demand: false,
|
|
525
|
+
description:
|
|
526
|
+
"Description of the changes made to the app with this release. If omitted, the description from the release being promoted will be used.",
|
|
527
|
+
type: "string",
|
|
528
|
+
})
|
|
529
|
+
.option("label", {
|
|
530
|
+
alias: "l",
|
|
531
|
+
default: null,
|
|
532
|
+
demand: false,
|
|
533
|
+
description: "Label of the source release that will be taken. If omitted, the latest release being promoted will be used.",
|
|
534
|
+
type: "string",
|
|
535
|
+
})
|
|
536
|
+
.option("disabled", {
|
|
537
|
+
alias: "x",
|
|
538
|
+
default: null,
|
|
539
|
+
demand: false,
|
|
540
|
+
description:
|
|
541
|
+
"Specifies whether this release should be immediately downloadable. If omitted, the disabled attribute from the release being promoted will be used.",
|
|
542
|
+
type: "boolean",
|
|
543
|
+
})
|
|
544
|
+
.option("mandatory", {
|
|
545
|
+
alias: "m",
|
|
546
|
+
default: null,
|
|
547
|
+
demand: false,
|
|
548
|
+
description:
|
|
549
|
+
"Specifies whether this release should be considered mandatory. If omitted, the mandatory property from the release being promoted will be used.",
|
|
550
|
+
type: "boolean",
|
|
551
|
+
})
|
|
552
|
+
.option("noDuplicateReleaseError", {
|
|
553
|
+
default: false,
|
|
554
|
+
demand: false,
|
|
555
|
+
description:
|
|
556
|
+
"When this flag is set, promoting a package that is identical to the latest release on the target deployment will produce a warning instead of an error",
|
|
557
|
+
type: "boolean",
|
|
558
|
+
})
|
|
559
|
+
.option("rollout", {
|
|
560
|
+
alias: "r",
|
|
561
|
+
default: "100%",
|
|
562
|
+
demand: false,
|
|
563
|
+
description: "Percentage of users this update should be immediately available to",
|
|
564
|
+
type: "string",
|
|
565
|
+
})
|
|
566
|
+
.option("targetBinaryVersion", {
|
|
567
|
+
alias: "t",
|
|
568
|
+
default: null,
|
|
569
|
+
demand: false,
|
|
570
|
+
description:
|
|
571
|
+
"Semver expression that specifies the binary app version(s) this release is targeting (e.g. 1.1.0, ~1.2.3). If omitted, the target binary version property from the release being promoted will be used.",
|
|
572
|
+
type: "string",
|
|
573
|
+
})
|
|
574
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => {
|
|
575
|
+
return isValidRollout(argv);
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
addCommonConfiguration(yargs);
|
|
579
|
+
})
|
|
580
|
+
.command("register", "Register a new CodePush account", (yargs: yargs.Argv) => {
|
|
581
|
+
isValidCommandCategory = true;
|
|
582
|
+
isValidCommand = true;
|
|
583
|
+
yargs
|
|
584
|
+
.usage(USAGE_PREFIX + " register")
|
|
585
|
+
.demand(/*count*/ 0, /*max*/ 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
|
|
586
|
+
.example("register", "Registers a new CodePush account")
|
|
587
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
588
|
+
|
|
589
|
+
addCommonConfiguration(yargs);
|
|
590
|
+
})
|
|
591
|
+
.command("release", "Release an update to an app deployment", (yargs: yargs.Argv) => {
|
|
592
|
+
yargs
|
|
593
|
+
.usage(USAGE_PREFIX + " release <appName> <updateContentsPath> <targetBinaryVersion> [options]")
|
|
594
|
+
.demand(/*count*/ 3, /*max*/ 3) // Require exactly three non-option arguments.
|
|
595
|
+
.example(
|
|
596
|
+
'release MyApp app.js "*"',
|
|
597
|
+
'Releases the "app.js" file to the "MyApp" app\'s "Staging" deployment, targeting any binary version using the "*" wildcard range syntax.'
|
|
598
|
+
)
|
|
599
|
+
.example(
|
|
600
|
+
"release MyApp ./platforms/ios/www 1.0.3 -d Production",
|
|
601
|
+
'Releases the "./platforms/ios/www" folder and all its contents to the "MyApp" app\'s "Production" deployment, targeting only the 1.0.3 binary version'
|
|
602
|
+
)
|
|
603
|
+
.example(
|
|
604
|
+
"release MyApp ./platforms/ios/www 1.0.3 -d Production -r 20",
|
|
605
|
+
'Releases the "./platforms/ios/www" folder and all its contents to the "MyApp" app\'s "Production" deployment, targeting the 1.0.3 binary version and rolling out to about 20% of the users'
|
|
606
|
+
)
|
|
607
|
+
.option("deploymentName", {
|
|
608
|
+
alias: "d",
|
|
609
|
+
default: "Staging",
|
|
610
|
+
demand: false,
|
|
611
|
+
description: "Deployment to release the update to",
|
|
612
|
+
type: "string",
|
|
613
|
+
})
|
|
614
|
+
.option("description", {
|
|
615
|
+
alias: "des",
|
|
616
|
+
default: null,
|
|
617
|
+
demand: false,
|
|
618
|
+
description: "Description of the changes made to the app in this release",
|
|
619
|
+
type: "string",
|
|
620
|
+
})
|
|
621
|
+
.option("disabled", {
|
|
622
|
+
alias: "x",
|
|
623
|
+
default: false,
|
|
624
|
+
demand: false,
|
|
625
|
+
description: "Specifies whether this release should be immediately downloadable",
|
|
626
|
+
type: "boolean",
|
|
627
|
+
})
|
|
628
|
+
.option("mandatory", {
|
|
629
|
+
alias: "m",
|
|
630
|
+
default: false,
|
|
631
|
+
demand: false,
|
|
632
|
+
description: "Specifies whether this release should be considered mandatory",
|
|
633
|
+
type: "boolean",
|
|
634
|
+
})
|
|
635
|
+
.option("noDuplicateReleaseError", {
|
|
636
|
+
default: false,
|
|
637
|
+
demand: false,
|
|
638
|
+
description:
|
|
639
|
+
"When this flag is set, releasing a package that is identical to the latest release will produce a warning instead of an error",
|
|
640
|
+
type: "boolean",
|
|
641
|
+
})
|
|
642
|
+
.option("rollout", {
|
|
643
|
+
alias: "r",
|
|
644
|
+
default: "100%",
|
|
645
|
+
demand: false,
|
|
646
|
+
description: "Percentage of users this release should be available to",
|
|
647
|
+
type: "string",
|
|
648
|
+
})
|
|
649
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => {
|
|
650
|
+
return checkValidReleaseOptions(argv);
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
addCommonConfiguration(yargs);
|
|
654
|
+
})
|
|
655
|
+
.command("release-react", "Release a React Native update to an app deployment", (yargs: yargs.Argv) => {
|
|
656
|
+
yargs
|
|
657
|
+
.usage(USAGE_PREFIX + " release-react <appName> <platform> [options]")
|
|
658
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
659
|
+
.example(
|
|
660
|
+
"release-react MyApp ios",
|
|
661
|
+
'Releases the React Native iOS project in the current working directory to the "MyApp" app\'s "Staging" deployment'
|
|
662
|
+
)
|
|
663
|
+
.example(
|
|
664
|
+
"release-react MyApp android -d Production",
|
|
665
|
+
'Releases the React Native Android project in the current working directory to the "MyApp" app\'s "Production" deployment'
|
|
666
|
+
)
|
|
667
|
+
.example(
|
|
668
|
+
"release-react MyApp windows --dev",
|
|
669
|
+
'Releases the development bundle of the React Native Windows project in the current working directory to the "MyApp" app\'s "Staging" deployment'
|
|
670
|
+
)
|
|
671
|
+
.option("bundleName", {
|
|
672
|
+
alias: "b",
|
|
673
|
+
default: null,
|
|
674
|
+
demand: false,
|
|
675
|
+
description:
|
|
676
|
+
'Name of the generated JS bundle file. If unspecified, the standard bundle name will be used, depending on the specified platform: "main.jsbundle" (iOS), "index.android.bundle" (Android) or "index.windows.bundle" (Windows)',
|
|
677
|
+
type: "string",
|
|
678
|
+
})
|
|
679
|
+
.option("deploymentName", {
|
|
680
|
+
alias: "d",
|
|
681
|
+
default: "Staging",
|
|
682
|
+
demand: false,
|
|
683
|
+
description: "Deployment to release the update to",
|
|
684
|
+
type: "string",
|
|
685
|
+
})
|
|
686
|
+
.option("description", {
|
|
687
|
+
alias: "des",
|
|
688
|
+
default: null,
|
|
689
|
+
demand: false,
|
|
690
|
+
description: "Description of the changes made to the app with this release",
|
|
691
|
+
type: "string",
|
|
692
|
+
})
|
|
693
|
+
.option("development", {
|
|
694
|
+
alias: "dev",
|
|
695
|
+
default: false,
|
|
696
|
+
demand: false,
|
|
697
|
+
description: "Specifies whether to generate a dev or release build",
|
|
698
|
+
type: "boolean",
|
|
699
|
+
})
|
|
700
|
+
.option("disabled", {
|
|
701
|
+
alias: "x",
|
|
702
|
+
default: false,
|
|
703
|
+
demand: false,
|
|
704
|
+
description: "Specifies whether this release should be immediately downloadable",
|
|
705
|
+
type: "boolean",
|
|
706
|
+
})
|
|
707
|
+
.option("entryFile", {
|
|
708
|
+
alias: "e",
|
|
709
|
+
default: null,
|
|
710
|
+
demand: false,
|
|
711
|
+
description:
|
|
712
|
+
'Path to the app\'s entry Javascript file. If omitted, "index.<platform>.js" and then "index.js" will be used (if they exist)',
|
|
713
|
+
type: "string",
|
|
714
|
+
})
|
|
715
|
+
.option("gradleFile", {
|
|
716
|
+
alias: "g",
|
|
717
|
+
default: null,
|
|
718
|
+
demand: false,
|
|
719
|
+
description: "Path to the gradle file which specifies the binary version you want to target this release at (android only).",
|
|
720
|
+
})
|
|
721
|
+
.option("mandatory", {
|
|
722
|
+
alias: "m",
|
|
723
|
+
default: false,
|
|
724
|
+
demand: false,
|
|
725
|
+
description: "Specifies whether this release should be considered mandatory",
|
|
726
|
+
type: "boolean",
|
|
727
|
+
})
|
|
728
|
+
.option("noDuplicateReleaseError", {
|
|
729
|
+
default: false,
|
|
730
|
+
demand: false,
|
|
731
|
+
description:
|
|
732
|
+
"When this flag is set, releasing a package that is identical to the latest release will produce a warning instead of an error",
|
|
733
|
+
type: "boolean",
|
|
734
|
+
})
|
|
735
|
+
.option("plistFile", {
|
|
736
|
+
alias: "p",
|
|
737
|
+
default: null,
|
|
738
|
+
demand: false,
|
|
739
|
+
description: "Path to the plist file which specifies the binary version you want to target this release at (iOS only).",
|
|
740
|
+
})
|
|
741
|
+
.option("plistFilePrefix", {
|
|
742
|
+
alias: "pre",
|
|
743
|
+
default: null,
|
|
744
|
+
demand: false,
|
|
745
|
+
description: "Prefix to append to the file name when attempting to find your app's Info.plist file (iOS only).",
|
|
746
|
+
})
|
|
747
|
+
.option("rollout", {
|
|
748
|
+
alias: "r",
|
|
749
|
+
default: "100%",
|
|
750
|
+
demand: false,
|
|
751
|
+
description: "Percentage of users this release should be immediately available to",
|
|
752
|
+
type: "string",
|
|
753
|
+
})
|
|
754
|
+
.option("sourcemapOutput", {
|
|
755
|
+
alias: "s",
|
|
756
|
+
default: null,
|
|
757
|
+
demand: false,
|
|
758
|
+
description:
|
|
759
|
+
"Path to where the sourcemap for the resulting bundle should be written. If omitted, a sourcemap will not be generated.",
|
|
760
|
+
type: "string",
|
|
761
|
+
})
|
|
762
|
+
.option("targetBinaryVersion", {
|
|
763
|
+
alias: "t",
|
|
764
|
+
default: null,
|
|
765
|
+
demand: false,
|
|
766
|
+
description:
|
|
767
|
+
'Semver expression that specifies the binary app version(s) this release is targeting (e.g. 1.1.0, ~1.2.3). If omitted, the release will target the exact version specified in the "Info.plist" (iOS), "build.gradle" (Android) or "Package.appxmanifest" (Windows) files.',
|
|
768
|
+
type: "string",
|
|
769
|
+
})
|
|
770
|
+
.option("outputDir", {
|
|
771
|
+
alias: "o",
|
|
772
|
+
default: null,
|
|
773
|
+
demand: false,
|
|
774
|
+
description:
|
|
775
|
+
"Path to where the bundle and sourcemap should be written. If omitted, a bundle and sourcemap will not be written.",
|
|
776
|
+
type: "string",
|
|
777
|
+
})
|
|
778
|
+
.option("useHermes", {
|
|
779
|
+
alias: "h",
|
|
780
|
+
default: false,
|
|
781
|
+
demand: false,
|
|
782
|
+
description: "Enable hermes and bypass automatic checks",
|
|
783
|
+
type: "boolean",
|
|
784
|
+
})
|
|
785
|
+
.option("podFile", {
|
|
786
|
+
alias: "pod",
|
|
787
|
+
default: null,
|
|
788
|
+
demand: false,
|
|
789
|
+
description: "Path to the cocopods config file (iOS only).",
|
|
790
|
+
type: "string",
|
|
791
|
+
})
|
|
792
|
+
.option("extraHermesFlags", {
|
|
793
|
+
alias: "hf",
|
|
794
|
+
default: [],
|
|
795
|
+
demand: false,
|
|
796
|
+
description:
|
|
797
|
+
"Flags that get passed to Hermes, JavaScript to bytecode compiler. Can be specified multiple times.",
|
|
798
|
+
type: "array",
|
|
799
|
+
})
|
|
800
|
+
.option("privateKeyPath", {
|
|
801
|
+
alias: "k",
|
|
802
|
+
default: null,
|
|
803
|
+
demand: false,
|
|
804
|
+
description: "Path to private key used for code signing.",
|
|
805
|
+
type: "string",
|
|
806
|
+
})
|
|
807
|
+
.option("xcodeProjectFile", {
|
|
808
|
+
alias: "xp",
|
|
809
|
+
default: null,
|
|
810
|
+
demand: false,
|
|
811
|
+
description: "Path to the Xcode project or project.pbxproj file",
|
|
812
|
+
type: "string",
|
|
813
|
+
})
|
|
814
|
+
.option("xcodeTargetName", {
|
|
815
|
+
alias: "xt",
|
|
816
|
+
default: undefined,
|
|
817
|
+
demand: false,
|
|
818
|
+
description: "Name of target (PBXNativeTarget) which specifies the binary version you want to target this release at (iOS only)",
|
|
819
|
+
type: "string",
|
|
820
|
+
})
|
|
821
|
+
.option("buildConfigurationName", {
|
|
822
|
+
alias: "c",
|
|
823
|
+
default: undefined,
|
|
824
|
+
demand: false,
|
|
825
|
+
description: "Name of build configuration which specifies the binary version you want to target this release at. For example, 'Debug' or 'Release' (iOS only)",
|
|
826
|
+
type: "string",
|
|
827
|
+
})
|
|
828
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => {
|
|
829
|
+
return checkValidReleaseOptions(argv);
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
addCommonConfiguration(yargs);
|
|
833
|
+
})
|
|
834
|
+
.command("rollback", "Rollback the latest release for an app deployment", (yargs: yargs.Argv) => {
|
|
835
|
+
yargs
|
|
836
|
+
.usage(USAGE_PREFIX + " rollback <appName> <deploymentName> [options]")
|
|
837
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
|
|
838
|
+
.example("rollback MyApp Production", 'Performs a rollback on the "Production" deployment of "MyApp"')
|
|
839
|
+
.example(
|
|
840
|
+
"rollback MyApp Production --targetRelease v4",
|
|
841
|
+
'Performs a rollback on the "Production" deployment of "MyApp" to the v4 release'
|
|
842
|
+
)
|
|
843
|
+
.option("targetRelease", {
|
|
844
|
+
alias: "r",
|
|
845
|
+
default: null,
|
|
846
|
+
demand: false,
|
|
847
|
+
description:
|
|
848
|
+
"Label of the release to roll the specified deployment back to (e.g. v4). If omitted, the deployment will roll back to the previous release.",
|
|
849
|
+
type: "string",
|
|
850
|
+
});
|
|
851
|
+
|
|
852
|
+
addCommonConfiguration(yargs);
|
|
853
|
+
})
|
|
854
|
+
.command("session", "View and manage the current login sessions associated with your account", (yargs: yargs.Argv) => {
|
|
855
|
+
isValidCommandCategory = true;
|
|
856
|
+
yargs
|
|
857
|
+
.usage(USAGE_PREFIX + " session <command>")
|
|
858
|
+
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments.
|
|
859
|
+
.command("remove", "Remove an existing login session", (yargs: yargs.Argv) => sessionRemove("remove", yargs))
|
|
860
|
+
.command("rm", "Remove an existing login session", (yargs: yargs.Argv) => sessionRemove("rm", yargs))
|
|
861
|
+
.command("list", "List the current login sessions associated with your account", (yargs: yargs.Argv) =>
|
|
862
|
+
sessionList("list", yargs)
|
|
863
|
+
)
|
|
864
|
+
.command("ls", "List the current login sessions associated with your account", (yargs: yargs.Argv) => sessionList("ls", yargs))
|
|
865
|
+
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
866
|
+
|
|
867
|
+
addCommonConfiguration(yargs);
|
|
868
|
+
})
|
|
869
|
+
.command("whoami", "Display the account info for the current login session", (yargs: yargs.Argv) => {
|
|
870
|
+
isValidCommandCategory = true;
|
|
871
|
+
isValidCommand = true;
|
|
872
|
+
yargs
|
|
873
|
+
.usage(USAGE_PREFIX + " whoami")
|
|
874
|
+
.demand(/*count*/ 0, /*max*/ 0)
|
|
875
|
+
.example("whoami", "Display the account info for the current login session");
|
|
876
|
+
addCommonConfiguration(yargs);
|
|
877
|
+
})
|
|
878
|
+
.alias("v", "version")
|
|
879
|
+
.version(packageJson.version)
|
|
880
|
+
.wrap(/*columnLimit*/ null)
|
|
881
|
+
.fail((msg: string) => showHelp(/*showRootDescription*/ true)).argv; // Suppress the default error message.
|
|
882
|
+
|
|
883
|
+
export function createCommand(): cli.ICommand {
|
|
884
|
+
let cmd: cli.ICommand;
|
|
885
|
+
|
|
886
|
+
const argv = yargs.parseSync();
|
|
887
|
+
|
|
888
|
+
if (!wasHelpShown && argv._ && argv._.length > 0) {
|
|
889
|
+
// Create a command object
|
|
890
|
+
const arg0: any = argv._[0];
|
|
891
|
+
const arg1: any = argv._[1];
|
|
892
|
+
const arg2: any = argv._[2];
|
|
893
|
+
const arg3: any = argv._[3];
|
|
894
|
+
const arg4: any = argv._[4];
|
|
895
|
+
|
|
896
|
+
switch (arg0) {
|
|
897
|
+
case "access-key":
|
|
898
|
+
switch (arg1) {
|
|
899
|
+
case "add":
|
|
900
|
+
if (arg2) {
|
|
901
|
+
cmd = { type: cli.CommandType.accessKeyAdd };
|
|
902
|
+
const accessKeyAddCmd = <cli.IAccessKeyAddCommand>cmd;
|
|
903
|
+
accessKeyAddCmd.name = arg2;
|
|
904
|
+
const ttlOption: string = argv["ttl"] as any;
|
|
905
|
+
if (isDefined(ttlOption)) {
|
|
906
|
+
accessKeyAddCmd.ttl = parseDurationMilliseconds(ttlOption);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
break;
|
|
910
|
+
|
|
911
|
+
case "patch":
|
|
912
|
+
if (arg2) {
|
|
913
|
+
cmd = { type: cli.CommandType.accessKeyPatch };
|
|
914
|
+
const accessKeyPatchCmd = <cli.IAccessKeyPatchCommand>cmd;
|
|
915
|
+
accessKeyPatchCmd.oldName = arg2;
|
|
916
|
+
|
|
917
|
+
const newNameOption: string = argv["name"] as any;
|
|
918
|
+
const ttlOption: string = argv["ttl"] as any;
|
|
919
|
+
if (isDefined(newNameOption)) {
|
|
920
|
+
accessKeyPatchCmd.newName = newNameOption;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
if (isDefined(ttlOption)) {
|
|
924
|
+
accessKeyPatchCmd.ttl = parseDurationMilliseconds(ttlOption);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
break;
|
|
928
|
+
|
|
929
|
+
case "list":
|
|
930
|
+
case "ls":
|
|
931
|
+
cmd = { type: cli.CommandType.accessKeyList };
|
|
932
|
+
|
|
933
|
+
(<cli.IAccessKeyListCommand>cmd).format = argv["format"] as any;
|
|
934
|
+
break;
|
|
935
|
+
|
|
936
|
+
case "remove":
|
|
937
|
+
case "rm":
|
|
938
|
+
if (arg2) {
|
|
939
|
+
cmd = { type: cli.CommandType.accessKeyRemove };
|
|
940
|
+
|
|
941
|
+
(<cli.IAccessKeyRemoveCommand>cmd).accessKey = arg2;
|
|
942
|
+
}
|
|
943
|
+
break;
|
|
944
|
+
}
|
|
945
|
+
break;
|
|
946
|
+
|
|
947
|
+
case "app":
|
|
948
|
+
switch (arg1) {
|
|
949
|
+
case "add":
|
|
950
|
+
if (arg2) {
|
|
951
|
+
cmd = { type: cli.CommandType.appAdd };
|
|
952
|
+
|
|
953
|
+
(<cli.IAppAddCommand>cmd).appName = arg2;
|
|
954
|
+
}
|
|
955
|
+
break;
|
|
956
|
+
|
|
957
|
+
case "list":
|
|
958
|
+
case "ls":
|
|
959
|
+
cmd = { type: cli.CommandType.appList };
|
|
960
|
+
|
|
961
|
+
(<cli.IAppListCommand>cmd).format = argv["format"] as any;
|
|
962
|
+
break;
|
|
963
|
+
|
|
964
|
+
case "remove":
|
|
965
|
+
case "rm":
|
|
966
|
+
if (arg2) {
|
|
967
|
+
cmd = { type: cli.CommandType.appRemove };
|
|
968
|
+
|
|
969
|
+
(<cli.IAppRemoveCommand>cmd).appName = arg2;
|
|
970
|
+
}
|
|
971
|
+
break;
|
|
972
|
+
|
|
973
|
+
case "rename":
|
|
974
|
+
if (arg2 && arg3) {
|
|
975
|
+
cmd = { type: cli.CommandType.appRename };
|
|
976
|
+
|
|
977
|
+
const appRenameCommand = <cli.IAppRenameCommand>cmd;
|
|
978
|
+
|
|
979
|
+
appRenameCommand.currentAppName = arg2;
|
|
980
|
+
appRenameCommand.newAppName = arg3;
|
|
981
|
+
}
|
|
982
|
+
break;
|
|
983
|
+
|
|
984
|
+
case "transfer":
|
|
985
|
+
if (arg2 && arg3) {
|
|
986
|
+
cmd = { type: cli.CommandType.appTransfer };
|
|
987
|
+
|
|
988
|
+
const appTransferCommand = <cli.IAppTransferCommand>cmd;
|
|
989
|
+
|
|
990
|
+
appTransferCommand.appName = arg2;
|
|
991
|
+
appTransferCommand.email = arg3;
|
|
992
|
+
}
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
break;
|
|
996
|
+
|
|
997
|
+
case "collaborator":
|
|
998
|
+
switch (arg1) {
|
|
999
|
+
case "add":
|
|
1000
|
+
if (arg2 && arg3) {
|
|
1001
|
+
cmd = { type: cli.CommandType.collaboratorAdd };
|
|
1002
|
+
|
|
1003
|
+
(<cli.ICollaboratorAddCommand>cmd).appName = arg2;
|
|
1004
|
+
(<cli.ICollaboratorAddCommand>cmd).email = arg3;
|
|
1005
|
+
}
|
|
1006
|
+
break;
|
|
1007
|
+
|
|
1008
|
+
case "list":
|
|
1009
|
+
case "ls":
|
|
1010
|
+
if (arg2) {
|
|
1011
|
+
cmd = { type: cli.CommandType.collaboratorList };
|
|
1012
|
+
|
|
1013
|
+
(<cli.ICollaboratorListCommand>cmd).appName = arg2;
|
|
1014
|
+
(<cli.ICollaboratorListCommand>cmd).format = argv["format"] as any;
|
|
1015
|
+
}
|
|
1016
|
+
break;
|
|
1017
|
+
|
|
1018
|
+
case "remove":
|
|
1019
|
+
case "rm":
|
|
1020
|
+
if (arg2 && arg3) {
|
|
1021
|
+
cmd = { type: cli.CommandType.collaboratorRemove };
|
|
1022
|
+
|
|
1023
|
+
(<cli.ICollaboratorRemoveCommand>cmd).appName = arg2;
|
|
1024
|
+
(<cli.ICollaboratorAddCommand>cmd).email = arg3;
|
|
1025
|
+
}
|
|
1026
|
+
break;
|
|
1027
|
+
}
|
|
1028
|
+
break;
|
|
1029
|
+
|
|
1030
|
+
case "debug":
|
|
1031
|
+
cmd = <cli.IDebugCommand>{
|
|
1032
|
+
type: cli.CommandType.debug,
|
|
1033
|
+
platform: arg1,
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
break;
|
|
1037
|
+
|
|
1038
|
+
case "deployment":
|
|
1039
|
+
switch (arg1) {
|
|
1040
|
+
case "add":
|
|
1041
|
+
if (arg2 && arg3) {
|
|
1042
|
+
cmd = { type: cli.CommandType.deploymentAdd };
|
|
1043
|
+
|
|
1044
|
+
const deploymentAddCommand = <cli.IDeploymentAddCommand>cmd;
|
|
1045
|
+
|
|
1046
|
+
deploymentAddCommand.appName = arg2;
|
|
1047
|
+
deploymentAddCommand.deploymentName = arg3;
|
|
1048
|
+
}
|
|
1049
|
+
break;
|
|
1050
|
+
|
|
1051
|
+
case "clear":
|
|
1052
|
+
if (arg2 && arg3) {
|
|
1053
|
+
cmd = { type: cli.CommandType.deploymentHistoryClear };
|
|
1054
|
+
|
|
1055
|
+
const deploymentHistoryClearCommand = <cli.IDeploymentHistoryClearCommand>cmd;
|
|
1056
|
+
|
|
1057
|
+
deploymentHistoryClearCommand.appName = arg2;
|
|
1058
|
+
deploymentHistoryClearCommand.deploymentName = arg3;
|
|
1059
|
+
}
|
|
1060
|
+
break;
|
|
1061
|
+
|
|
1062
|
+
case "list":
|
|
1063
|
+
case "ls":
|
|
1064
|
+
if (arg2) {
|
|
1065
|
+
cmd = { type: cli.CommandType.deploymentList };
|
|
1066
|
+
|
|
1067
|
+
const deploymentListCommand = <cli.IDeploymentListCommand>cmd;
|
|
1068
|
+
|
|
1069
|
+
deploymentListCommand.appName = arg2;
|
|
1070
|
+
deploymentListCommand.format = argv["format"] as any;
|
|
1071
|
+
deploymentListCommand.displayKeys = argv["displayKeys"] as any;
|
|
1072
|
+
}
|
|
1073
|
+
break;
|
|
1074
|
+
|
|
1075
|
+
case "remove":
|
|
1076
|
+
case "rm":
|
|
1077
|
+
if (arg2 && arg3) {
|
|
1078
|
+
cmd = { type: cli.CommandType.deploymentRemove };
|
|
1079
|
+
|
|
1080
|
+
const deploymentRemoveCommand = <cli.IDeploymentRemoveCommand>cmd;
|
|
1081
|
+
|
|
1082
|
+
deploymentRemoveCommand.appName = arg2;
|
|
1083
|
+
deploymentRemoveCommand.deploymentName = arg3;
|
|
1084
|
+
}
|
|
1085
|
+
break;
|
|
1086
|
+
|
|
1087
|
+
case "rename":
|
|
1088
|
+
if (arg2 && arg3 && arg4) {
|
|
1089
|
+
cmd = { type: cli.CommandType.deploymentRename };
|
|
1090
|
+
|
|
1091
|
+
const deploymentRenameCommand = <cli.IDeploymentRenameCommand>cmd;
|
|
1092
|
+
|
|
1093
|
+
deploymentRenameCommand.appName = arg2;
|
|
1094
|
+
deploymentRenameCommand.currentDeploymentName = arg3;
|
|
1095
|
+
deploymentRenameCommand.newDeploymentName = arg4;
|
|
1096
|
+
}
|
|
1097
|
+
break;
|
|
1098
|
+
|
|
1099
|
+
case "history":
|
|
1100
|
+
case "h":
|
|
1101
|
+
if (arg2 && arg3) {
|
|
1102
|
+
cmd = { type: cli.CommandType.deploymentHistory };
|
|
1103
|
+
|
|
1104
|
+
const deploymentHistoryCommand = <cli.IDeploymentHistoryCommand>cmd;
|
|
1105
|
+
|
|
1106
|
+
deploymentHistoryCommand.appName = arg2;
|
|
1107
|
+
deploymentHistoryCommand.deploymentName = arg3;
|
|
1108
|
+
deploymentHistoryCommand.format = argv["format"] as any;
|
|
1109
|
+
deploymentHistoryCommand.displayAuthor = argv["displayAuthor"] as any;
|
|
1110
|
+
}
|
|
1111
|
+
break;
|
|
1112
|
+
}
|
|
1113
|
+
break;
|
|
1114
|
+
|
|
1115
|
+
case "link":
|
|
1116
|
+
cmd = <cli.ILinkCommand>{
|
|
1117
|
+
type: cli.CommandType.link,
|
|
1118
|
+
serverUrl: getServerUrl(arg1),
|
|
1119
|
+
};
|
|
1120
|
+
break;
|
|
1121
|
+
|
|
1122
|
+
case "login":
|
|
1123
|
+
cmd = { type: cli.CommandType.login };
|
|
1124
|
+
|
|
1125
|
+
const loginCommand = <cli.ILoginCommand>cmd;
|
|
1126
|
+
|
|
1127
|
+
loginCommand.serverUrl = getServerUrl(arg1);
|
|
1128
|
+
loginCommand.accessKey = argv["accessKey"] as any;
|
|
1129
|
+
break;
|
|
1130
|
+
|
|
1131
|
+
case "logout":
|
|
1132
|
+
cmd = { type: cli.CommandType.logout };
|
|
1133
|
+
break;
|
|
1134
|
+
|
|
1135
|
+
case "patch":
|
|
1136
|
+
if (arg1 && arg2) {
|
|
1137
|
+
cmd = { type: cli.CommandType.patch };
|
|
1138
|
+
|
|
1139
|
+
const patchCommand = <cli.IPatchCommand>cmd;
|
|
1140
|
+
|
|
1141
|
+
patchCommand.appName = arg1;
|
|
1142
|
+
patchCommand.deploymentName = arg2;
|
|
1143
|
+
patchCommand.label = argv["label"] as any;
|
|
1144
|
+
// Description must be set to null to indicate that it is not being patched.
|
|
1145
|
+
patchCommand.description = argv["description"] ? backslash(argv["description"]) : null;
|
|
1146
|
+
patchCommand.disabled = argv["disabled"] as any;
|
|
1147
|
+
patchCommand.mandatory = argv["mandatory"] as any;
|
|
1148
|
+
patchCommand.rollout = getRolloutValue(argv["rollout"] as any);
|
|
1149
|
+
patchCommand.appStoreVersion = argv["targetBinaryVersion"] as any;
|
|
1150
|
+
}
|
|
1151
|
+
break;
|
|
1152
|
+
|
|
1153
|
+
case "promote":
|
|
1154
|
+
if (arg1 && arg2 && arg3) {
|
|
1155
|
+
cmd = { type: cli.CommandType.promote };
|
|
1156
|
+
|
|
1157
|
+
const deploymentPromoteCommand = <cli.IPromoteCommand>cmd;
|
|
1158
|
+
|
|
1159
|
+
deploymentPromoteCommand.appName = arg1;
|
|
1160
|
+
deploymentPromoteCommand.sourceDeploymentName = arg2;
|
|
1161
|
+
deploymentPromoteCommand.destDeploymentName = arg3;
|
|
1162
|
+
deploymentPromoteCommand.description = argv["description"] ? backslash(argv["description"]) : "";
|
|
1163
|
+
deploymentPromoteCommand.label = argv["label"] as any;
|
|
1164
|
+
deploymentPromoteCommand.disabled = argv["disabled"] as any;
|
|
1165
|
+
deploymentPromoteCommand.mandatory = argv["mandatory"] as any;
|
|
1166
|
+
deploymentPromoteCommand.noDuplicateReleaseError = argv["noDuplicateReleaseError"] as any;
|
|
1167
|
+
deploymentPromoteCommand.rollout = getRolloutValue(argv["rollout"] as any);
|
|
1168
|
+
deploymentPromoteCommand.appStoreVersion = argv["targetBinaryVersion"] as any;
|
|
1169
|
+
}
|
|
1170
|
+
break;
|
|
1171
|
+
|
|
1172
|
+
case "register":
|
|
1173
|
+
cmd = { type: cli.CommandType.register };
|
|
1174
|
+
|
|
1175
|
+
const registerCommand = <cli.IRegisterCommand>cmd;
|
|
1176
|
+
|
|
1177
|
+
registerCommand.serverUrl = getServerUrl(arg1);
|
|
1178
|
+
break;
|
|
1179
|
+
|
|
1180
|
+
case "release":
|
|
1181
|
+
if (arg1 && arg2 && arg3) {
|
|
1182
|
+
cmd = { type: cli.CommandType.release };
|
|
1183
|
+
|
|
1184
|
+
const releaseCommand = <cli.IReleaseCommand>cmd;
|
|
1185
|
+
|
|
1186
|
+
releaseCommand.appName = arg1;
|
|
1187
|
+
releaseCommand.package = arg2;
|
|
1188
|
+
releaseCommand.appStoreVersion = arg3;
|
|
1189
|
+
releaseCommand.deploymentName = argv["deploymentName"] as any;
|
|
1190
|
+
releaseCommand.description = argv["description"] ? backslash(argv["description"]) : "";
|
|
1191
|
+
releaseCommand.disabled = argv["disabled"] as any;
|
|
1192
|
+
releaseCommand.mandatory = argv["mandatory"] as any;
|
|
1193
|
+
releaseCommand.noDuplicateReleaseError = argv["noDuplicateReleaseError"] as any;
|
|
1194
|
+
releaseCommand.rollout = getRolloutValue(argv["rollout"] as any);
|
|
1195
|
+
}
|
|
1196
|
+
break;
|
|
1197
|
+
|
|
1198
|
+
case "release-react":
|
|
1199
|
+
if (arg1 && arg2) {
|
|
1200
|
+
cmd = { type: cli.CommandType.releaseReact };
|
|
1201
|
+
|
|
1202
|
+
const releaseReactCommand = <cli.IReleaseReactCommand>cmd;
|
|
1203
|
+
|
|
1204
|
+
releaseReactCommand.appName = arg1;
|
|
1205
|
+
releaseReactCommand.platform = arg2;
|
|
1206
|
+
|
|
1207
|
+
releaseReactCommand.appStoreVersion = argv["targetBinaryVersion"] as any;
|
|
1208
|
+
releaseReactCommand.bundleName = argv["bundleName"] as any;
|
|
1209
|
+
releaseReactCommand.deploymentName = argv["deploymentName"] as any;
|
|
1210
|
+
releaseReactCommand.disabled = argv["disabled"] as any;
|
|
1211
|
+
releaseReactCommand.description = argv["description"] ? backslash(argv["description"]) : "";
|
|
1212
|
+
releaseReactCommand.development = argv["development"] as any;
|
|
1213
|
+
releaseReactCommand.entryFile = argv["entryFile"] as any;
|
|
1214
|
+
releaseReactCommand.gradleFile = argv["gradleFile"] as any;
|
|
1215
|
+
releaseReactCommand.mandatory = argv["mandatory"] as any;
|
|
1216
|
+
releaseReactCommand.noDuplicateReleaseError = argv["noDuplicateReleaseError"] as any;
|
|
1217
|
+
releaseReactCommand.plistFile = argv["plistFile"] as any;
|
|
1218
|
+
releaseReactCommand.plistFilePrefix = argv["plistFilePrefix"] as any;
|
|
1219
|
+
releaseReactCommand.rollout = getRolloutValue(argv["rollout"] as any);
|
|
1220
|
+
releaseReactCommand.sourcemapOutput = argv["sourcemapOutput"] as any;
|
|
1221
|
+
releaseReactCommand.outputDir = argv["outputDir"] as any;
|
|
1222
|
+
releaseReactCommand.useHermes = argv["useHermes"] as any;
|
|
1223
|
+
releaseReactCommand.extraHermesFlags = argv["extraHermesFlags"] as any;
|
|
1224
|
+
releaseReactCommand.podFile = argv["podFile"] as any;
|
|
1225
|
+
releaseReactCommand.privateKeyPath = argv["privateKeyPath"] as any;
|
|
1226
|
+
releaseReactCommand.xcodeProjectFile = argv["xcodeProjectFile"] as any;
|
|
1227
|
+
releaseReactCommand.xcodeTargetName = argv["xcodeTargetName"] as any;
|
|
1228
|
+
releaseReactCommand.buildConfigurationName = argv["buildConfigurationName"] as any;
|
|
1229
|
+
}
|
|
1230
|
+
break;
|
|
1231
|
+
|
|
1232
|
+
case "rollback":
|
|
1233
|
+
if (arg1 && arg2) {
|
|
1234
|
+
cmd = { type: cli.CommandType.rollback };
|
|
1235
|
+
|
|
1236
|
+
const rollbackCommand = <cli.IRollbackCommand>cmd;
|
|
1237
|
+
|
|
1238
|
+
rollbackCommand.appName = arg1;
|
|
1239
|
+
rollbackCommand.deploymentName = arg2;
|
|
1240
|
+
rollbackCommand.targetRelease = argv["targetRelease"] as any;
|
|
1241
|
+
}
|
|
1242
|
+
break;
|
|
1243
|
+
|
|
1244
|
+
case "session":
|
|
1245
|
+
switch (arg1) {
|
|
1246
|
+
case "list":
|
|
1247
|
+
case "ls":
|
|
1248
|
+
cmd = { type: cli.CommandType.sessionList };
|
|
1249
|
+
|
|
1250
|
+
(<cli.ISessionListCommand>cmd).format = argv["format"] as any;
|
|
1251
|
+
break;
|
|
1252
|
+
|
|
1253
|
+
case "remove":
|
|
1254
|
+
case "rm":
|
|
1255
|
+
if (arg2) {
|
|
1256
|
+
cmd = { type: cli.CommandType.sessionRemove };
|
|
1257
|
+
|
|
1258
|
+
(<cli.ISessionRemoveCommand>cmd).machineName = arg2;
|
|
1259
|
+
}
|
|
1260
|
+
break;
|
|
1261
|
+
}
|
|
1262
|
+
break;
|
|
1263
|
+
|
|
1264
|
+
case "whoami":
|
|
1265
|
+
cmd = { type: cli.CommandType.whoami };
|
|
1266
|
+
break;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
return cmd;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
function isValidRollout(args: any): boolean {
|
|
1274
|
+
const rollout: string = args["rollout"];
|
|
1275
|
+
if (rollout && !ROLLOUT_PERCENTAGE_REGEX.test(rollout)) {
|
|
1276
|
+
return false;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
return true;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
function checkValidReleaseOptions(args: any): boolean {
|
|
1283
|
+
return isValidRollout(args) && !!args["deploymentName"];
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
function getRolloutValue(input: string): number {
|
|
1287
|
+
return input ? parseInt(input.replace("%", "")) : null;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
function getServerUrl(url: string): string {
|
|
1291
|
+
if (!url) return null;
|
|
1292
|
+
|
|
1293
|
+
// Trim whitespace and a trailing slash (/) character.
|
|
1294
|
+
url = url.trim();
|
|
1295
|
+
if (url[url.length - 1] === "/") {
|
|
1296
|
+
url = url.substring(0, url.length - 1);
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
url = url.replace(/^(https?):\\/, "$1://"); // Replace 'http(s):\' with 'http(s)://' for Windows Git Bash
|
|
1300
|
+
|
|
1301
|
+
return url;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
function isDefined(object: any): boolean {
|
|
1305
|
+
return object !== undefined && object !== null;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
function parseDurationMilliseconds(durationString: string): number {
|
|
1309
|
+
return Math.floor(parseDuration(durationString));
|
|
1310
|
+
}
|