@forge/cli 0.0.0-experimental-e8bfa83 → 0.0.0-experimental-c3effe3
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/CHANGELOG.md +3781 -7
- package/README.md +18 -19
- package/npm-shrinkwrap.json +2709 -3555
- package/out/analytics-client/analytics-client.d.ts +3 -1
- package/out/analytics-client/analytics-client.d.ts.map +1 -1
- package/out/analytics-client/analytics-client.js +5 -1
- package/out/autocomplete/autocomplete-config.json +24 -20
- package/out/autocomplete/isSupportedShell.d.ts +2 -0
- package/out/autocomplete/isSupportedShell.d.ts.map +1 -0
- package/out/autocomplete/isSupportedShell.js +11 -0
- package/out/bin/cli.js +0 -2
- package/out/bin/postinstall.js +9 -2
- package/out/command-line/anon-user-id.js +6 -10
- package/out/command-line/command.d.ts +27 -8
- package/out/command-line/command.d.ts.map +1 -1
- package/out/command-line/command.js +188 -50
- package/out/command-line/controller/autocomplete-controller.d.ts +1 -0
- package/out/command-line/controller/autocomplete-controller.d.ts.map +1 -1
- package/out/command-line/controller/autocomplete-controller.js +11 -1
- package/out/command-line/controller/deploy-controller.d.ts +13 -2
- package/out/command-line/controller/deploy-controller.d.ts.map +1 -1
- package/out/command-line/controller/deploy-controller.js +79 -5
- package/out/command-line/controller/getNodeVersion.d.ts +2 -0
- package/out/command-line/controller/getNodeVersion.d.ts.map +1 -0
- package/out/command-line/controller/getNodeVersion.js +7 -0
- package/out/command-line/controller/install-controller.d.ts +5 -4
- package/out/command-line/controller/install-controller.d.ts.map +1 -1
- package/out/command-line/controller/install-controller.js +31 -56
- package/out/command-line/controller/lint-controller.js +1 -1
- package/out/command-line/controller/pre-command-controller.d.ts +8 -1
- package/out/command-line/controller/pre-command-controller.d.ts.map +1 -1
- package/out/command-line/controller/pre-command-controller.js +22 -2
- package/out/command-line/controller/prerequisites-controller.d.ts +11 -0
- package/out/command-line/controller/prerequisites-controller.d.ts.map +1 -0
- package/out/command-line/controller/prerequisites-controller.js +34 -0
- package/out/command-line/controller/settings-controller.d.ts +19 -0
- package/out/command-line/controller/settings-controller.d.ts.map +1 -0
- package/out/command-line/controller/settings-controller.js +48 -0
- package/out/command-line/controller/stubController.d.ts +9 -0
- package/out/command-line/controller/stubController.d.ts.map +1 -0
- package/out/command-line/controller/stubController.js +15 -0
- package/out/command-line/dependency-injection.d.ts +13 -3
- package/out/command-line/dependency-injection.d.ts.map +1 -1
- package/out/command-line/dependency-injection.js +52 -22
- package/out/command-line/index.d.ts.map +1 -1
- package/out/command-line/index.js +10 -30
- package/out/command-line/register-app-commands.d.ts.map +1 -1
- package/out/command-line/register-app-commands.js +2 -12
- package/out/command-line/register-authentication-command.d.ts.map +1 -1
- package/out/command-line/register-authentication-command.js +1 -16
- package/out/command-line/register-deployment-commands.d.ts +8 -0
- package/out/command-line/register-deployment-commands.d.ts.map +1 -1
- package/out/command-line/register-deployment-commands.js +1 -0
- package/out/command-line/register-environment-variables-commands.d.ts +1 -1
- package/out/command-line/register-environment-variables-commands.d.ts.map +1 -1
- package/out/command-line/register-environment-variables-commands.js +22 -7
- package/out/command-line/register-installation-commands.d.ts +4 -1
- package/out/command-line/register-installation-commands.d.ts.map +1 -1
- package/out/command-line/register-installation-commands.js +39 -23
- package/out/command-line/register-providers-commands.d.ts +3 -0
- package/out/command-line/register-providers-commands.d.ts.map +1 -0
- package/out/command-line/register-providers-commands.js +43 -0
- package/out/command-line/register-settings-commands.d.ts +3 -0
- package/out/command-line/register-settings-commands.d.ts.map +1 -0
- package/out/command-line/register-settings-commands.js +37 -0
- package/out/command-line/register-webtrigger-commands.d.ts.map +1 -1
- package/out/command-line/register-webtrigger-commands.js +9 -11
- package/out/command-line/unique-machine-id.d.ts +1 -0
- package/out/command-line/unique-machine-id.d.ts.map +1 -1
- package/out/command-line/unique-machine-id.js +3 -12
- package/out/command-line/version-info.d.ts +1 -0
- package/out/command-line/version-info.d.ts.map +1 -1
- package/out/command-line/version-info.js +3 -2
- package/out/command-line/view/analytics-settings-view.d.ts +7 -0
- package/out/command-line/view/analytics-settings-view.d.ts.map +1 -0
- package/out/command-line/view/analytics-settings-view.js +18 -0
- package/out/command-line/view/deploy-view.d.ts +7 -1
- package/out/command-line/view/deploy-view.d.ts.map +1 -1
- package/out/command-line/view/deploy-view.js +25 -3
- package/out/command-line/view/install-view.d.ts +5 -3
- package/out/command-line/view/install-view.d.ts.map +1 -1
- package/out/command-line/view/install-view.js +19 -10
- package/out/command-line/view/lint-view.d.ts +3 -2
- package/out/command-line/view/lint-view.d.ts.map +1 -1
- package/out/command-line/view/lint-view.js +3 -0
- package/out/command-line/view/lite-lint-view.d.ts +3 -2
- package/out/command-line/view/lite-lint-view.d.ts.map +1 -1
- package/out/command-line/view/lite-lint-view.js +3 -0
- package/out/command-line/view/settings-view.d.ts +8 -0
- package/out/command-line/view/settings-view.d.ts.map +1 -0
- package/out/command-line/view/settings-view.js +21 -0
- package/out/deploy/deployer/deploy-monitor-graphql-client.js +1 -1
- package/out/deploy/deployer/deployer.d.ts.map +1 -1
- package/out/deploy/deployer/deployer.js +17 -1
- package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts.map +1 -1
- package/out/deploy/deployer/trigger-deploy-graphql-client.js +9 -6
- package/out/deploy/packager/archiver.d.ts +3 -2
- package/out/deploy/packager/archiver.d.ts.map +1 -1
- package/out/deploy/packager/archiver.js +10 -2
- package/out/deploy/packager/packager.d.ts.map +1 -1
- package/out/deploy/packager/packager.js +20 -20
- package/out/deploy/uploader/artifact-graphql-client.d.ts.map +1 -1
- package/out/deploy/uploader/artifact-graphql-client.js +12 -9
- package/out/environment-variables/graphql-client.d.ts +1 -1
- package/out/environment-variables/graphql-client.d.ts.map +1 -1
- package/out/environment-variables/graphql-client.js +19 -13
- package/out/installations/graphql-client.d.ts +19 -13
- package/out/installations/graphql-client.d.ts.map +1 -1
- package/out/installations/graphql-client.js +161 -56
- package/out/installations/install-app-site.d.ts +2 -12
- package/out/installations/install-app-site.d.ts.map +1 -1
- package/out/installations/install-app-site.js +3 -14
- package/out/installations/uninstall-app.d.ts +5 -3
- package/out/installations/uninstall-app.d.ts.map +1 -1
- package/out/installations/uninstall-app.js +7 -7
- package/out/migration-keys/graphql-client.d.ts +8 -0
- package/out/migration-keys/graphql-client.d.ts.map +1 -0
- package/out/migration-keys/graphql-client.js +55 -0
- package/out/providers/configure-provider.d.ts +19 -0
- package/out/providers/configure-provider.d.ts.map +1 -0
- package/out/providers/configure-provider.js +14 -0
- package/out/providers/graphql-client.d.ts +12 -0
- package/out/providers/graphql-client.d.ts.map +1 -0
- package/out/providers/graphql-client.js +47 -0
- package/out/service/cached-config-service.d.ts +8 -0
- package/out/service/cached-config-service.d.ts.map +1 -0
- package/out/service/cached-config-service.js +16 -0
- package/out/service/installation-service.d.ts +13 -13
- package/out/service/installation-service.d.ts.map +1 -1
- package/out/service/installation-service.js +38 -23
- package/out/service/lint-service.d.ts +2 -2
- package/out/service/lint-service.d.ts.map +1 -1
- package/out/service/lint-service.js +3 -3
- package/out/service/lite-lint-service.d.ts +3 -3
- package/out/service/lite-lint-service.d.ts.map +1 -1
- package/out/service/lite-lint-service.js +2 -2
- package/out/service/migration-keys-service.d.ts +19 -0
- package/out/service/migration-keys-service.d.ts.map +1 -0
- package/out/service/migration-keys-service.js +14 -0
- package/out/service/port-finding-service.d.ts +12 -0
- package/out/service/port-finding-service.d.ts.map +1 -0
- package/out/service/port-finding-service.js +34 -0
- package/out/service/resource-packaging-service.d.ts +3 -2
- package/out/service/resource-packaging-service.d.ts.map +1 -1
- package/out/service/resource-packaging-service.js +6 -2
- package/out/service/tunnel-service.d.ts +6 -2
- package/out/service/tunnel-service.d.ts.map +1 -1
- package/out/service/tunnel-service.js +53 -12
- package/out/webtrigger/get-webtrigger-url.d.ts +10 -4
- package/out/webtrigger/get-webtrigger-url.d.ts.map +1 -1
- package/out/webtrigger/get-webtrigger-url.js +11 -18
- package/out/webtrigger/graphql-client.d.ts +14 -0
- package/out/webtrigger/graphql-client.d.ts.map +1 -0
- package/out/webtrigger/graphql-client.js +52 -0
- package/out/workers/analytics-message-worker.d.ts +3 -1
- package/out/workers/analytics-message-worker.d.ts.map +1 -1
- package/out/workers/analytics-message-worker.js +9 -2
- package/out/workers/forge-cli-workers.js +6 -1
- package/package.json +17 -17
- package/out/bin/preinstall.d.ts +0 -3
- package/out/bin/preinstall.d.ts.map +0 -1
- package/out/bin/preinstall.js +0 -9
- package/out/command-line/cli-prerequisites.d.ts +0 -3
- package/out/command-line/cli-prerequisites.d.ts.map +0 -1
- package/out/command-line/cli-prerequisites.js +0 -37
|
@@ -12,6 +12,7 @@ const cli_shared_4 = require("@forge/cli-shared");
|
|
|
12
12
|
const version_info_1 = require("./version-info");
|
|
13
13
|
const anon_user_id_1 = require("./anon-user-id");
|
|
14
14
|
const errors_1 = require("./errors");
|
|
15
|
+
const command_suggestion_service_1 = tslib_1.__importDefault(require("../service/command-suggestion-service"));
|
|
15
16
|
class WrapperError extends commander_1.CommanderError {
|
|
16
17
|
constructor(error, commandName) {
|
|
17
18
|
super(error.exitCode, error.code, error.message);
|
|
@@ -24,19 +25,25 @@ const isErrorWithAnalytics = (e) => {
|
|
|
24
25
|
return e.getAttributes !== undefined;
|
|
25
26
|
};
|
|
26
27
|
class Command {
|
|
27
|
-
constructor(ui, analyticsClient, preCommandController, cliDetails, cmd, expectsArguments = false) {
|
|
28
|
+
constructor(ui, analyticsClient, preCommandController, cliDetails, cmd, expectsArguments = false, analyticsName) {
|
|
28
29
|
this.ui = ui;
|
|
29
30
|
this.analyticsClient = analyticsClient;
|
|
30
31
|
this.preCommandController = preCommandController;
|
|
31
32
|
this.cliDetails = cliDetails;
|
|
32
33
|
this.expectsArguments = expectsArguments;
|
|
34
|
+
this.analyticsName = analyticsName;
|
|
33
35
|
this.requiresAuthentication = true;
|
|
36
|
+
this.requiresAnalyticsConsent = true;
|
|
37
|
+
this.requiredOptionFlags = [];
|
|
34
38
|
this.preconditionFn = [];
|
|
39
|
+
this.options = [];
|
|
40
|
+
this.commands = [];
|
|
35
41
|
this.exitOverride = (listener) => {
|
|
36
42
|
this.cmd.exitOverride((err) => listener(err));
|
|
37
43
|
return this;
|
|
38
44
|
};
|
|
39
45
|
this.actionProcessor = async (cb, ...args) => {
|
|
46
|
+
var _a, _b, _c;
|
|
40
47
|
if (this.newCommand) {
|
|
41
48
|
this.ui.error(new Error(cli_shared_3.Text.deprecate(this.newCommand)));
|
|
42
49
|
}
|
|
@@ -44,9 +51,18 @@ class Command {
|
|
|
44
51
|
let cred = anon_user_id_1.getAnonId(true);
|
|
45
52
|
let attributes = {};
|
|
46
53
|
try {
|
|
47
|
-
if (!this.expectsArguments && args.length >
|
|
54
|
+
if (!this.expectsArguments && args.length > 2) {
|
|
48
55
|
throw new cli_shared_3.ValidationError(cli_shared_3.Text.extraArguments(cmdName));
|
|
49
56
|
}
|
|
57
|
+
const [options] = args;
|
|
58
|
+
if (options === null || options === void 0 ? void 0 : options.nonInteractive) {
|
|
59
|
+
if (!this.satisfiesNonInteractiveOptions(options)) {
|
|
60
|
+
throw new cli_shared_3.ValidationError(cli_shared_3.Text.nonInteractive.error.missingRequiredOption(cmdName, this.requiredOptionFlags));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (this.requiresAnalyticsConsent) {
|
|
64
|
+
await this.preCommandController.verifyAnalyticsPreferences((_a = options === null || options === void 0 ? void 0 : options.nonInteractive) !== null && _a !== void 0 ? _a : false)();
|
|
65
|
+
}
|
|
50
66
|
this.checkVersion();
|
|
51
67
|
if (this.cliDetails) {
|
|
52
68
|
attributes = { version: this.cliDetails.version, latest: this.cliDetails.latest };
|
|
@@ -64,47 +80,61 @@ class Command {
|
|
|
64
80
|
cred = result.creds;
|
|
65
81
|
}
|
|
66
82
|
}
|
|
67
|
-
this.analyticsClient.reportSuccess(cmdName, cred, attributes);
|
|
83
|
+
this.analyticsClient.reportSuccess((_b = this.analyticsName) !== null && _b !== void 0 ? _b : cmdName, cred, attributes);
|
|
68
84
|
}
|
|
69
85
|
catch (e) {
|
|
70
86
|
if (isErrorWithAnalytics(e)) {
|
|
71
87
|
attributes = Object.assign(Object.assign({}, e.getAttributes()), attributes);
|
|
72
88
|
}
|
|
73
89
|
if (e instanceof errors_1.DeferredErrors) {
|
|
74
|
-
e.getErrors().forEach((error) => this.analyticsClient.reportFailure(cmdName, cred, attributes, error));
|
|
90
|
+
e.getErrors().forEach((error) => { var _a; return this.analyticsClient.reportFailure((_a = this.analyticsName) !== null && _a !== void 0 ? _a : cmdName, cred, attributes, error); });
|
|
75
91
|
process.exit(1);
|
|
76
92
|
}
|
|
77
93
|
else {
|
|
78
|
-
this.analyticsClient.reportFailure(cmdName, cred, attributes, e);
|
|
94
|
+
this.analyticsClient.reportFailure((_c = this.analyticsName) !== null && _c !== void 0 ? _c : cmdName, cred, attributes, e);
|
|
79
95
|
cli_shared_4.exitOnError(this.ui)(e);
|
|
80
96
|
}
|
|
81
97
|
}
|
|
82
98
|
};
|
|
83
|
-
this.
|
|
84
|
-
|
|
99
|
+
this.outputRelevantHelp = (argv) => {
|
|
100
|
+
this.findLastValidCommand(argv).command.outputHelp();
|
|
85
101
|
};
|
|
86
102
|
this.cmd = cmd || new commander_1.default.Command();
|
|
87
103
|
}
|
|
88
104
|
get verbose() {
|
|
89
|
-
return this.cmd.verbose;
|
|
105
|
+
return this.cmd.opts().verbose;
|
|
90
106
|
}
|
|
91
107
|
version(str, flags) {
|
|
92
108
|
this.cmd.version(str, flags);
|
|
109
|
+
flags = flags || '-V, --version';
|
|
110
|
+
const versionOption = new commander_1.Option(flags, 'output the version number');
|
|
111
|
+
this.options.push(versionOption);
|
|
93
112
|
return this;
|
|
94
113
|
}
|
|
95
|
-
command(name) {
|
|
114
|
+
command(name, opts) {
|
|
96
115
|
const cmd = this.cmd
|
|
97
|
-
.command(name)
|
|
116
|
+
.command(name, opts)
|
|
98
117
|
.allowUnknownOption(false)
|
|
99
|
-
.
|
|
118
|
+
.allowExcessArguments(false);
|
|
100
119
|
const trimmedName = name.trim();
|
|
101
120
|
const expectsArguments = trimmedName.endsWith(']') || trimmedName.endsWith('>');
|
|
102
|
-
const subCommand = new Command(this.ui, this.analyticsClient, this.preCommandController, this.cliDetails, cmd, expectsArguments);
|
|
121
|
+
const subCommand = new Command(this.ui, this.analyticsClient, this.preCommandController, this.cliDetails, cmd, expectsArguments, Command.concatenateNames(this.analyticsName, cmd.name()));
|
|
122
|
+
subCommand.option('--verbose', cli_shared_3.Text.optionVerbose);
|
|
103
123
|
subCommand.exitOverride((err) => {
|
|
104
124
|
throw new WrapperError(err, subCommand.cmd.name());
|
|
105
125
|
});
|
|
126
|
+
this.commands.push(subCommand);
|
|
106
127
|
return subCommand;
|
|
107
128
|
}
|
|
129
|
+
deprecatedCommand(oldName, newName, stubController) {
|
|
130
|
+
this.command(oldName, { hidden: true })
|
|
131
|
+
.requireNoAuthentication()
|
|
132
|
+
.requireNoAnalyticsConsent()
|
|
133
|
+
.action(() => stubController.run({ oldName, newName }));
|
|
134
|
+
}
|
|
135
|
+
getAnalyticsName() {
|
|
136
|
+
return this.analyticsName;
|
|
137
|
+
}
|
|
108
138
|
deprecate(newCommand) {
|
|
109
139
|
this.newCommand = newCommand;
|
|
110
140
|
return this;
|
|
@@ -115,6 +145,14 @@ class Command {
|
|
|
115
145
|
}
|
|
116
146
|
option(flags, description, fn, defaultValue) {
|
|
117
147
|
this.cmd.option(flags, description, fn, defaultValue);
|
|
148
|
+
const option = new commander_1.Option(flags, description);
|
|
149
|
+
if (typeof fn === 'function') {
|
|
150
|
+
option.default(defaultValue).argParser(fn);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
option.default(fn);
|
|
154
|
+
}
|
|
155
|
+
this.options.push(option);
|
|
118
156
|
return this;
|
|
119
157
|
}
|
|
120
158
|
precondition(fn) {
|
|
@@ -129,38 +167,60 @@ class Command {
|
|
|
129
167
|
this.precondition(this.preCommandController.verifyManifestExistsWithAppConfig());
|
|
130
168
|
return this;
|
|
131
169
|
}
|
|
132
|
-
|
|
133
|
-
this.
|
|
170
|
+
nonInteractiveOption(...args) {
|
|
171
|
+
this.requiredOptionFlags = args;
|
|
172
|
+
this.cmd.option('--non-interactive', cli_shared_3.Text.nonInteractive.description);
|
|
134
173
|
return this;
|
|
135
174
|
}
|
|
136
|
-
|
|
137
|
-
this.cmd.
|
|
138
|
-
return this.hasArguments();
|
|
139
|
-
}
|
|
140
|
-
onUnknownCommand(listener) {
|
|
141
|
-
this.cmd.on('command:*', listener);
|
|
175
|
+
action(fn) {
|
|
176
|
+
this.cmd.action((...args) => this.actionProcessor(fn, ...args));
|
|
142
177
|
return this;
|
|
143
178
|
}
|
|
144
|
-
|
|
145
|
-
|
|
179
|
+
async parse(argv) {
|
|
180
|
+
try {
|
|
181
|
+
this.assertValidArgs(argv);
|
|
182
|
+
this.cmd.parse(argv);
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
if (Command.isHelpTriggered(err)) {
|
|
186
|
+
if (Command.isError(err)) {
|
|
187
|
+
this.outputRelevantHelp(argv);
|
|
188
|
+
}
|
|
189
|
+
return Command.reportHelp(this, err);
|
|
190
|
+
}
|
|
191
|
+
if (Command.isVersionTriggered(err)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (Command.isUnknownCommand(err) || Command.isExcessCommands(err)) {
|
|
195
|
+
this.unknownCommand(argv);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
return cli_shared_4.exitOnError(this.ui)(err);
|
|
199
|
+
}
|
|
146
200
|
}
|
|
147
201
|
getDefinedCommands() {
|
|
148
202
|
return this.cmd.commands;
|
|
149
203
|
}
|
|
150
204
|
getDefinedOptions() {
|
|
151
|
-
return this.
|
|
205
|
+
return this.options;
|
|
206
|
+
}
|
|
207
|
+
getCmdName() {
|
|
208
|
+
return this.cmd.name();
|
|
209
|
+
}
|
|
210
|
+
getCommands() {
|
|
211
|
+
return this.commands;
|
|
152
212
|
}
|
|
153
213
|
environmentOption() {
|
|
154
|
-
this.
|
|
214
|
+
this.option('-e, --environment [environment]', cli_shared_3.Text.env.option(cli_shared_2.DEFAULT_ENVIRONMENT_OPTION, cli_shared_2.VALID_ENVIRONMENT_OPTIONS));
|
|
155
215
|
this.precondition(() => {
|
|
156
|
-
this.cmd.environment = environment_1.checkEnvironmentOption(this.cmd.environment || cli_shared_2.DEFAULT_ENVIRONMENT_OPTION);
|
|
157
|
-
return { appEnv: this.cmd.environment };
|
|
216
|
+
this.cmd.opts().environment = environment_1.checkEnvironmentOption(this.cmd.opts().environment || cli_shared_2.DEFAULT_ENVIRONMENT_OPTION);
|
|
217
|
+
return { appEnv: this.cmd.opts().environment };
|
|
158
218
|
});
|
|
159
219
|
return this;
|
|
160
220
|
}
|
|
161
221
|
siteAndProductOption() {
|
|
162
|
-
this.
|
|
163
|
-
this.
|
|
222
|
+
this.option('-s, --site [site]', cli_shared_3.Text.optionSite);
|
|
223
|
+
this.option('-p, --product [product]', cli_shared_3.Text.optionProduct(cli_shared_2.SUPPORTED_PRODUCTS));
|
|
164
224
|
this.precondition(() => {
|
|
165
225
|
return this.validateContext();
|
|
166
226
|
});
|
|
@@ -170,6 +230,19 @@ class Command {
|
|
|
170
230
|
this.requiresAuthentication = false;
|
|
171
231
|
return this;
|
|
172
232
|
}
|
|
233
|
+
requireNoAnalyticsConsent() {
|
|
234
|
+
this.requiresAnalyticsConsent = false;
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
satisfiesNonInteractiveOptions(options) {
|
|
238
|
+
const optionKeys = Object.keys(options);
|
|
239
|
+
const requiredOptionKeys = [...this.requiredOptionFlags.map((arg) => new commander_1.Option(arg).attributeName())];
|
|
240
|
+
return requiredOptionKeys.every((requiredOption) => optionKeys.includes(requiredOption));
|
|
241
|
+
}
|
|
242
|
+
configureOutput(obj) {
|
|
243
|
+
this.cmd.configureOutput(obj);
|
|
244
|
+
return this;
|
|
245
|
+
}
|
|
173
246
|
async checkPreconditions(...args) {
|
|
174
247
|
let attributes = {};
|
|
175
248
|
for (const precondition of this.preconditionFn) {
|
|
@@ -200,41 +273,94 @@ class Command {
|
|
|
200
273
|
}
|
|
201
274
|
}
|
|
202
275
|
async validateContext() {
|
|
203
|
-
if (this.cmd.product) {
|
|
204
|
-
const capitalizedProduct = cli_shared_2.capitalizeProduct(this.cmd.product);
|
|
276
|
+
if (this.cmd.opts().product) {
|
|
277
|
+
const capitalizedProduct = cli_shared_2.capitalizeProduct(this.cmd.opts().product);
|
|
205
278
|
if (!cli_shared_2.isSuppportedProduct(capitalizedProduct)) {
|
|
206
279
|
throw new cli_shared_3.ValidationError(cli_shared_3.Text.error.invalidProduct);
|
|
207
280
|
}
|
|
208
|
-
this.cmd.product = capitalizedProduct;
|
|
281
|
+
this.cmd.opts().product = capitalizedProduct;
|
|
209
282
|
}
|
|
210
283
|
let trySite;
|
|
211
|
-
if (this.cmd.site) {
|
|
212
|
-
trySite = this.cmd.site;
|
|
284
|
+
if (this.cmd.opts().site) {
|
|
285
|
+
trySite = this.cmd.opts().site;
|
|
213
286
|
}
|
|
214
|
-
this.cmd.site = trySite ? cli_shared_2.validateSite(trySite) : undefined;
|
|
215
|
-
return { product: this.cmd.product };
|
|
287
|
+
this.cmd.opts().site = trySite ? cli_shared_2.validateSite(trySite) : undefined;
|
|
288
|
+
return { product: this.cmd.opts().product };
|
|
216
289
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
290
|
+
findLastValidCommand(argv) {
|
|
291
|
+
let command = this.cmd;
|
|
292
|
+
for (const [index, arg] of argv.slice(2).entries()) {
|
|
293
|
+
const commandMatch = command.commands.find((cmd) => cmd.name() === arg);
|
|
294
|
+
if (!commandMatch) {
|
|
295
|
+
return {
|
|
296
|
+
command,
|
|
297
|
+
index: index + 1
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
command = commandMatch;
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
command,
|
|
304
|
+
index: 1
|
|
305
|
+
};
|
|
222
306
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
307
|
+
unknownCommand(argv) {
|
|
308
|
+
const errorMessage = [];
|
|
309
|
+
const { command: lastCommand, index: lastCommandIndex } = this.findLastValidCommand(argv);
|
|
310
|
+
const badLastArg = argv[lastCommandIndex + 1];
|
|
311
|
+
const suggestionService = new command_suggestion_service_1.default();
|
|
312
|
+
const suggestions = suggestionService.getSuggestions(badLastArg, lastCommand.commands
|
|
313
|
+
.filter((cmd) => {
|
|
314
|
+
return cmd._hidden !== true;
|
|
315
|
+
})
|
|
316
|
+
.map((cmd) => cmd.name()));
|
|
317
|
+
errorMessage.push(cli_shared_3.Text.invalidCmd(argv.slice(2, lastCommandIndex + 2).join(' ')));
|
|
318
|
+
if (suggestions.length) {
|
|
319
|
+
errorMessage.push(`Did you mean:`);
|
|
320
|
+
const suggestionsPrefixed = suggestions.map((suggestion) => [...argv.slice(2, lastCommandIndex + 1), suggestion].join(' '));
|
|
321
|
+
errorMessage.push(suggestionsPrefixed.join('\n'));
|
|
322
|
+
errorMessage.push(cli_shared_3.Text.invalidCmdHelp);
|
|
323
|
+
this.ui.info(errorMessage.join('\n\n'));
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
errorMessage.push(cli_shared_3.Text.invalidCmdHelp);
|
|
327
|
+
this.ui.error(new Error(errorMessage.join(' ')));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
assertValidArgs(argv) {
|
|
331
|
+
const args = argv.slice(2);
|
|
332
|
+
let commands = this.cmd.commands;
|
|
333
|
+
while (args[0] && !args[0].startsWith('-')) {
|
|
334
|
+
if (args[0] === 'help') {
|
|
335
|
+
return;
|
|
229
336
|
}
|
|
230
|
-
|
|
337
|
+
const commandMatch = commands.find((cmd) => cmd.name() === args[0]);
|
|
338
|
+
if (!commandMatch) {
|
|
339
|
+
throw new commander_1.default.CommanderError(1, 'commander.unknownCommand', `error: unknown command '${args[0]}'.`);
|
|
340
|
+
}
|
|
341
|
+
commands = commandMatch.commands;
|
|
342
|
+
args.shift();
|
|
343
|
+
if (commands.length === 0) {
|
|
344
|
+
break;
|
|
231
345
|
}
|
|
232
|
-
program.analyticsClient.reportSuccess('help', cred, { command: cmdError.getCommandName() });
|
|
233
346
|
}
|
|
234
|
-
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
exports.Command = Command;
|
|
350
|
+
Command.reportHelp = async (cmd, cmdError) => {
|
|
351
|
+
try {
|
|
352
|
+
let cred = anon_user_id_1.getAnonId(true);
|
|
353
|
+
try {
|
|
354
|
+
const credentialsGetter = cli_shared_1.getCredentialsStoreProvider(cmd.ui);
|
|
355
|
+
cred = await credentialsGetter.getCredentials();
|
|
235
356
|
}
|
|
357
|
+
catch (noTokenError) {
|
|
358
|
+
}
|
|
359
|
+
cmd.analyticsClient.reportSuccess('help', cred, { command: cmdError.getCommandName() });
|
|
360
|
+
}
|
|
361
|
+
catch (err) {
|
|
236
362
|
}
|
|
237
|
-
return
|
|
363
|
+
return;
|
|
238
364
|
};
|
|
239
365
|
Command.isError = (cmdError) => {
|
|
240
366
|
return cmdError.exitCode === 1;
|
|
@@ -242,3 +368,15 @@ Command.isError = (cmdError) => {
|
|
|
242
368
|
Command.isHelpTriggered = (cmdError) => {
|
|
243
369
|
return ['commander.helpDisplayed', 'commander.help'].includes(cmdError.code);
|
|
244
370
|
};
|
|
371
|
+
Command.isVersionTriggered = (cmdError) => {
|
|
372
|
+
return 'commander.version' === cmdError.code;
|
|
373
|
+
};
|
|
374
|
+
Command.isUnknownCommand = (cmdError) => {
|
|
375
|
+
return cmdError.code === 'commander.unknownCommand';
|
|
376
|
+
};
|
|
377
|
+
Command.isExcessCommands = (cmdError) => {
|
|
378
|
+
return cmdError.code === 'commander.excessArguments';
|
|
379
|
+
};
|
|
380
|
+
Command.concatenateNames = (parent, subcommand) => {
|
|
381
|
+
return parent ? `${parent}:${subcommand}` : subcommand;
|
|
382
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/autocomplete-controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"autocomplete-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/autocomplete-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,EAAE,EAAmB,MAAM,mBAAmB,CAAC;AAK9D,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,SAAS,cAAc;CACxB;AAQD,wBAAgB,0BAA0B,CAAC,OAAO,GAAE,MAAyB,GAAG,IAAI,CAInF;AAED,qBAAa,sBAAsB;IACrB,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,EAAE;IAEtB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAwB7C"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AutocompleteController = exports.Argument = void 0;
|
|
3
|
+
exports.AutocompleteController = exports.assertNodeVersionSupported = exports.Argument = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
4
6
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
7
|
const autocomplete_1 = require("../../autocomplete");
|
|
6
8
|
const assertUnreachable_1 = require("./assertUnreachable");
|
|
9
|
+
const getNodeVersion_1 = require("./getNodeVersion");
|
|
7
10
|
var Argument;
|
|
8
11
|
(function (Argument) {
|
|
9
12
|
Argument["install"] = "install";
|
|
@@ -14,6 +17,12 @@ function assertIsValidArgument(arg) {
|
|
|
14
17
|
throw new cli_shared_1.ValidationError(cli_shared_1.Text.autocomplete.error.badArg(arg));
|
|
15
18
|
}
|
|
16
19
|
}
|
|
20
|
+
function assertNodeVersionSupported(version = getNodeVersion_1.getNodeVersion()) {
|
|
21
|
+
if (semver_1.default.eq(version, '12.5.0') || semver_1.default.eq(version, '12.6.0')) {
|
|
22
|
+
throw new Error(cli_shared_1.Text.autocomplete.error.unsupportedNodeVersion);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.assertNodeVersionSupported = assertNodeVersionSupported;
|
|
17
26
|
class AutocompleteController {
|
|
18
27
|
constructor(ui) {
|
|
19
28
|
this.ui = ui;
|
|
@@ -21,6 +30,7 @@ class AutocompleteController {
|
|
|
21
30
|
async run(arg) {
|
|
22
31
|
assertIsValidArgument(arg);
|
|
23
32
|
if (arg === Argument.install) {
|
|
33
|
+
assertNodeVersionSupported();
|
|
24
34
|
if (!(await this.ui.confirm(cli_shared_1.Text.autocomplete.confirmInstalling))) {
|
|
25
35
|
return;
|
|
26
36
|
}
|
|
@@ -2,6 +2,7 @@ import { AppConfigProvider, ConfigFile, HiddenError } from '@forge/cli-shared';
|
|
|
2
2
|
import { LintService } from '../../service/lint-service';
|
|
3
3
|
import { DeployView } from '../view/deploy-view';
|
|
4
4
|
import { InstallationService } from '../../service/installation-service';
|
|
5
|
+
import { MigrationKeysService } from '../../service/migration-keys-service';
|
|
5
6
|
import { ResourcePackagingService } from '../../service/resource-packaging-service';
|
|
6
7
|
import { ErrorWithAnalytics } from '../command';
|
|
7
8
|
import { PackageUploadDeployCommand } from '../../deploy';
|
|
@@ -15,18 +16,28 @@ export declare class DeployLintFailureError extends HiddenError implements Error
|
|
|
15
16
|
constructor(scopes: string[]);
|
|
16
17
|
getAttributes(): Record<string, string[]>;
|
|
17
18
|
}
|
|
19
|
+
export declare class InvalidConnectKeyError extends HiddenError implements ErrorWithAnalytics {
|
|
20
|
+
private readonly reason;
|
|
21
|
+
constructor(reason: string);
|
|
22
|
+
getAttributes(): Record<string, string>;
|
|
23
|
+
}
|
|
18
24
|
export declare class DeployController {
|
|
19
25
|
private readonly appConfigProvider;
|
|
20
26
|
private readonly configFile;
|
|
21
27
|
private readonly lintService;
|
|
22
28
|
private readonly installationsService;
|
|
29
|
+
private readonly migrationKeysService;
|
|
23
30
|
private readonly deployView;
|
|
24
31
|
private readonly packageUploadDeployCommand;
|
|
25
32
|
private readonly resourcePackagingService;
|
|
26
|
-
constructor(appConfigProvider: AppConfigProvider, configFile: ConfigFile, lintService: LintService, installationsService: InstallationService, deployView: DeployView, packageUploadDeployCommand: PackageUploadDeployCommand, resourcePackagingService: ResourcePackagingService);
|
|
33
|
+
constructor(appConfigProvider: AppConfigProvider, configFile: ConfigFile, lintService: LintService, installationsService: InstallationService, migrationKeysService: MigrationKeysService, deployView: DeployView, packageUploadDeployCommand: PackageUploadDeployCommand, resourcePackagingService: ResourcePackagingService);
|
|
34
|
+
private isMpacProductionApp;
|
|
35
|
+
private connectKeyDeleted;
|
|
36
|
+
private connectKeyChanged;
|
|
37
|
+
private validateConnectKeyChange;
|
|
27
38
|
private verifyPreDeployment;
|
|
28
39
|
private verifyPostDeployment;
|
|
29
|
-
run({ environment, verify }: DeployOptions): Promise<DeploymentResult>;
|
|
40
|
+
run({ environment, verify }: DeployOptions): Promise<DeploymentResult | void>;
|
|
30
41
|
}
|
|
31
42
|
export {};
|
|
32
43
|
//# sourceMappingURL=deploy-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/deploy-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"deploy-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/deploy-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAQ,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAA+B,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACzG,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,UAAU,aAAa;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,sBAAuB,SAAQ,WAAY,YAAW,kBAAkB;IACvE,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM,EAAE;IAItC,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;CAKjD;AAED,qBAAa,sBAAuB,SAAQ,WAAY,YAAW,kBAAkB;IACvE,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAGpC,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAK/C;AAED,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAC3C,OAAO,CAAC,QAAQ,CAAC,wBAAwB;gBAPxB,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,mBAAmB,EACzC,oBAAoB,EAAE,oBAAoB,EAC1C,UAAU,EAAE,UAAU,EACtB,0BAA0B,EAAE,0BAA0B,EACtD,wBAAwB,EAAE,wBAAwB;IAGrE,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,iBAAiB;YAGX,wBAAwB;YAwBxB,mBAAmB;YAiBnB,oBAAoB;IAOrB,GAAG,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;CAsD3F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeployController = exports.DeployLintFailureError = void 0;
|
|
3
|
+
exports.DeployController = exports.InvalidConnectKeyError = exports.DeployLintFailureError = void 0;
|
|
4
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
5
|
class DeployLintFailureError extends cli_shared_1.HiddenError {
|
|
6
6
|
constructor(scopes) {
|
|
@@ -14,19 +14,62 @@ class DeployLintFailureError extends cli_shared_1.HiddenError {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.DeployLintFailureError = DeployLintFailureError;
|
|
17
|
+
class InvalidConnectKeyError extends cli_shared_1.HiddenError {
|
|
18
|
+
constructor(reason) {
|
|
19
|
+
super();
|
|
20
|
+
this.reason = reason;
|
|
21
|
+
}
|
|
22
|
+
getAttributes() {
|
|
23
|
+
return {
|
|
24
|
+
reason: this.reason
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.InvalidConnectKeyError = InvalidConnectKeyError;
|
|
17
29
|
class DeployController {
|
|
18
|
-
constructor(appConfigProvider, configFile, lintService, installationsService, deployView, packageUploadDeployCommand, resourcePackagingService) {
|
|
30
|
+
constructor(appConfigProvider, configFile, lintService, installationsService, migrationKeysService, deployView, packageUploadDeployCommand, resourcePackagingService) {
|
|
19
31
|
this.appConfigProvider = appConfigProvider;
|
|
20
32
|
this.configFile = configFile;
|
|
21
33
|
this.lintService = lintService;
|
|
22
34
|
this.installationsService = installationsService;
|
|
35
|
+
this.migrationKeysService = migrationKeysService;
|
|
23
36
|
this.deployView = deployView;
|
|
24
37
|
this.packageUploadDeployCommand = packageUploadDeployCommand;
|
|
25
38
|
this.resourcePackagingService = resourcePackagingService;
|
|
26
39
|
}
|
|
40
|
+
isMpacProductionApp(mpacAppKey, environment) {
|
|
41
|
+
return !!(mpacAppKey && environment === 'production');
|
|
42
|
+
}
|
|
43
|
+
connectKeyDeleted(connectKey, comparisonKey) {
|
|
44
|
+
return !!(!connectKey && comparisonKey);
|
|
45
|
+
}
|
|
46
|
+
connectKeyChanged(connectKey, comparisonKey) {
|
|
47
|
+
return !!(comparisonKey && connectKey && connectKey !== comparisonKey);
|
|
48
|
+
}
|
|
49
|
+
async validateConnectKeyChange(environment, keys) {
|
|
50
|
+
const { migrationKeys, mpacAppKey } = keys;
|
|
51
|
+
const connectKey = await this.configFile.getConnectKey();
|
|
52
|
+
const migrationKey = (migrationKeys === null || migrationKeys === void 0 ? void 0 : migrationKeys.confluence) || (migrationKeys === null || migrationKeys === void 0 ? void 0 : migrationKeys.jira);
|
|
53
|
+
const isMpacApp = this.isMpacProductionApp(mpacAppKey, environment);
|
|
54
|
+
if (this.connectKeyDeleted(connectKey, migrationKey)) {
|
|
55
|
+
this.deployView.displayConnectKeyDeleteWarning(environment);
|
|
56
|
+
const proceed = await this.deployView.promptToContinueDeletingConnectKey();
|
|
57
|
+
return { proceed, connectKeyDeleted: proceed, connectKeyChanged: false };
|
|
58
|
+
}
|
|
59
|
+
else if (isMpacApp && this.connectKeyChanged(connectKey, mpacAppKey)) {
|
|
60
|
+
this.deployView.displayMPACAppConnectKeyChangeError(mpacAppKey, connectKey);
|
|
61
|
+
throw new InvalidConnectKeyError(cli_shared_1.Text.deploy.connectKeyChange.mpacAppConnectKeyChangeAnalyticsError);
|
|
62
|
+
}
|
|
63
|
+
else if (!isMpacApp && this.connectKeyChanged(connectKey, migrationKey)) {
|
|
64
|
+
this.deployView.displayConnectKeyChangeWarning(environment, migrationKey, connectKey);
|
|
65
|
+
const proceed = await this.deployView.promptToContinueChangingConnectKey();
|
|
66
|
+
return { proceed, connectKeyChanged: proceed, connectKeyDeleted: false };
|
|
67
|
+
}
|
|
68
|
+
return { proceed: true, connectKeyChanged: false, connectKeyDeleted: false };
|
|
69
|
+
}
|
|
27
70
|
async verifyPreDeployment(environment) {
|
|
28
71
|
this.deployView.displayLintRunning();
|
|
29
|
-
const { lintResults } = await this.lintService.run(environment, { fix: false });
|
|
72
|
+
const { lintResults } = await this.lintService.run(environment, { fix: false }, this.deployView.getLogger());
|
|
30
73
|
const problemCount = this.lintService.problemCount(lintResults);
|
|
31
74
|
if (problemCount.errors) {
|
|
32
75
|
this.deployView.displayLintErrors(lintResults);
|
|
@@ -48,17 +91,48 @@ class DeployController {
|
|
|
48
91
|
}
|
|
49
92
|
async run({ environment, verify }) {
|
|
50
93
|
this.deployView.displayStart(environment);
|
|
94
|
+
let hasConnectKeyChanged = false;
|
|
95
|
+
let hasConnectKeyDeleted = false;
|
|
51
96
|
if (verify) {
|
|
52
97
|
await this.verifyPreDeployment(environment);
|
|
98
|
+
const keys = await this.migrationKeysService.getMigrationKeysForAppEnvironment(environment);
|
|
99
|
+
const { proceed, connectKeyChanged, connectKeyDeleted } = await this.validateConnectKeyChange(environment, keys);
|
|
100
|
+
if (!proceed) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
hasConnectKeyChanged = connectKeyChanged;
|
|
104
|
+
hasConnectKeyDeleted = connectKeyDeleted;
|
|
53
105
|
}
|
|
54
|
-
const {
|
|
106
|
+
const { id } = await this.appConfigProvider();
|
|
55
107
|
const handlers = await this.configFile.getAppHandlers();
|
|
56
108
|
const resources = await this.configFile.getResources();
|
|
57
109
|
const archives = await this.resourcePackagingService.zipResources(resources);
|
|
58
|
-
|
|
110
|
+
let hasProdInstallations = false;
|
|
111
|
+
try {
|
|
112
|
+
const prodInstallations = await this.installationsService.listAppInstallations({
|
|
113
|
+
environment: 'production'
|
|
114
|
+
});
|
|
115
|
+
hasProdInstallations = !prodInstallations.installations.length;
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
if (verify) {
|
|
119
|
+
throw err;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const analytics = await this.deployView.reportDeploymentProgress(id, environment, hasProdInstallations, () => this.packageUploadDeployCommand.execute({ handlers, environmentKey: environment, archives }));
|
|
59
123
|
if (verify) {
|
|
60
124
|
await this.verifyPostDeployment(environment);
|
|
61
125
|
}
|
|
126
|
+
try {
|
|
127
|
+
analytics.analytics.egressPermissionList = await this.configFile.getEgressPermissions();
|
|
128
|
+
analytics.analytics.connectKey = hasConnectKeyChanged
|
|
129
|
+
? { action: 'changed', value: await this.configFile.getConnectKey() }
|
|
130
|
+
: hasConnectKeyDeleted
|
|
131
|
+
? { action: 'deleted' }
|
|
132
|
+
: {};
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
}
|
|
62
136
|
return analytics;
|
|
63
137
|
}
|
|
64
138
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNodeVersion.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/getNodeVersion.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { AppConfigProvider, UI } from '@forge/cli-shared';
|
|
2
|
+
import { AppConfigProvider, ConfigFile, UI } from '@forge/cli-shared';
|
|
3
3
|
import { URL } from 'url';
|
|
4
4
|
import { InstallAppSiteCommand } from '../../installations/install-app-site';
|
|
5
5
|
import { InstallationService } from '../../service/installation-service';
|
|
@@ -9,6 +9,7 @@ interface InstallViewProps {
|
|
|
9
9
|
site?: URL;
|
|
10
10
|
product?: string;
|
|
11
11
|
upgrade: boolean;
|
|
12
|
+
nonInteractive?: boolean;
|
|
12
13
|
confirmScopes: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare class NoDeploymentError extends Error {
|
|
@@ -16,19 +17,19 @@ export declare class NoDeploymentError extends Error {
|
|
|
16
17
|
}
|
|
17
18
|
export declare class InstallController {
|
|
18
19
|
private readonly appConfigProvider;
|
|
20
|
+
private readonly configFile;
|
|
19
21
|
private readonly ui;
|
|
20
22
|
private readonly installAppSiteCommand;
|
|
21
23
|
private readonly installationService;
|
|
22
24
|
private readonly installView;
|
|
23
|
-
constructor(appConfigProvider: AppConfigProvider, ui: UI, installAppSiteCommand: InstallAppSiteCommand, installationService: InstallationService, installView: InstallView);
|
|
25
|
+
constructor(appConfigProvider: AppConfigProvider, configFile: ConfigFile, ui: UI, installAppSiteCommand: InstallAppSiteCommand, installationService: InstallationService, installView: InstallView);
|
|
24
26
|
private securityPrompt;
|
|
25
27
|
private installOrUpgrade;
|
|
26
|
-
private authorizationPrompt;
|
|
27
28
|
private promptForProduct;
|
|
28
29
|
private promptForSite;
|
|
29
30
|
private promptForUpgrade;
|
|
30
31
|
private getUniqueInstallationProductsFromScopes;
|
|
31
|
-
run({ environment, site, product, upgrade, confirmScopes }: InstallViewProps): Promise<void>;
|
|
32
|
+
run({ environment, site, product, upgrade, confirmScopes, nonInteractive }: InstallViewProps): Promise<void>;
|
|
32
33
|
}
|
|
33
34
|
export {};
|
|
34
35
|
//# sourceMappingURL=install-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/install-controller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"install-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/install-controller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,UAAU,EAEV,EAAE,EASH,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB;AAiBD,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,WAAW,EAAE,MAAM;CAGhC;AAQD,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW;gBALX,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,EAAE,EACN,qBAAqB,EAAE,qBAAqB,EAC5C,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,WAAW;YAG7B,cAAc;YAmBd,gBAAgB;YAsChB,gBAAgB;YAKhB,aAAa;YAWb,gBAAgB;IAoB9B,OAAO,CAAC,uCAAuC;IAalC,GAAG,CAAC,EACf,WAAW,EACX,IAAI,EACJ,OAAO,EACP,OAAO,EACP,aAAa,EACb,cAAc,EACf,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAuFpC"}
|