@forge/cli 0.0.0-experimental-034f51a → 0.0.0-experimental-c8e9749
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 +1110 -2
- package/npm-shrinkwrap.json +13389 -0
- package/out/analytics-client/analytics-client.d.ts +36 -0
- package/out/analytics-client/analytics-client.d.ts.map +1 -0
- package/out/analytics-client/analytics-client.js +140 -0
- package/out/analytics-client/analytics-message-handler.d.ts +21 -0
- package/out/analytics-client/analytics-message-handler.d.ts.map +1 -0
- package/out/analytics-client/analytics-message-handler.js +43 -0
- package/out/autocomplete/autocomplete-config.json +243 -0
- package/out/autocomplete/index.d.ts +5 -0
- package/out/autocomplete/index.d.ts.map +1 -0
- package/out/autocomplete/index.js +41 -0
- 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/autocomplete/types.d.ts +14 -0
- package/out/autocomplete/types.d.ts.map +1 -0
- package/out/autocomplete/types.js +2 -0
- package/out/autocomplete/util.d.ts +6 -0
- package/out/autocomplete/util.d.ts.map +1 -0
- package/out/autocomplete/util.js +15 -0
- package/out/bin/cli.d.ts +1 -0
- package/out/bin/cli.d.ts.map +1 -1
- package/out/bin/cli.js +4 -1
- package/out/bin/postinstall.d.ts +2 -0
- package/out/bin/postinstall.d.ts.map +1 -0
- package/out/bin/postinstall.js +23 -0
- package/out/command-line/anon-user-id.d.ts +3 -0
- package/out/command-line/anon-user-id.d.ts.map +1 -0
- package/out/command-line/anon-user-id.js +17 -0
- package/out/command-line/command.d.ts +80 -0
- package/out/command-line/command.d.ts.map +1 -0
- package/out/command-line/command.js +408 -0
- package/out/command-line/controller/assertUnreachable.d.ts +2 -0
- package/out/command-line/controller/assertUnreachable.d.ts.map +1 -0
- package/out/command-line/controller/assertUnreachable.js +7 -0
- package/out/command-line/controller/autocomplete-controller.d.ts +12 -0
- package/out/command-line/controller/autocomplete-controller.d.ts.map +1 -0
- package/out/command-line/controller/autocomplete-controller.js +54 -0
- package/out/command-line/controller/deploy-controller.d.ts +42 -0
- package/out/command-line/controller/deploy-controller.d.ts.map +1 -0
- package/out/command-line/controller/deploy-controller.js +139 -0
- package/out/command-line/controller/feedback-controller.d.ts +9 -0
- package/out/command-line/controller/feedback-controller.d.ts.map +1 -0
- package/out/command-line/controller/feedback-controller.js +19 -0
- 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 +35 -0
- package/out/command-line/controller/install-controller.d.ts.map +1 -0
- package/out/command-line/controller/install-controller.js +157 -0
- package/out/command-line/controller/lint-controller.d.ts +9 -0
- package/out/command-line/controller/lint-controller.d.ts.map +1 -0
- package/out/command-line/controller/lint-controller.js +20 -0
- package/out/command-line/controller/pre-command-controller.d.ts +25 -0
- package/out/command-line/controller/pre-command-controller.d.ts.map +1 -0
- package/out/command-line/controller/pre-command-controller.js +57 -0
- package/out/command-line/controller/prerequisites-controller.d.ts +15 -0
- package/out/command-line/controller/prerequisites-controller.d.ts.map +1 -0
- package/out/command-line/controller/prerequisites-controller.js +41 -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/controller/tunnel-controller.d.ts +14 -0
- package/out/command-line/controller/tunnel-controller.d.ts.map +1 -0
- package/out/command-line/controller/tunnel-controller.js +43 -0
- package/out/command-line/dependency-injection.d.ts +76 -0
- package/out/command-line/dependency-injection.d.ts.map +1 -0
- package/out/command-line/dependency-injection.js +211 -0
- package/out/command-line/environment.d.ts +2 -0
- package/out/command-line/environment.d.ts.map +1 -0
- package/out/command-line/environment.js +16 -0
- package/out/command-line/errors.d.ts +6 -0
- package/out/command-line/errors.d.ts.map +1 -0
- package/out/command-line/errors.js +12 -0
- package/out/command-line/index.d.ts +5 -0
- package/out/command-line/index.d.ts.map +1 -0
- package/out/command-line/index.js +73 -0
- package/out/command-line/register-app-commands.d.ts +10 -0
- package/out/command-line/register-app-commands.d.ts.map +1 -0
- package/out/command-line/register-app-commands.js +128 -0
- package/out/command-line/register-authentication-command.d.ts +16 -0
- package/out/command-line/register-authentication-command.d.ts.map +1 -0
- package/out/command-line/register-authentication-command.js +94 -0
- package/out/command-line/register-autocomplete-commands.d.ts +3 -0
- package/out/command-line/register-autocomplete-commands.d.ts.map +1 -0
- package/out/command-line/register-autocomplete-commands.js +14 -0
- package/out/command-line/register-contributors-commands.d.ts +3 -0
- package/out/command-line/register-contributors-commands.d.ts.map +1 -0
- package/out/command-line/register-contributors-commands.js +134 -0
- package/out/command-line/register-deployment-commands.d.ts +22 -0
- package/out/command-line/register-deployment-commands.d.ts.map +1 -0
- package/out/command-line/register-deployment-commands.js +16 -0
- package/out/command-line/register-environment-variables-commands.d.ts +3 -0
- package/out/command-line/register-environment-variables-commands.d.ts.map +1 -0
- package/out/command-line/register-environment-variables-commands.js +103 -0
- package/out/command-line/register-feedback-commands.d.ts +3 -0
- package/out/command-line/register-feedback-commands.d.ts.map +1 -0
- package/out/command-line/register-feedback-commands.js +32 -0
- package/out/command-line/register-installation-commands.d.ts +6 -0
- package/out/command-line/register-installation-commands.d.ts.map +1 -0
- package/out/command-line/register-installation-commands.js +143 -0
- package/out/command-line/register-lint-command.d.ts +8 -0
- package/out/command-line/register-lint-command.d.ts.map +1 -0
- package/out/command-line/register-lint-command.js +16 -0
- package/out/command-line/register-log-commands.d.ts +4 -0
- package/out/command-line/register-log-commands.d.ts.map +1 -0
- package/out/command-line/register-log-commands.js +139 -0
- 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 +44 -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 +39 -0
- package/out/command-line/register-tunnel-commands.d.ts +3 -0
- package/out/command-line/register-tunnel-commands.d.ts.map +1 -0
- package/out/command-line/register-tunnel-commands.js +15 -0
- package/out/command-line/register-webtrigger-commands.d.ts +3 -0
- package/out/command-line/register-webtrigger-commands.d.ts.map +1 -0
- package/out/command-line/register-webtrigger-commands.js +56 -0
- package/out/command-line/sentry.d.ts +4 -0
- package/out/command-line/sentry.d.ts.map +1 -0
- package/out/command-line/sentry.js +16 -0
- package/out/command-line/unique-machine-id.d.ts +3 -0
- package/out/command-line/unique-machine-id.d.ts.map +1 -0
- package/out/command-line/unique-machine-id.js +19 -0
- package/out/command-line/version-info.d.ts +9 -0
- package/out/command-line/version-info.d.ts.map +1 -0
- package/out/command-line/version-info.js +42 -0
- 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 +21 -0
- package/out/command-line/view/deploy-view.d.ts.map +1 -0
- package/out/command-line/view/deploy-view.js +58 -0
- package/out/command-line/view/install-view.d.ts +18 -0
- package/out/command-line/view/install-view.d.ts.map +1 -0
- package/out/command-line/view/install-view.js +56 -0
- package/out/command-line/view/lint-view.d.ts +12 -0
- package/out/command-line/view/lint-view.d.ts.map +1 -0
- package/out/command-line/view/lint-view.js +31 -0
- package/out/command-line/view/lite-lint-view.d.ts +10 -0
- package/out/command-line/view/lite-lint-view.d.ts.map +1 -0
- package/out/command-line/view/lite-lint-view.js +18 -0
- package/out/command-line/view/settings-view.d.ts +10 -0
- package/out/command-line/view/settings-view.d.ts.map +1 -0
- package/out/command-line/view/settings-view.js +26 -0
- package/out/command-line/view/tunnel-view.d.ts +20 -0
- package/out/command-line/view/tunnel-view.d.ts.map +1 -0
- package/out/command-line/view/tunnel-view.js +92 -0
- package/out/contributors/add-contributor.d.ts +17 -0
- package/out/contributors/add-contributor.d.ts.map +1 -0
- package/out/contributors/add-contributor.js +14 -0
- package/out/contributors/graphql-client.d.ts +14 -0
- package/out/contributors/graphql-client.d.ts.map +1 -0
- package/out/contributors/graphql-client.js +113 -0
- package/out/contributors/list-contributors.d.ts +18 -0
- package/out/contributors/list-contributors.d.ts.map +1 -0
- package/out/contributors/list-contributors.js +14 -0
- package/out/contributors/remove-contributors.d.ts +18 -0
- package/out/contributors/remove-contributors.d.ts.map +1 -0
- package/out/contributors/remove-contributors.js +14 -0
- package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts +24 -0
- package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts.map +1 -0
- package/out/deploy/deployer/deploy-monitor-graphql-client.js +57 -0
- package/out/deploy/deployer/deployer.d.ts +40 -0
- package/out/deploy/deployer/deployer.d.ts.map +1 -0
- package/out/deploy/deployer/deployer.js +187 -0
- package/out/deploy/deployer/index.d.ts +4 -0
- package/out/deploy/deployer/index.d.ts.map +1 -0
- package/out/deploy/deployer/index.js +6 -0
- package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts +19 -0
- package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts.map +1 -0
- package/out/deploy/deployer/trigger-deploy-graphql-client.js +49 -0
- package/out/deploy/index.d.ts +5 -0
- package/out/deploy/index.d.ts.map +1 -0
- package/out/deploy/index.js +7 -0
- package/out/deploy/package-upload-deploy.d.ts +20 -0
- package/out/deploy/package-upload-deploy.d.ts.map +1 -0
- package/out/deploy/package-upload-deploy.js +37 -0
- package/out/deploy/packager/archiver.d.ts +27 -0
- package/out/deploy/packager/archiver.d.ts.map +1 -0
- package/out/deploy/packager/archiver.js +76 -0
- package/out/deploy/packager/index.d.ts +3 -0
- package/out/deploy/packager/index.d.ts.map +1 -0
- package/out/deploy/packager/index.js +5 -0
- package/out/deploy/packager/nativeui-bundler.d.ts +12 -0
- package/out/deploy/packager/nativeui-bundler.d.ts.map +1 -0
- package/out/deploy/packager/nativeui-bundler.js +34 -0
- package/out/deploy/packager/packager.d.ts +32 -0
- package/out/deploy/packager/packager.d.ts.map +1 -0
- package/out/deploy/packager/packager.js +21 -0
- package/out/deploy/packager/runtime-bundler.d.ts +15 -0
- package/out/deploy/packager/runtime-bundler.d.ts.map +1 -0
- package/out/deploy/packager/runtime-bundler.js +53 -0
- package/out/deploy/uploader/artifact-graphql-client.d.ts +26 -0
- package/out/deploy/uploader/artifact-graphql-client.d.ts.map +1 -0
- package/out/deploy/uploader/artifact-graphql-client.js +100 -0
- package/out/deploy/uploader/index.d.ts +3 -0
- package/out/deploy/uploader/index.d.ts.map +1 -0
- package/out/deploy/uploader/index.js +5 -0
- package/out/deploy/uploader/uploader.d.ts +19 -0
- package/out/deploy/uploader/uploader.d.ts.map +1 -0
- package/out/deploy/uploader/uploader.js +43 -0
- package/out/environment-variables/delete-environment-variable.d.ts +18 -0
- package/out/environment-variables/delete-environment-variable.d.ts.map +1 -0
- package/out/environment-variables/delete-environment-variable.js +14 -0
- package/out/environment-variables/graphql-client.d.ts +16 -0
- package/out/environment-variables/graphql-client.d.ts.map +1 -0
- package/out/environment-variables/graphql-client.js +113 -0
- package/out/environment-variables/list-environment-variables.d.ts +22 -0
- package/out/environment-variables/list-environment-variables.d.ts.map +1 -0
- package/out/environment-variables/list-environment-variables.js +14 -0
- package/out/environment-variables/set-environment-variable.d.ts +20 -0
- package/out/environment-variables/set-environment-variable.d.ts.map +1 -0
- package/out/environment-variables/set-environment-variable.js +14 -0
- package/out/installations/graphql-client.d.ts +75 -0
- package/out/installations/graphql-client.d.ts.map +1 -0
- package/out/installations/graphql-client.js +423 -0
- package/out/installations/install-app-site.d.ts +21 -0
- package/out/installations/install-app-site.d.ts.map +1 -0
- package/out/installations/install-app-site.js +19 -0
- package/out/installations/shared.d.ts +5 -0
- package/out/installations/shared.d.ts.map +1 -0
- package/out/installations/shared.js +20 -0
- package/out/installations/site-translation/bitbucket.d.ts +24 -0
- package/out/installations/site-translation/bitbucket.d.ts.map +1 -0
- package/out/installations/site-translation/bitbucket.js +113 -0
- package/out/installations/site-translation/cloudid-products.d.ts +17 -0
- package/out/installations/site-translation/cloudid-products.d.ts.map +1 -0
- package/out/installations/site-translation/cloudid-products.js +89 -0
- package/out/installations/site-translation/index.d.ts +4 -0
- package/out/installations/site-translation/index.d.ts.map +1 -0
- package/out/installations/site-translation/index.js +6 -0
- package/out/installations/site-translation/site-translation.d.ts +12 -0
- package/out/installations/site-translation/site-translation.d.ts.map +1 -0
- package/out/installations/site-translation/site-translation.js +2 -0
- package/out/installations/uninstall-app.d.ts +25 -0
- package/out/installations/uninstall-app.d.ts.map +1 -0
- package/out/installations/uninstall-app.js +43 -0
- 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 +8 -0
- package/out/providers/graphql-client.d.ts.map +1 -0
- package/out/providers/graphql-client.js +45 -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/command-suggestion-service.d.ts +4 -0
- package/out/service/command-suggestion-service.d.ts.map +1 -0
- package/out/service/command-suggestion-service.js +17 -0
- package/out/service/docker-service.d.ts +24 -0
- package/out/service/docker-service.d.ts.map +1 -0
- package/out/service/docker-service.js +71 -0
- package/out/service/installation-service.d.ts +51 -0
- package/out/service/installation-service.d.ts.map +1 -0
- package/out/service/installation-service.js +91 -0
- package/out/service/lint-service.d.ts +23 -0
- package/out/service/lint-service.d.ts.map +1 -0
- package/out/service/lint-service.js +39 -0
- package/out/service/lite-lint-service.d.ts +10 -0
- package/out/service/lite-lint-service.d.ts.map +1 -0
- package/out/service/lite-lint-service.js +27 -0
- 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 +46 -0
- package/out/service/resource-packaging-service.d.ts.map +1 -0
- package/out/service/resource-packaging-service.js +132 -0
- package/out/service/resources-uploader-service.d.ts +16 -0
- package/out/service/resources-uploader-service.d.ts.map +1 -0
- package/out/service/resources-uploader-service.js +39 -0
- package/out/service/tunnel-analytics-service.d.ts +11 -0
- package/out/service/tunnel-analytics-service.d.ts.map +1 -0
- package/out/service/tunnel-analytics-service.js +24 -0
- package/out/service/tunnel-service.d.ts +41 -0
- package/out/service/tunnel-service.d.ts.map +1 -0
- package/out/service/tunnel-service.js +196 -0
- package/out/storage/local-file-storage.d.ts +17 -0
- package/out/storage/local-file-storage.d.ts.map +1 -0
- package/out/storage/local-file-storage.js +53 -0
- package/out/webtrigger/get-webtrigger-url.d.ts +27 -0
- package/out/webtrigger/get-webtrigger-url.d.ts.map +1 -0
- package/out/webtrigger/get-webtrigger-url.js +26 -0
- 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 +12 -0
- package/out/workers/analytics-message-worker.d.ts.map +1 -0
- package/out/workers/analytics-message-worker.js +29 -0
- package/out/workers/forge-cli-workers.d.ts +2 -0
- package/out/workers/forge-cli-workers.d.ts.map +1 -0
- package/out/workers/forge-cli-workers.js +21 -0
- package/out/workers/tunnel-clean-up-worker.d.ts +8 -0
- package/out/workers/tunnel-clean-up-worker.d.ts.map +1 -0
- package/out/workers/tunnel-clean-up-worker.js +31 -0
- package/out/workers/version-check-worker.d.ts +8 -0
- package/out/workers/version-check-worker.d.ts.map +1 -0
- package/out/workers/version-check-worker.js +20 -0
- package/out/workers/worker-info.d.ts +8 -0
- package/out/workers/worker-info.d.ts.map +1 -0
- package/out/workers/worker-info.js +15 -0
- package/out/workers/worker.d.ts +6 -0
- package/out/workers/worker.d.ts.map +1 -0
- package/out/workers/worker.js +9 -0
- package/out/workers/workers-starter.d.ts +5 -0
- package/out/workers/workers-starter.d.ts.map +1 -0
- package/out/workers/workers-starter.js +22 -0
- package/package.json +60 -5
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeployController = exports.InvalidConnectKeyError = exports.DeployLintFailureError = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
class DeployLintFailureError extends cli_shared_1.HiddenError {
|
|
6
|
+
constructor(scopes) {
|
|
7
|
+
super();
|
|
8
|
+
this.scopes = scopes;
|
|
9
|
+
}
|
|
10
|
+
getAttributes() {
|
|
11
|
+
return Object.assign(Object.assign({}, super.getAttributes()), { scopes: this.scopes });
|
|
12
|
+
}
|
|
13
|
+
isUserError() {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DeployLintFailureError = DeployLintFailureError;
|
|
18
|
+
class InvalidConnectKeyError extends cli_shared_1.HiddenError {
|
|
19
|
+
constructor(reason) {
|
|
20
|
+
super();
|
|
21
|
+
this.reason = reason;
|
|
22
|
+
}
|
|
23
|
+
getAttributes() {
|
|
24
|
+
return Object.assign(Object.assign({}, super.getAttributes()), { reason: this.reason });
|
|
25
|
+
}
|
|
26
|
+
isUserError() {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.InvalidConnectKeyError = InvalidConnectKeyError;
|
|
31
|
+
class DeployController {
|
|
32
|
+
constructor(appConfigProvider, configFile, lintService, installationsService, migrationKeysService, deployView, packageUploadDeployCommand) {
|
|
33
|
+
this.appConfigProvider = appConfigProvider;
|
|
34
|
+
this.configFile = configFile;
|
|
35
|
+
this.lintService = lintService;
|
|
36
|
+
this.installationsService = installationsService;
|
|
37
|
+
this.migrationKeysService = migrationKeysService;
|
|
38
|
+
this.deployView = deployView;
|
|
39
|
+
this.packageUploadDeployCommand = packageUploadDeployCommand;
|
|
40
|
+
}
|
|
41
|
+
isMpacProductionApp(mpacAppKey, environment) {
|
|
42
|
+
return !!(mpacAppKey && environment === 'production');
|
|
43
|
+
}
|
|
44
|
+
connectKeyDeleted(connectKey, comparisonKey) {
|
|
45
|
+
return !!(!connectKey && comparisonKey);
|
|
46
|
+
}
|
|
47
|
+
connectKeyChanged(connectKey, comparisonKey) {
|
|
48
|
+
return !!(comparisonKey && connectKey && connectKey !== comparisonKey);
|
|
49
|
+
}
|
|
50
|
+
async validateConnectKeyChange(environment, keys) {
|
|
51
|
+
const { migrationKeys, mpacAppKey } = keys;
|
|
52
|
+
const connectKey = await this.configFile.getConnectKey();
|
|
53
|
+
const migrationKey = (migrationKeys === null || migrationKeys === void 0 ? void 0 : migrationKeys.confluence) || (migrationKeys === null || migrationKeys === void 0 ? void 0 : migrationKeys.jira);
|
|
54
|
+
const isMpacApp = this.isMpacProductionApp(mpacAppKey, environment);
|
|
55
|
+
if (this.connectKeyDeleted(connectKey, migrationKey)) {
|
|
56
|
+
this.deployView.displayConnectKeyDeleteWarning(environment);
|
|
57
|
+
const proceed = await this.deployView.promptToContinueDeletingConnectKey();
|
|
58
|
+
return { proceed, connectKeyDeleted: proceed, connectKeyChanged: false };
|
|
59
|
+
}
|
|
60
|
+
else if (isMpacApp && this.connectKeyChanged(connectKey, mpacAppKey)) {
|
|
61
|
+
this.deployView.displayMPACAppConnectKeyChangeError(mpacAppKey, connectKey);
|
|
62
|
+
throw new InvalidConnectKeyError(cli_shared_1.Text.deploy.connectKeyChange.mpacAppConnectKeyChangeAnalyticsError);
|
|
63
|
+
}
|
|
64
|
+
else if (!isMpacApp && this.connectKeyChanged(connectKey, migrationKey)) {
|
|
65
|
+
this.deployView.displayConnectKeyChangeWarning(environment, migrationKey, connectKey);
|
|
66
|
+
const proceed = await this.deployView.promptToContinueChangingConnectKey();
|
|
67
|
+
return { proceed, connectKeyChanged: proceed, connectKeyDeleted: false };
|
|
68
|
+
}
|
|
69
|
+
return { proceed: true, connectKeyChanged: false, connectKeyDeleted: false };
|
|
70
|
+
}
|
|
71
|
+
async verifyPreDeployment(environment) {
|
|
72
|
+
this.deployView.displayLintRunning();
|
|
73
|
+
const { lintResults } = await this.lintService.run(environment, { fix: false }, this.deployView.getLogger());
|
|
74
|
+
const problemCount = this.lintService.problemCount(lintResults);
|
|
75
|
+
if (problemCount.errors) {
|
|
76
|
+
this.deployView.displayLintErrors(lintResults);
|
|
77
|
+
const failures = this.lintService.failedScopes(lintResults);
|
|
78
|
+
throw new DeployLintFailureError(failures);
|
|
79
|
+
}
|
|
80
|
+
else if (problemCount.warnings) {
|
|
81
|
+
this.deployView.displayLintWarnings(problemCount.warnings);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
this.deployView.displayNoLintProblems();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async verifyPostDeployment(environment) {
|
|
88
|
+
const needsVersionUpdate = await this.installationsService.hasOutdatedProductInstallation(environment);
|
|
89
|
+
if (needsVersionUpdate) {
|
|
90
|
+
this.deployView.displayOutdatedInstallationsMessage();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async run({ environment, verify }) {
|
|
94
|
+
this.deployView.displayStart(environment);
|
|
95
|
+
let hasConnectKeyChanged = false;
|
|
96
|
+
let hasConnectKeyDeleted = false;
|
|
97
|
+
if (verify) {
|
|
98
|
+
await this.verifyPreDeployment(environment);
|
|
99
|
+
const keys = await this.migrationKeysService.getMigrationKeysForAppEnvironment(environment);
|
|
100
|
+
const { proceed, connectKeyChanged, connectKeyDeleted } = await this.validateConnectKeyChange(environment, keys);
|
|
101
|
+
if (!proceed) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
hasConnectKeyChanged = connectKeyChanged;
|
|
105
|
+
hasConnectKeyDeleted = connectKeyDeleted;
|
|
106
|
+
}
|
|
107
|
+
const { id } = await this.appConfigProvider();
|
|
108
|
+
const handlers = await this.configFile.getAppHandlers();
|
|
109
|
+
const resources = await this.configFile.getResources();
|
|
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, resources, environmentKey: environment }));
|
|
123
|
+
if (verify) {
|
|
124
|
+
await this.verifyPostDeployment(environment);
|
|
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
|
+
}
|
|
136
|
+
return analytics;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.DeployController = DeployController;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UI, FeedbackPostClient } from '@forge/cli-shared';
|
|
2
|
+
import { Response } from 'node-fetch';
|
|
3
|
+
export declare class FeedbackController {
|
|
4
|
+
private readonly ui;
|
|
5
|
+
private readonly feedbackPostClient;
|
|
6
|
+
constructor(ui: UI, feedbackPostClient: FeedbackPostClient);
|
|
7
|
+
sendFeedback(feedback: string): Promise<Response>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=feedback-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/feedback-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,kBAAkB,EAAsB,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,EAAE;IAAM,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAA3C,EAAE,EAAE,EAAE,EAAmB,kBAAkB,EAAE,kBAAkB;IAE/E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;CAQ/D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FeedbackController = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
class FeedbackController {
|
|
6
|
+
constructor(ui, feedbackPostClient) {
|
|
7
|
+
this.ui = ui;
|
|
8
|
+
this.feedbackPostClient = feedbackPostClient;
|
|
9
|
+
}
|
|
10
|
+
async sendFeedback(feedback) {
|
|
11
|
+
const { email } = await (0, cli_shared_1.getCredentialStore)(this.ui).getCredentials();
|
|
12
|
+
return this.feedbackPostClient.sendFeedback({
|
|
13
|
+
summary: feedback.length <= 50 ? feedback : feedback.slice(0, 50) + '...',
|
|
14
|
+
description: feedback,
|
|
15
|
+
email
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.FeedbackController = FeedbackController;
|
|
@@ -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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { AppConfigProvider, ConfigFile, UI } from '@forge/cli-shared';
|
|
3
|
+
import { URL } from 'url';
|
|
4
|
+
import { InstallAppSiteCommand } from '../../installations/install-app-site';
|
|
5
|
+
import { InstallationService } from '../../service/installation-service';
|
|
6
|
+
import { InstallView } from '../view/install-view';
|
|
7
|
+
interface InstallViewProps {
|
|
8
|
+
environment: string;
|
|
9
|
+
site?: URL;
|
|
10
|
+
product?: string;
|
|
11
|
+
upgrade: boolean;
|
|
12
|
+
nonInteractive?: boolean;
|
|
13
|
+
confirmScopes: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class NoDeploymentError extends Error {
|
|
16
|
+
constructor(environment: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class InstallController {
|
|
19
|
+
private readonly appConfigProvider;
|
|
20
|
+
private readonly configFile;
|
|
21
|
+
private readonly ui;
|
|
22
|
+
private readonly installAppSiteCommand;
|
|
23
|
+
private readonly installationService;
|
|
24
|
+
private readonly installView;
|
|
25
|
+
constructor(appConfigProvider: AppConfigProvider, configFile: ConfigFile, ui: UI, installAppSiteCommand: InstallAppSiteCommand, installationService: InstallationService, installView: InstallView);
|
|
26
|
+
private securityPrompt;
|
|
27
|
+
private installOrUpgrade;
|
|
28
|
+
private promptForProduct;
|
|
29
|
+
private promptForSite;
|
|
30
|
+
private promptForUpgrade;
|
|
31
|
+
private getUniqueInstallationProductsFromScopes;
|
|
32
|
+
run({ environment, site, product, upgrade, confirmScopes, nonInteractive }: InstallViewProps): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=install-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,EAUH,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;YAeb,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"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstallController = exports.NoDeploymentError = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
class NoDeploymentError extends Error {
|
|
6
|
+
constructor(environment) {
|
|
7
|
+
super(cli_shared_1.Text.install.error.noDeploymentFound((0, cli_shared_1.environmentToOption)(environment)));
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.NoDeploymentError = NoDeploymentError;
|
|
11
|
+
class InstallController {
|
|
12
|
+
constructor(appConfigProvider, configFile, ui, installAppSiteCommand, installationService, installView) {
|
|
13
|
+
this.appConfigProvider = appConfigProvider;
|
|
14
|
+
this.configFile = configFile;
|
|
15
|
+
this.ui = ui;
|
|
16
|
+
this.installAppSiteCommand = installAppSiteCommand;
|
|
17
|
+
this.installationService = installationService;
|
|
18
|
+
this.installView = installView;
|
|
19
|
+
}
|
|
20
|
+
async securityPrompt(site) {
|
|
21
|
+
this.ui.info(cli_shared_1.Text.install.security.banner(site.host));
|
|
22
|
+
let isTrustedApp = true;
|
|
23
|
+
for (const question of cli_shared_1.Text.install.security.questions) {
|
|
24
|
+
if (await this.ui.confirm(question)) {
|
|
25
|
+
isTrustedApp = false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (!isTrustedApp) {
|
|
29
|
+
this.ui.info(cli_shared_1.Text.install.security.notTrustedApp.warn(site.host));
|
|
30
|
+
if (!(await this.ui.confirm(cli_shared_1.Text.install.security.notTrustedApp.confirmApproval))) {
|
|
31
|
+
this.ui.info(cli_shared_1.Text.install.security.notTrustedApp.corpSecurityHelpdesk);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async installOrUpgrade(upgrade, environment, site, product, appId, text) {
|
|
37
|
+
return this.ui.displayProgress(async () => {
|
|
38
|
+
if (upgrade) {
|
|
39
|
+
const isAlreadyUpdated = await this.installationService.upgradeInstallation(site, product, environment, appId);
|
|
40
|
+
return isAlreadyUpdated;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
await this.installAppSiteCommand.execute({
|
|
44
|
+
environmentKey: environment,
|
|
45
|
+
site,
|
|
46
|
+
product
|
|
47
|
+
});
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}, text.cmd.start((0, cli_shared_1.environmentToOption)(environment)), (alreadyUpdated) => {
|
|
51
|
+
if (alreadyUpdated) {
|
|
52
|
+
return cli_shared_1.Text.upgrade.alreadyUpdated.spinner;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return text.cmd.end(false);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async promptForProduct() {
|
|
60
|
+
this.ui.info(cli_shared_1.Text.installationContext.overviewProduct);
|
|
61
|
+
return await this.ui.promptForList(cli_shared_1.Text.installationContext.promptProduct, cli_shared_1.SUPPORTED_PRODUCTS);
|
|
62
|
+
}
|
|
63
|
+
async promptForSite(product) {
|
|
64
|
+
this.ui.info(cli_shared_1.Text.installationContext.overviewSite);
|
|
65
|
+
const promptText = product && (0, cli_shared_1.isWorkspaceProduct)(product)
|
|
66
|
+
? cli_shared_1.Text.installationContext.promptWorkspace
|
|
67
|
+
: cli_shared_1.Text.installationContext.promptSite;
|
|
68
|
+
const trySite = await this.ui.promptForText(promptText);
|
|
69
|
+
if (!trySite) {
|
|
70
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.error.invalidSite);
|
|
71
|
+
}
|
|
72
|
+
return (0, cli_shared_1.validateSite)(trySite, product);
|
|
73
|
+
}
|
|
74
|
+
async promptForUpgrade(siteOption, productOption, environmentOption) {
|
|
75
|
+
const { installations } = await this.installationService.listNonTechnicalAppInstallations({
|
|
76
|
+
site: siteOption === null || siteOption === void 0 ? void 0 : siteOption.host,
|
|
77
|
+
product: productOption,
|
|
78
|
+
environment: environmentOption
|
|
79
|
+
});
|
|
80
|
+
const { site, product, environmentKey } = await this.installView.promptForUpgrade(installations);
|
|
81
|
+
return {
|
|
82
|
+
site: (0, cli_shared_1.validateSite)(site, product),
|
|
83
|
+
product: (0, cli_shared_1.capitalizeProduct)(product),
|
|
84
|
+
environment: environmentKey
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
getUniqueInstallationProductsFromScopes(scopes) {
|
|
88
|
+
if (!scopes || scopes.length === 0)
|
|
89
|
+
return undefined;
|
|
90
|
+
const products = new Set();
|
|
91
|
+
scopes.forEach((scope) => {
|
|
92
|
+
if (scope.search('jira') !== -1) {
|
|
93
|
+
products.add('jira');
|
|
94
|
+
}
|
|
95
|
+
else if (scope.search('confluence') !== -1) {
|
|
96
|
+
products.add('confluence');
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return products.size > 0 ? Array.from(products) : undefined;
|
|
100
|
+
}
|
|
101
|
+
async run({ environment, site, product, upgrade, confirmScopes, nonInteractive }) {
|
|
102
|
+
var _a;
|
|
103
|
+
const { id } = await this.appConfigProvider();
|
|
104
|
+
const text = upgrade ? cli_shared_1.Text.upgrade : cli_shared_1.Text.install;
|
|
105
|
+
if (upgrade && (!site || !product)) {
|
|
106
|
+
const upgradeResult = await this.promptForUpgrade(site, product, environment);
|
|
107
|
+
environment = upgradeResult.environment;
|
|
108
|
+
site = upgradeResult.site;
|
|
109
|
+
product = upgradeResult.product;
|
|
110
|
+
}
|
|
111
|
+
product = product ? product : await this.promptForProduct();
|
|
112
|
+
site = site ? site : await this.promptForSite(product);
|
|
113
|
+
this.ui.info(text.banner);
|
|
114
|
+
if ((0, cli_shared_1.isSecureSite)(site)) {
|
|
115
|
+
await this.securityPrompt(site);
|
|
116
|
+
}
|
|
117
|
+
const environmentPermissions = await this.installationService.getAppEnvironmentPermissions(id, environment);
|
|
118
|
+
if (!(environmentPermissions === null || environmentPermissions === void 0 ? void 0 : environmentPermissions.scopes) || environmentPermissions.scopes.length === 0) {
|
|
119
|
+
this.ui.error(new NoDeploymentError(environment), { pad: false });
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const { scopes: environmentScopes } = environmentPermissions;
|
|
123
|
+
const [{ permissions }, manifestEgressEntries] = await Promise.all([
|
|
124
|
+
this.configFile.readConfig(),
|
|
125
|
+
this.configFile.getEgressPermissions()
|
|
126
|
+
]);
|
|
127
|
+
const manifestEgressAddresses = (0, cli_shared_1.flatMap)(manifestEgressEntries, ({ domains }) => domains !== null && domains !== void 0 ? domains : []);
|
|
128
|
+
const manifestScopes = (_a = permissions === null || permissions === void 0 ? void 0 : permissions.scopes) !== null && _a !== void 0 ? _a : [];
|
|
129
|
+
const scopesConfirmationResult = await this.installView.promptForPermissionsConfirmation(environmentPermissions, manifestScopes, manifestEgressAddresses, environment, confirmScopes, !!nonInteractive, text);
|
|
130
|
+
if (!scopesConfirmationResult)
|
|
131
|
+
return;
|
|
132
|
+
const isAlreadyUpdated = await this.installOrUpgrade(upgrade, environment, site, product, id, text);
|
|
133
|
+
if (isAlreadyUpdated) {
|
|
134
|
+
this.ui.info(cli_shared_1.Text.upgrade.alreadyUpdated.banner(environment, cli_shared_1.environmentToOption, product, site.host));
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
this.ui.emptyLine();
|
|
138
|
+
this.ui.info(text.success.banner(environment, cli_shared_1.environmentToOption, product, site.host));
|
|
139
|
+
const uniqueProductsFromScopes = this.getUniqueInstallationProductsFromScopes(environmentScopes);
|
|
140
|
+
if (!uniqueProductsFromScopes || uniqueProductsFromScopes.length <= 1)
|
|
141
|
+
return;
|
|
142
|
+
const { installations } = await this.installationService.listNonTechnicalAppInstallations({
|
|
143
|
+
site: site.host,
|
|
144
|
+
environment
|
|
145
|
+
});
|
|
146
|
+
const productsToUpgrade = installations
|
|
147
|
+
.filter((installation) => !installation.version.isLatest)
|
|
148
|
+
.map((installation) => installation.product);
|
|
149
|
+
const installedProducts = installations.map((installation) => installation.product);
|
|
150
|
+
const productsToInstall = uniqueProductsFromScopes.filter((product) => !installedProducts.includes(product));
|
|
151
|
+
if (productsToInstall.length === 0 && productsToUpgrade.length === 0)
|
|
152
|
+
return;
|
|
153
|
+
this.ui.warn(cli_shared_1.Text.install.multiProductScopesDetected(productsToInstall, productsToUpgrade, site.host, environment, cli_shared_1.environmentToOption));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
exports.InstallController = InstallController;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LintService } from '../../service/lint-service';
|
|
2
|
+
import { LintView } from '../view/lint-view';
|
|
3
|
+
export declare class LintController {
|
|
4
|
+
private readonly lintService;
|
|
5
|
+
private readonly lintView;
|
|
6
|
+
constructor(lintService: LintService, lintView: LintView);
|
|
7
|
+
run(environment: string, fix: boolean): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=lint-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/lint-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,WAAW;IAAe,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAnD,WAAW,EAAE,WAAW,EAAmB,QAAQ,EAAE,QAAQ;IAE7E,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAUnE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LintController = void 0;
|
|
4
|
+
class LintController {
|
|
5
|
+
constructor(lintService, lintView) {
|
|
6
|
+
this.lintService = lintService;
|
|
7
|
+
this.lintView = lintView;
|
|
8
|
+
}
|
|
9
|
+
async run(environment, fix) {
|
|
10
|
+
!fix && this.lintView.showBlurb();
|
|
11
|
+
const runResult = await this.lintService.run(environment, { fix }, this.lintView.getLogger());
|
|
12
|
+
if (runResult === null || runResult === void 0 ? void 0 : runResult.fixResults) {
|
|
13
|
+
this.lintView.reportFixResult(runResult.fixResults);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
this.lintView.reportLintResult(runResult.lintResults);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.LintController = LintController;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LiteLintService } from '../../service/lite-lint-service';
|
|
2
|
+
import { LiteLintView } from '../view/lite-lint-view';
|
|
3
|
+
import { ConfigReader, UserError } from '@forge/cli-shared';
|
|
4
|
+
import { CachedConfigService } from '../../service/cached-config-service';
|
|
5
|
+
import { AnalyticsSettingsView } from '../view/analytics-settings-view';
|
|
6
|
+
import { SettingsView } from '../view/settings-view';
|
|
7
|
+
export declare class PreCommandValidationError extends UserError {
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
10
|
+
export declare class PreCommandController {
|
|
11
|
+
private readonly service;
|
|
12
|
+
private readonly view;
|
|
13
|
+
private readonly configReader;
|
|
14
|
+
private readonly cachedConfigService;
|
|
15
|
+
private readonly analyticsSettingsView;
|
|
16
|
+
private readonly settingsView;
|
|
17
|
+
constructor(service: LiteLintService, view: LiteLintView, configReader: ConfigReader, cachedConfigService: CachedConfigService, analyticsSettingsView: AnalyticsSettingsView, settingsView: SettingsView);
|
|
18
|
+
private runChecks;
|
|
19
|
+
verifyManifestExists(): () => Promise<void>;
|
|
20
|
+
verifyManifestExistsWithAppConfig(): () => Promise<{
|
|
21
|
+
appId?: string;
|
|
22
|
+
}>;
|
|
23
|
+
verifyAnalyticsPreferences(nonInteractive?: boolean): () => Promise<boolean>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=pre-command-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pre-command-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/pre-command-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAQ,YAAY,EAAmB,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBAAa,yBAA0B,SAAQ,SAAS;;CAIvD;AAED,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY;gBALZ,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,qBAAqB,EAAE,qBAAqB,EAC5C,YAAY,EAAE,YAAY;YAG/B,SAAS;IAQvB,oBAAoB,IAAI,MAAM,OAAO,CAAC,IAAI,CAAC;IAI3C,iCAAiC,IAAI,MAAM,OAAO,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAUtE,0BAA0B,CAAC,cAAc,UAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC;CAgB3E"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreCommandController = exports.PreCommandValidationError = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
class PreCommandValidationError extends cli_shared_1.UserError {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(cli_shared_1.Text.config.manifest.invalid);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.PreCommandValidationError = PreCommandValidationError;
|
|
11
|
+
class PreCommandController {
|
|
12
|
+
constructor(service, view, configReader, cachedConfigService, analyticsSettingsView, settingsView) {
|
|
13
|
+
this.service = service;
|
|
14
|
+
this.view = view;
|
|
15
|
+
this.configReader = configReader;
|
|
16
|
+
this.cachedConfigService = cachedConfigService;
|
|
17
|
+
this.analyticsSettingsView = analyticsSettingsView;
|
|
18
|
+
this.settingsView = settingsView;
|
|
19
|
+
}
|
|
20
|
+
async runChecks(strict) {
|
|
21
|
+
const report = await this.service.run(strict, this.view.getLogger());
|
|
22
|
+
if (this.service.hasErrors(report)) {
|
|
23
|
+
this.view.reportErrors(report);
|
|
24
|
+
throw new PreCommandValidationError();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
verifyManifestExists() {
|
|
28
|
+
return async () => this.runChecks(false);
|
|
29
|
+
}
|
|
30
|
+
verifyManifestExistsWithAppConfig() {
|
|
31
|
+
return async () => {
|
|
32
|
+
await this.runChecks(true);
|
|
33
|
+
const config = await this.configReader.readConfig();
|
|
34
|
+
return {
|
|
35
|
+
appId: config.app.id
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
verifyAnalyticsPreferences(nonInteractive = false) {
|
|
40
|
+
return async () => {
|
|
41
|
+
const preference = this.cachedConfigService.getAnalyticsPreferences();
|
|
42
|
+
if (preference === undefined) {
|
|
43
|
+
if (nonInteractive) {
|
|
44
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.nonInteractive.error.missingAnalyticsPreferences);
|
|
45
|
+
}
|
|
46
|
+
const selectedPreference = await this.analyticsSettingsView.promptForPreference();
|
|
47
|
+
this.cachedConfigService.setAnalyticsPreferences(selectedPreference);
|
|
48
|
+
this.settingsView.setSuccess('usage-analytics', selectedPreference.toString());
|
|
49
|
+
return selectedPreference;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return preference;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.PreCommandController = PreCommandController;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CLIDetails, FeatureFlagReader, Logger } from '@forge/cli-shared';
|
|
2
|
+
export interface PrerequisitesCheckResult {
|
|
3
|
+
muaoEnabled: boolean | null;
|
|
4
|
+
}
|
|
5
|
+
export declare class PrerequisitesController {
|
|
6
|
+
private readonly logger;
|
|
7
|
+
private readonly featureFlags;
|
|
8
|
+
private readonly cliDetails;
|
|
9
|
+
constructor(logger: Logger, featureFlags: FeatureFlagReader, cliDetails: CLIDetails | undefined);
|
|
10
|
+
check(): Promise<PrerequisitesCheckResult>;
|
|
11
|
+
private checkNodeVersion;
|
|
12
|
+
private checkCustomWarning;
|
|
13
|
+
private checkMUAOEnabled;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=prerequisites-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prerequisites-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/prerequisites-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAe,iBAAiB,EAAE,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAI7F,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7B;AAED,qBAAa,uBAAuB;IAEhC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAFV,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,iBAAiB,EAC/B,UAAU,EAAE,UAAU,GAAG,SAAS;IAG/C,KAAK,IAAI,OAAO,CAAC,wBAAwB,CAAC;YAUlC,gBAAgB;YAgBhB,kBAAkB;YAOlB,gBAAgB;CAG/B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrerequisitesController = void 0;
|
|
4
|
+
const semver_1 = require("semver");
|
|
5
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
|
+
const version_info_1 = require("../version-info");
|
|
7
|
+
const getNodeVersion_1 = require("./getNodeVersion");
|
|
8
|
+
class PrerequisitesController {
|
|
9
|
+
constructor(logger, featureFlags, cliDetails) {
|
|
10
|
+
this.logger = logger;
|
|
11
|
+
this.featureFlags = featureFlags;
|
|
12
|
+
this.cliDetails = cliDetails;
|
|
13
|
+
}
|
|
14
|
+
async check() {
|
|
15
|
+
await this.checkNodeVersion();
|
|
16
|
+
await this.checkCustomWarning();
|
|
17
|
+
const muaoEnabled = (await this.checkMUAOEnabled()) || process.env.ENABLE_MUAO === 'true';
|
|
18
|
+
return {
|
|
19
|
+
muaoEnabled
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async checkNodeVersion() {
|
|
23
|
+
const userNodeVersion = (0, getNodeVersion_1.getNodeVersion)();
|
|
24
|
+
if (this.cliDetails && !(0, semver_1.satisfies)(userNodeVersion, this.cliDetails.compatibleNodeVersion)) {
|
|
25
|
+
await (0, cli_shared_1.exitOnError)(this.logger, new Error(cli_shared_1.Text.error.outdatedNodeVersion(this.cliDetails.compatibleNodeVersion, userNodeVersion)), null);
|
|
26
|
+
}
|
|
27
|
+
if (!(0, semver_1.satisfies)(userNodeVersion, version_info_1.semverSupportedNodeVersion)) {
|
|
28
|
+
this.logger.warn(cli_shared_1.Text.warning.unsupportedNodeVersion(userNodeVersion, version_info_1.humanReadableSupportedNodeVersion));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async checkCustomWarning() {
|
|
32
|
+
const featureFlagValue = await this.featureFlags.readFlag('forge-cli-startup-warning');
|
|
33
|
+
if (featureFlagValue) {
|
|
34
|
+
this.logger.warn(featureFlagValue);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async checkMUAOEnabled() {
|
|
38
|
+
return this.featureFlags.readFlag('forge-cli-enable-muao');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.PrerequisitesController = PrerequisitesController;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CachedConfigService } from '../../service/cached-config-service';
|
|
2
|
+
import { SettingsView } from '../view/settings-view';
|
|
3
|
+
export declare const ALLOWED_SETTINGS: readonly ["usage-analytics"];
|
|
4
|
+
declare type AllowedSettingType = typeof ALLOWED_SETTINGS[number];
|
|
5
|
+
declare type SettingGetter = () => boolean | undefined;
|
|
6
|
+
declare type SettingSetter = (val: boolean) => void;
|
|
7
|
+
export declare class SettingsController {
|
|
8
|
+
private readonly settingsView;
|
|
9
|
+
private readonly cachedConfigService;
|
|
10
|
+
constructor(settingsView: SettingsView, cachedConfigService: CachedConfigService);
|
|
11
|
+
SETTINGS_MAP: {
|
|
12
|
+
[key in AllowedSettingType]: [string, SettingGetter, SettingSetter];
|
|
13
|
+
};
|
|
14
|
+
showSettings(json?: boolean): void;
|
|
15
|
+
private parseBoolean;
|
|
16
|
+
setSettings(preference: unknown, value: string): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=settings-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/settings-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,eAAO,MAAM,gBAAgB,8BAA+B,CAAC;AAE7D,aAAK,kBAAkB,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAM1D,aAAK,aAAa,GAAG,MAAM,OAAO,GAAG,SAAS,CAAC;AAC/C,aAAK,aAAa,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;AAE5C,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAAgB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAhE,YAAY,EAAE,YAAY,EAAmB,mBAAmB,EAAE,mBAAmB;IAElH,YAAY,EAAE;SAAG,GAAG,IAAI,kBAAkB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC;KAAE,CAMnF;IAEK,YAAY,CAAC,IAAI,CAAC,EAAE,OAAO;IAQlC,OAAO,CAAC,YAAY;IAWb,WAAW,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;CAYtD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingsController = exports.ALLOWED_SETTINGS = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
exports.ALLOWED_SETTINGS = ['usage-analytics'];
|
|
6
|
+
const isAllowedSetting = (arg) => {
|
|
7
|
+
return exports.ALLOWED_SETTINGS.includes(arg);
|
|
8
|
+
};
|
|
9
|
+
class SettingsController {
|
|
10
|
+
constructor(settingsView, cachedConfigService) {
|
|
11
|
+
this.settingsView = settingsView;
|
|
12
|
+
this.cachedConfigService = cachedConfigService;
|
|
13
|
+
this.SETTINGS_MAP = {
|
|
14
|
+
'usage-analytics': [
|
|
15
|
+
cli_shared_1.Text.settings.usageAnalytics.description,
|
|
16
|
+
() => this.cachedConfigService.getAnalyticsPreferences(),
|
|
17
|
+
(value) => this.cachedConfigService.setAnalyticsPreferences(value)
|
|
18
|
+
]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
showSettings(json) {
|
|
22
|
+
const settings = exports.ALLOWED_SETTINGS.map((setting) => {
|
|
23
|
+
const [desc, getSetting] = this.SETTINGS_MAP[setting];
|
|
24
|
+
return [setting, desc, getSetting()];
|
|
25
|
+
});
|
|
26
|
+
this.settingsView.showSettings(settings, json);
|
|
27
|
+
}
|
|
28
|
+
parseBoolean(value) {
|
|
29
|
+
switch (value) {
|
|
30
|
+
case 'true':
|
|
31
|
+
return true;
|
|
32
|
+
case 'false':
|
|
33
|
+
return false;
|
|
34
|
+
default:
|
|
35
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.settings.set.invalidValue);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
setSettings(preference, value) {
|
|
39
|
+
if (!isAllowedSetting(preference)) {
|
|
40
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.settings.set.invalidSetting(exports.ALLOWED_SETTINGS));
|
|
41
|
+
}
|
|
42
|
+
const parsedValue = this.parseBoolean(value);
|
|
43
|
+
const [, , setSetting] = this.SETTINGS_MAP[preference];
|
|
44
|
+
setSetting(parsedValue);
|
|
45
|
+
this.settingsView.setSuccess(preference, value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.SettingsController = SettingsController;
|