@appcircle/codepush-cli 0.0.2 → 0.0.3
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/bin/script/command-executor.js +16 -69
- package/bin/script/command-parser.js +13 -197
- package/bin/script/management-sdk.js +3 -0
- package/bin/script/types/cli.js +20 -27
- package/bin/test/cli.js +0 -198
- package/package.json +1 -1
- package/script/command-executor.ts +20 -87
- package/script/command-parser.ts +15 -243
- package/script/management-sdk.ts +5 -0
- package/script/types/cli.ts +6 -9
- package/script/types/rest-definitions.ts +6 -0
- package/test/cli.ts +0 -249
|
@@ -69,51 +69,6 @@ const confirm = (message = "Are you sure?") => {
|
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
71
|
exports.confirm = confirm;
|
|
72
|
-
function accessKeyAdd(command) {
|
|
73
|
-
return exports.sdk.addAccessKey(command.name, command.ttl).then((accessKey) => {
|
|
74
|
-
(0, exports.log)(`Successfully created the "${command.name}" access key: ${accessKey.key}`);
|
|
75
|
-
(0, exports.log)("Make sure to save this key value somewhere safe, since you won't be able to view it from the CLI again!");
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
function accessKeyPatch(command) {
|
|
79
|
-
const willUpdateName = isCommandOptionSpecified(command.newName) && command.oldName !== command.newName;
|
|
80
|
-
const willUpdateTtl = isCommandOptionSpecified(command.ttl);
|
|
81
|
-
if (!willUpdateName && !willUpdateTtl) {
|
|
82
|
-
throw new Error("A new name and/or TTL must be provided.");
|
|
83
|
-
}
|
|
84
|
-
return exports.sdk.patchAccessKey(command.oldName, command.newName, command.ttl).then((accessKey) => {
|
|
85
|
-
let logMessage = "Successfully ";
|
|
86
|
-
if (willUpdateName) {
|
|
87
|
-
logMessage += `renamed the access key "${command.oldName}" to "${command.newName}"`;
|
|
88
|
-
}
|
|
89
|
-
if (willUpdateTtl) {
|
|
90
|
-
const expirationDate = moment(accessKey.expires).format("LLLL");
|
|
91
|
-
if (willUpdateName) {
|
|
92
|
-
logMessage += ` and changed its expiration date to ${expirationDate}`;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
logMessage += `changed the expiration date of the "${command.oldName}" access key to ${expirationDate}`;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
(0, exports.log)(`${logMessage}.`);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
function accessKeyList(command) {
|
|
102
|
-
throwForInvalidOutputFormat(command.format);
|
|
103
|
-
return exports.sdk.getAccessKeys().then((accessKeys) => {
|
|
104
|
-
printAccessKeys(command.format, accessKeys);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
function accessKeyRemove(command) {
|
|
108
|
-
return (0, exports.confirm)().then((wasConfirmed) => {
|
|
109
|
-
if (wasConfirmed) {
|
|
110
|
-
return exports.sdk.removeAccessKey(command.accessKey).then(() => {
|
|
111
|
-
(0, exports.log)(`Successfully removed the "${command.accessKey}" access key.`);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
(0, exports.log)("Access key removal cancelled.");
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
72
|
function appAdd(command) {
|
|
118
73
|
return exports.sdk.addApp(command.appName).then((app) => {
|
|
119
74
|
(0, exports.log)('Successfully added the "' + command.appName + '" app, along with the following default deployments:');
|
|
@@ -133,6 +88,11 @@ function appList(command) {
|
|
|
133
88
|
printAppList(command.format, retrievedApps);
|
|
134
89
|
});
|
|
135
90
|
}
|
|
91
|
+
function appDeploymentKeyList(command) {
|
|
92
|
+
return exports.sdk.getDeploymentKeys(command.appName).then((retrievedKeys) => {
|
|
93
|
+
printAppDeploymentKeyList(retrievedKeys);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
136
96
|
function appRemove(command) {
|
|
137
97
|
return (0, exports.confirm)("Are you sure you want to remove this app? Note that its deployment keys will be PERMANENTLY unrecoverable.").then((wasConfirmed) => {
|
|
138
98
|
if (wasConfirmed) {
|
|
@@ -337,14 +297,6 @@ function execute(command) {
|
|
|
337
297
|
switch (command.type) {
|
|
338
298
|
// Must not be logged in
|
|
339
299
|
case cli.CommandType.login:
|
|
340
|
-
case cli.CommandType.register:
|
|
341
|
-
if (connectionInfo) {
|
|
342
|
-
throw new Error("You are already logged in from this machine.");
|
|
343
|
-
}
|
|
344
|
-
break;
|
|
345
|
-
// It does not matter whether you are logged in or not
|
|
346
|
-
case cli.CommandType.link:
|
|
347
|
-
break;
|
|
348
300
|
// Must be logged in
|
|
349
301
|
default:
|
|
350
302
|
if (!!exports.sdk)
|
|
@@ -356,18 +308,12 @@ function execute(command) {
|
|
|
356
308
|
break;
|
|
357
309
|
}
|
|
358
310
|
switch (command.type) {
|
|
359
|
-
case cli.CommandType.accessKeyAdd:
|
|
360
|
-
return accessKeyAdd(command);
|
|
361
|
-
case cli.CommandType.accessKeyPatch:
|
|
362
|
-
return accessKeyPatch(command);
|
|
363
|
-
case cli.CommandType.accessKeyList:
|
|
364
|
-
return accessKeyList(command);
|
|
365
|
-
case cli.CommandType.accessKeyRemove:
|
|
366
|
-
return accessKeyRemove(command);
|
|
367
311
|
case cli.CommandType.appAdd:
|
|
368
312
|
return appAdd(command);
|
|
369
313
|
case cli.CommandType.appList:
|
|
370
314
|
return appList(command);
|
|
315
|
+
case cli.CommandType.appDeploymentKeyList:
|
|
316
|
+
return appDeploymentKeyList(command);
|
|
371
317
|
case cli.CommandType.appRemove:
|
|
372
318
|
return appRemove(command);
|
|
373
319
|
case cli.CommandType.appRename:
|
|
@@ -386,8 +332,6 @@ function execute(command) {
|
|
|
386
332
|
return deploymentRemove(command);
|
|
387
333
|
case cli.CommandType.deploymentRename:
|
|
388
334
|
return deploymentRename(command);
|
|
389
|
-
case cli.CommandType.link:
|
|
390
|
-
return link(command);
|
|
391
335
|
case cli.CommandType.login:
|
|
392
336
|
return login(command);
|
|
393
337
|
case cli.CommandType.logout:
|
|
@@ -396,18 +340,12 @@ function execute(command) {
|
|
|
396
340
|
return patch(command);
|
|
397
341
|
case cli.CommandType.promote:
|
|
398
342
|
return promote(command);
|
|
399
|
-
case cli.CommandType.register:
|
|
400
|
-
return register(command);
|
|
401
343
|
case cli.CommandType.release:
|
|
402
344
|
return (0, exports.release)(command);
|
|
403
345
|
case cli.CommandType.releaseReact:
|
|
404
346
|
return (0, exports.releaseReact)(command);
|
|
405
347
|
case cli.CommandType.rollback:
|
|
406
348
|
return rollback(command);
|
|
407
|
-
case cli.CommandType.sessionList:
|
|
408
|
-
return sessionList(command);
|
|
409
|
-
case cli.CommandType.sessionRemove:
|
|
410
|
-
return sessionRemove(command);
|
|
411
349
|
default:
|
|
412
350
|
// We should never see this message as invalid commands should be caught by the argument parser.
|
|
413
351
|
throw new Error("Invalid command: " + JSON.stringify(command));
|
|
@@ -514,6 +452,15 @@ function printAppList(format, apps) {
|
|
|
514
452
|
});
|
|
515
453
|
}
|
|
516
454
|
}
|
|
455
|
+
function printAppDeploymentKeyList(deploymentKeys) {
|
|
456
|
+
const headers = ["Name", "Deployment Key"];
|
|
457
|
+
printTable(headers, (dataSource) => {
|
|
458
|
+
deploymentKeys.forEach((deploymentKey, index) => {
|
|
459
|
+
const row = [deploymentKey.name, wordwrap(50)(deploymentKey.deploymentKey)];
|
|
460
|
+
dataSource.push(row);
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
}
|
|
517
464
|
function getCollaboratorDisplayName(email, collaboratorProperties) {
|
|
518
465
|
return collaboratorProperties.permission === AccountManager.AppPermission.OWNER ? email + chalk.magenta(" (Owner)") : email;
|
|
519
466
|
}
|
|
@@ -32,65 +32,6 @@ function showHelp(showRootDescription) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
exports.showHelp = showHelp;
|
|
35
|
-
function accessKeyAdd(commandName, yargs) {
|
|
36
|
-
isValidCommand = true;
|
|
37
|
-
yargs
|
|
38
|
-
.usage(USAGE_PREFIX + " access-key " + commandName + " <accessKeyName>")
|
|
39
|
-
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
40
|
-
.example("access-key " + commandName + ' "VSTS Integration"', 'Creates a new access key with the name "VSTS Integration", which expires in 60 days')
|
|
41
|
-
.example("access-key " + commandName + ' "One time key" --ttl 5m', 'Creates a new access key with the name "One time key", which expires in 5 minutes')
|
|
42
|
-
.option("ttl", {
|
|
43
|
-
default: "60d",
|
|
44
|
-
demand: false,
|
|
45
|
-
description: "Duration string which specifies the amount of time that the access key should remain valid for (e.g 5m, 60d, 1y)",
|
|
46
|
-
type: "string",
|
|
47
|
-
});
|
|
48
|
-
addCommonConfiguration(yargs);
|
|
49
|
-
}
|
|
50
|
-
function accessKeyPatch(commandName, yargs) {
|
|
51
|
-
isValidCommand = true;
|
|
52
|
-
yargs
|
|
53
|
-
.usage(USAGE_PREFIX + " access-key " + commandName + " <accessKeyName>")
|
|
54
|
-
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
55
|
-
.example("access-key " + commandName + ' "Key for build server" --name "Key for CI machine"', 'Renames the access key named "Key for build server" to "Key for CI machine"')
|
|
56
|
-
.example("access-key " + commandName + ' "Key for build server" --ttl 7d', 'Updates the access key named "Key for build server" to expire in 7 days')
|
|
57
|
-
.option("name", {
|
|
58
|
-
default: null,
|
|
59
|
-
demand: false,
|
|
60
|
-
description: "Display name for the access key",
|
|
61
|
-
type: "string",
|
|
62
|
-
})
|
|
63
|
-
.option("ttl", {
|
|
64
|
-
default: null,
|
|
65
|
-
demand: false,
|
|
66
|
-
description: "Duration string which specifies the amount of time that the access key should remain valid for (e.g 5m, 60d, 1y)",
|
|
67
|
-
type: "string",
|
|
68
|
-
});
|
|
69
|
-
addCommonConfiguration(yargs);
|
|
70
|
-
}
|
|
71
|
-
function accessKeyList(commandName, yargs) {
|
|
72
|
-
isValidCommand = true;
|
|
73
|
-
yargs
|
|
74
|
-
.usage(USAGE_PREFIX + " access-key " + commandName + " [options]")
|
|
75
|
-
.demand(/*count*/ 0, /*max*/ 0)
|
|
76
|
-
.example("access-key " + commandName, "Lists your access keys in tabular format")
|
|
77
|
-
.example("access-key " + commandName + " --format json", "Lists your access keys in JSON format")
|
|
78
|
-
.option("format", {
|
|
79
|
-
default: "table",
|
|
80
|
-
demand: false,
|
|
81
|
-
description: 'Output format to display your access keys with ("json" or "table")',
|
|
82
|
-
type: "string",
|
|
83
|
-
});
|
|
84
|
-
addCommonConfiguration(yargs);
|
|
85
|
-
}
|
|
86
|
-
function accessKeyRemove(commandName, yargs) {
|
|
87
|
-
isValidCommand = true;
|
|
88
|
-
yargs
|
|
89
|
-
.usage(USAGE_PREFIX + " access-key " + commandName + " <accessKeyName>")
|
|
90
|
-
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
91
|
-
.example("access-key " + commandName + ' "VSTS Integration"', 'Removes the "VSTS Integration" access key');
|
|
92
|
-
addCommonConfiguration(yargs);
|
|
93
|
-
}
|
|
94
35
|
function addCommonConfiguration(yargs) {
|
|
95
36
|
yargs
|
|
96
37
|
.wrap(/*columnLimit*/ null)
|
|
@@ -120,6 +61,14 @@ function appRemove(commandName, yargs) {
|
|
|
120
61
|
.example("app " + commandName + " MyApp", 'Removes app "MyApp"');
|
|
121
62
|
addCommonConfiguration(yargs);
|
|
122
63
|
}
|
|
64
|
+
function appDeploymentKeyList(commandName, yargs) {
|
|
65
|
+
isValidCommand = true;
|
|
66
|
+
yargs
|
|
67
|
+
.usage(USAGE_PREFIX + " app " + commandName + " <appName>")
|
|
68
|
+
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
69
|
+
.example("app " + commandName + " MyApp", 'Lists the deployment keys for app "MyApp" in tabular format');
|
|
70
|
+
addCommonConfiguration(yargs);
|
|
71
|
+
}
|
|
123
72
|
function listCollaborators(commandName, yargs) {
|
|
124
73
|
isValidCommand = true;
|
|
125
74
|
yargs
|
|
@@ -143,29 +92,6 @@ function removeCollaborator(commandName, yargs) {
|
|
|
143
92
|
.example("collaborator " + commandName + " MyApp foo@bar.com", 'Removes foo@bar.com as a collaborator from app "MyApp"');
|
|
144
93
|
addCommonConfiguration(yargs);
|
|
145
94
|
}
|
|
146
|
-
function sessionList(commandName, yargs) {
|
|
147
|
-
isValidCommand = true;
|
|
148
|
-
yargs
|
|
149
|
-
.usage(USAGE_PREFIX + " session " + commandName + " [options]")
|
|
150
|
-
.demand(/*count*/ 0, /*max*/ 0)
|
|
151
|
-
.example("session " + commandName, "Lists your sessions in tabular format")
|
|
152
|
-
.example("session " + commandName + " --format json", "Lists your login sessions in JSON format")
|
|
153
|
-
.option("format", {
|
|
154
|
-
default: "table",
|
|
155
|
-
demand: false,
|
|
156
|
-
description: 'Output format to display your login sessions with ("json" or "table")',
|
|
157
|
-
type: "string",
|
|
158
|
-
});
|
|
159
|
-
addCommonConfiguration(yargs);
|
|
160
|
-
}
|
|
161
|
-
function sessionRemove(commandName, yargs) {
|
|
162
|
-
isValidCommand = true;
|
|
163
|
-
yargs
|
|
164
|
-
.usage(USAGE_PREFIX + " session " + commandName + " <machineName>")
|
|
165
|
-
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option arguments
|
|
166
|
-
.example("session " + commandName + ' "John\'s PC"', 'Removes the existing login session from "John\'s PC"');
|
|
167
|
-
addCommonConfiguration(yargs);
|
|
168
|
-
}
|
|
169
95
|
function deploymentHistoryClear(commandName, yargs) {
|
|
170
96
|
isValidCommand = true;
|
|
171
97
|
yargs
|
|
@@ -229,20 +155,6 @@ function deploymentHistory(commandName, yargs) {
|
|
|
229
155
|
yargs
|
|
230
156
|
.usage(USAGE_PREFIX + " <command>")
|
|
231
157
|
.demand(/*count*/ 1, /*max*/ 1) // Require exactly one non-option argument.
|
|
232
|
-
.command("access-key", "View and manage the access keys associated with your account", (yargs) => {
|
|
233
|
-
isValidCommandCategory = true;
|
|
234
|
-
yargs
|
|
235
|
-
.usage(USAGE_PREFIX + " access-key <command>")
|
|
236
|
-
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments.
|
|
237
|
-
.command("add", "Create a new access key associated with your account", (yargs) => accessKeyAdd("add", yargs))
|
|
238
|
-
.command("patch", "Update the name and/or TTL of an existing access key", (yargs) => accessKeyPatch("patch", yargs))
|
|
239
|
-
.command("remove", "Remove an existing access key", (yargs) => accessKeyRemove("remove", yargs))
|
|
240
|
-
.command("rm", "Remove an existing access key", (yargs) => accessKeyRemove("rm", yargs))
|
|
241
|
-
.command("list", "List the access keys associated with your account", (yargs) => accessKeyList("list", yargs))
|
|
242
|
-
.command("ls", "List the access keys associated with your account", (yargs) => accessKeyList("ls", yargs))
|
|
243
|
-
.check((argv, aliases) => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
244
|
-
addCommonConfiguration(yargs);
|
|
245
|
-
})
|
|
246
158
|
.command("app", "View and manage your CodePush apps", (yargs) => {
|
|
247
159
|
isValidCommandCategory = true;
|
|
248
160
|
yargs
|
|
@@ -268,6 +180,7 @@ yargs
|
|
|
268
180
|
})
|
|
269
181
|
.command("list", "Lists the apps associated with your account", (yargs) => appList("list", yargs))
|
|
270
182
|
.command("ls", "Lists the apps associated with your account", (yargs) => appList("ls", yargs))
|
|
183
|
+
.command("deployment-keys", "Lists the deployment keys for app", (yargs) => appDeploymentKeyList("deployment-keys", yargs))
|
|
271
184
|
.command("transfer", "Transfer the ownership of an app to another account", (yargs) => {
|
|
272
185
|
isValidCommand = true;
|
|
273
186
|
yargs
|
|
@@ -326,16 +239,6 @@ yargs
|
|
|
326
239
|
.command("h", "Display the release history for a deployment", (yargs) => deploymentHistory("h", yargs))
|
|
327
240
|
.check((argv, aliases) => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
328
241
|
addCommonConfiguration(yargs);
|
|
329
|
-
})
|
|
330
|
-
.command("link", "Link an additional authentication provider (e.g. GitHub) to an existing CodePush account", (yargs) => {
|
|
331
|
-
isValidCommandCategory = true;
|
|
332
|
-
isValidCommand = true;
|
|
333
|
-
yargs
|
|
334
|
-
.usage(USAGE_PREFIX + " link")
|
|
335
|
-
.demand(/*count*/ 0, /*max*/ 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
|
|
336
|
-
.example("link", "Links an account on the CodePush server")
|
|
337
|
-
.check((argv, aliases) => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
338
|
-
addCommonConfiguration(yargs);
|
|
339
242
|
})
|
|
340
243
|
.command("login", "Authenticate with the CodePush server in order to begin managing your apps", (yargs) => {
|
|
341
244
|
isValidCommandCategory = true;
|
|
@@ -489,16 +392,6 @@ yargs
|
|
|
489
392
|
return isValidRollout(argv);
|
|
490
393
|
});
|
|
491
394
|
addCommonConfiguration(yargs);
|
|
492
|
-
})
|
|
493
|
-
.command("register", "Register a new CodePush account", (yargs) => {
|
|
494
|
-
isValidCommandCategory = true;
|
|
495
|
-
isValidCommand = true;
|
|
496
|
-
yargs
|
|
497
|
-
.usage(USAGE_PREFIX + " register")
|
|
498
|
-
.demand(/*count*/ 0, /*max*/ 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
|
|
499
|
-
.example("register", "Registers a new CodePush account")
|
|
500
|
-
.check((argv, aliases) => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
501
|
-
addCommonConfiguration(yargs);
|
|
502
395
|
})
|
|
503
396
|
.command("release", "Release an update to an app deployment", (yargs) => {
|
|
504
397
|
yargs
|
|
@@ -729,18 +622,6 @@ yargs
|
|
|
729
622
|
type: "string",
|
|
730
623
|
});
|
|
731
624
|
addCommonConfiguration(yargs);
|
|
732
|
-
})
|
|
733
|
-
.command("session", "View and manage the current login sessions associated with your account", (yargs) => {
|
|
734
|
-
isValidCommandCategory = true;
|
|
735
|
-
yargs
|
|
736
|
-
.usage(USAGE_PREFIX + " session <command>")
|
|
737
|
-
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments.
|
|
738
|
-
.command("remove", "Remove an existing login session", (yargs) => sessionRemove("remove", yargs))
|
|
739
|
-
.command("rm", "Remove an existing login session", (yargs) => sessionRemove("rm", yargs))
|
|
740
|
-
.command("list", "List the current login sessions associated with your account", (yargs) => sessionList("list", yargs))
|
|
741
|
-
.command("ls", "List the current login sessions associated with your account", (yargs) => sessionList("ls", yargs))
|
|
742
|
-
.check((argv, aliases) => isValidCommand); // Report unrecognized, non-hyphenated command category.
|
|
743
|
-
addCommonConfiguration(yargs);
|
|
744
625
|
})
|
|
745
626
|
.alias("v", "version")
|
|
746
627
|
.version(packageJson.version)
|
|
@@ -757,48 +638,6 @@ function createCommand() {
|
|
|
757
638
|
const arg3 = argv._[3];
|
|
758
639
|
const arg4 = argv._[4];
|
|
759
640
|
switch (arg0) {
|
|
760
|
-
case "access-key":
|
|
761
|
-
switch (arg1) {
|
|
762
|
-
case "add":
|
|
763
|
-
if (arg2) {
|
|
764
|
-
cmd = { type: cli.CommandType.accessKeyAdd };
|
|
765
|
-
const accessKeyAddCmd = cmd;
|
|
766
|
-
accessKeyAddCmd.name = arg2;
|
|
767
|
-
const ttlOption = argv["ttl"];
|
|
768
|
-
if (isDefined(ttlOption)) {
|
|
769
|
-
accessKeyAddCmd.ttl = parseDurationMilliseconds(ttlOption);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
break;
|
|
773
|
-
case "patch":
|
|
774
|
-
if (arg2) {
|
|
775
|
-
cmd = { type: cli.CommandType.accessKeyPatch };
|
|
776
|
-
const accessKeyPatchCmd = cmd;
|
|
777
|
-
accessKeyPatchCmd.oldName = arg2;
|
|
778
|
-
const newNameOption = argv["name"];
|
|
779
|
-
const ttlOption = argv["ttl"];
|
|
780
|
-
if (isDefined(newNameOption)) {
|
|
781
|
-
accessKeyPatchCmd.newName = newNameOption;
|
|
782
|
-
}
|
|
783
|
-
if (isDefined(ttlOption)) {
|
|
784
|
-
accessKeyPatchCmd.ttl = parseDurationMilliseconds(ttlOption);
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
break;
|
|
788
|
-
case "list":
|
|
789
|
-
case "ls":
|
|
790
|
-
cmd = { type: cli.CommandType.accessKeyList };
|
|
791
|
-
cmd.format = argv["format"];
|
|
792
|
-
break;
|
|
793
|
-
case "remove":
|
|
794
|
-
case "rm":
|
|
795
|
-
if (arg2) {
|
|
796
|
-
cmd = { type: cli.CommandType.accessKeyRemove };
|
|
797
|
-
cmd.accessKey = arg2;
|
|
798
|
-
}
|
|
799
|
-
break;
|
|
800
|
-
}
|
|
801
|
-
break;
|
|
802
641
|
case "app":
|
|
803
642
|
switch (arg1) {
|
|
804
643
|
case "add":
|
|
@@ -812,6 +651,10 @@ function createCommand() {
|
|
|
812
651
|
cmd = { type: cli.CommandType.appList };
|
|
813
652
|
cmd.format = argv["format"];
|
|
814
653
|
break;
|
|
654
|
+
case "deployment-keys":
|
|
655
|
+
cmd = { type: cli.CommandType.appDeploymentKeyList };
|
|
656
|
+
cmd.appName = arg2;
|
|
657
|
+
break;
|
|
815
658
|
case "remove":
|
|
816
659
|
case "rm":
|
|
817
660
|
if (arg2) {
|
|
@@ -897,12 +740,6 @@ function createCommand() {
|
|
|
897
740
|
break;
|
|
898
741
|
}
|
|
899
742
|
break;
|
|
900
|
-
case "link":
|
|
901
|
-
cmd = {
|
|
902
|
-
type: cli.CommandType.link,
|
|
903
|
-
serverUrl: getServerUrl(arg1),
|
|
904
|
-
};
|
|
905
|
-
break;
|
|
906
743
|
case "login":
|
|
907
744
|
cmd = { type: cli.CommandType.login };
|
|
908
745
|
const loginCommand = cmd;
|
|
@@ -944,11 +781,6 @@ function createCommand() {
|
|
|
944
781
|
deploymentPromoteCommand.appStoreVersion = argv["targetBinaryVersion"];
|
|
945
782
|
}
|
|
946
783
|
break;
|
|
947
|
-
case "register":
|
|
948
|
-
cmd = { type: cli.CommandType.register };
|
|
949
|
-
const registerCommand = cmd;
|
|
950
|
-
registerCommand.serverUrl = getServerUrl(arg1);
|
|
951
|
-
break;
|
|
952
784
|
case "release":
|
|
953
785
|
if (arg1 && arg2 && arg3) {
|
|
954
786
|
cmd = { type: cli.CommandType.release };
|
|
@@ -1003,22 +835,6 @@ function createCommand() {
|
|
|
1003
835
|
rollbackCommand.targetRelease = argv["targetRelease"];
|
|
1004
836
|
}
|
|
1005
837
|
break;
|
|
1006
|
-
case "session":
|
|
1007
|
-
switch (arg1) {
|
|
1008
|
-
case "list":
|
|
1009
|
-
case "ls":
|
|
1010
|
-
cmd = { type: cli.CommandType.sessionList };
|
|
1011
|
-
cmd.format = argv["format"];
|
|
1012
|
-
break;
|
|
1013
|
-
case "remove":
|
|
1014
|
-
case "rm":
|
|
1015
|
-
if (arg2) {
|
|
1016
|
-
cmd = { type: cli.CommandType.sessionRemove };
|
|
1017
|
-
cmd.machineName = arg2;
|
|
1018
|
-
}
|
|
1019
|
-
break;
|
|
1020
|
-
}
|
|
1021
|
-
break;
|
|
1022
838
|
}
|
|
1023
839
|
return cmd;
|
|
1024
840
|
}
|
|
@@ -190,6 +190,9 @@ class AccountManager {
|
|
|
190
190
|
getApp(appName) {
|
|
191
191
|
return this.get(urlEncode([`/apps/${appName}`])).then((res) => res.body.app);
|
|
192
192
|
}
|
|
193
|
+
getDeploymentKeys(appName) {
|
|
194
|
+
return this.get(urlEncode([`/apps/${appName}/deployment-keys`])).then((res) => res.body);
|
|
195
|
+
}
|
|
193
196
|
addApp(appName) {
|
|
194
197
|
const app = { name: appName };
|
|
195
198
|
return this.post(urlEncode(["/apps"]), JSON.stringify(app), /*expectResponseBody=*/ false).then(() => app);
|
package/bin/script/types/cli.js
CHANGED
|
@@ -5,31 +5,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.CommandType = void 0;
|
|
6
6
|
var CommandType;
|
|
7
7
|
(function (CommandType) {
|
|
8
|
-
CommandType[CommandType["
|
|
9
|
-
CommandType[CommandType["
|
|
10
|
-
CommandType[CommandType["
|
|
11
|
-
CommandType[CommandType["
|
|
12
|
-
CommandType[CommandType["
|
|
13
|
-
CommandType[CommandType["
|
|
14
|
-
CommandType[CommandType["
|
|
15
|
-
CommandType[CommandType["
|
|
16
|
-
CommandType[CommandType["
|
|
17
|
-
CommandType[CommandType["
|
|
18
|
-
CommandType[CommandType["
|
|
19
|
-
CommandType[CommandType["
|
|
20
|
-
CommandType[CommandType["
|
|
21
|
-
CommandType[CommandType["
|
|
22
|
-
CommandType[CommandType["
|
|
23
|
-
CommandType[CommandType["
|
|
24
|
-
CommandType[CommandType["
|
|
25
|
-
CommandType[CommandType["
|
|
26
|
-
CommandType[CommandType["
|
|
27
|
-
CommandType[CommandType["
|
|
28
|
-
CommandType[CommandType["promote"] = 20] = "promote";
|
|
29
|
-
CommandType[CommandType["register"] = 21] = "register";
|
|
30
|
-
CommandType[CommandType["release"] = 22] = "release";
|
|
31
|
-
CommandType[CommandType["releaseReact"] = 23] = "releaseReact";
|
|
32
|
-
CommandType[CommandType["rollback"] = 24] = "rollback";
|
|
33
|
-
CommandType[CommandType["sessionList"] = 25] = "sessionList";
|
|
34
|
-
CommandType[CommandType["sessionRemove"] = 26] = "sessionRemove";
|
|
8
|
+
CommandType[CommandType["appAdd"] = 0] = "appAdd";
|
|
9
|
+
CommandType[CommandType["appList"] = 1] = "appList";
|
|
10
|
+
CommandType[CommandType["appDeploymentKeyList"] = 2] = "appDeploymentKeyList";
|
|
11
|
+
CommandType[CommandType["appRemove"] = 3] = "appRemove";
|
|
12
|
+
CommandType[CommandType["appRename"] = 4] = "appRename";
|
|
13
|
+
CommandType[CommandType["debug"] = 5] = "debug";
|
|
14
|
+
CommandType[CommandType["deploymentAdd"] = 6] = "deploymentAdd";
|
|
15
|
+
CommandType[CommandType["deploymentHistory"] = 7] = "deploymentHistory";
|
|
16
|
+
CommandType[CommandType["deploymentHistoryClear"] = 8] = "deploymentHistoryClear";
|
|
17
|
+
CommandType[CommandType["deploymentList"] = 9] = "deploymentList";
|
|
18
|
+
CommandType[CommandType["deploymentMetrics"] = 10] = "deploymentMetrics";
|
|
19
|
+
CommandType[CommandType["deploymentRemove"] = 11] = "deploymentRemove";
|
|
20
|
+
CommandType[CommandType["deploymentRename"] = 12] = "deploymentRename";
|
|
21
|
+
CommandType[CommandType["login"] = 13] = "login";
|
|
22
|
+
CommandType[CommandType["logout"] = 14] = "logout";
|
|
23
|
+
CommandType[CommandType["patch"] = 15] = "patch";
|
|
24
|
+
CommandType[CommandType["promote"] = 16] = "promote";
|
|
25
|
+
CommandType[CommandType["release"] = 17] = "release";
|
|
26
|
+
CommandType[CommandType["releaseReact"] = 18] = "releaseReact";
|
|
27
|
+
CommandType[CommandType["rollback"] = 19] = "rollback";
|
|
35
28
|
})(CommandType || (exports.CommandType = CommandType = {}));
|