@forge/cli
13.3.0-next.20-experimental-cf2ad4c13.3.0-next.12-experimental-4b981ef-experimental-5b8eb3c
out/command-line/controller/module-add-controller.js~
out/command-line/controller/module-add-controller.jsModified+12−23
Index: package/out/command-line/controller/module-add-controller.js
===================================================================
--- package/out/command-line/controller/module-add-controller.js
+++ package/out/command-line/controller/module-add-controller.js
@@ -1,27 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.ModuleAddController = exports.SELECTABLE_PRODUCTS = exports.MODULE_PRODUCTS = void 0;
+exports.ModuleAddController = exports.MODULE_PRODUCTS = void 0;
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const dependencies_merger_1 = require("../../module-add/dependencies-merger");
const cli_shared_1 = require("@forge/cli-shared");
const register_app_commands_1 = require("../register-app-commands");
exports.MODULE_PRODUCTS = [
- register_app_commands_1.TemplateContext.AUTOMATION,
- register_app_commands_1.TemplateContext.GLOBAL,
register_app_commands_1.TemplateContext.BITBUCKET,
register_app_commands_1.TemplateContext.COMPASS,
register_app_commands_1.TemplateContext.CONFLUENCE,
register_app_commands_1.TemplateContext.CUSTOMER_SERVICE_MANAGEMENT,
register_app_commands_1.TemplateContext.DASHBOARDS,
register_app_commands_1.TemplateContext.JIRA,
register_app_commands_1.TemplateContext.JIRA_SERVICE_MANAGEMENT,
register_app_commands_1.TemplateContext.ROVO,
- register_app_commands_1.TemplateContext.TRIGGER,
register_app_commands_1.TemplateContext.TEAMWORK_GRAPH
];
-exports.SELECTABLE_PRODUCTS = [register_app_commands_1.TemplateContext.SHOW_ALL, ...exports.MODULE_PRODUCTS];
class ModuleAddController {
moduleView;
moduleService;
fileService;
@@ -62,29 +58,24 @@
const frontendScope = frontendPlan.frontendPackageJsonPath
? path_1.default.relative(process.cwd(), frontendPlan.frontendPackageJsonPath)
: 'frontend package.json';
this.assertNotBlockedByConflicts(frontendPlan.depChanges, frontendHasConflicts, frontendScope, options);
- const applyModule = async () => {
- if (!options.dryRun) {
- await this.moduleService.downloadModuleBundle(downloadedTemplate, uiType);
- }
- return this.fileService.templateMerge(downloadedTemplate, variables, {
- dryRun: options.dryRun,
- force: options.force,
- install: options.install
- });
- };
- const result = options.dryRun
- ? await applyModule()
- : await this.moduleView.displayProgress(applyModule, cli_shared_1.Text.module.add.spinnerAdding, cli_shared_1.Text.module.add.spinnerAdded);
+ if (!options.dryRun) {
+ await this.moduleService.downloadModuleBundle(downloadedTemplate, uiType);
+ }
+ const result = await this.fileService.templateMerge(downloadedTemplate, variables, {
+ dryRun: options.dryRun,
+ force: options.force,
+ install: options.install
+ });
this.renderRunResult(result, depChanges, hasConflicts, options);
}
async resolveProduct(options) {
const product = options.product ??
- (await this.moduleView.promptForFilterableList(cli_shared_1.Text.module.add.promptSelectProduct, exports.SELECTABLE_PRODUCTS, {
+ (await this.moduleView.promptForFilterableList(cli_shared_1.Text.module.add.promptSelectProduct, exports.MODULE_PRODUCTS, {
format: register_app_commands_1.formatProduct
}));
- if (!exports.SELECTABLE_PRODUCTS.includes(product)) {
+ if (!exports.MODULE_PRODUCTS.includes(product)) {
throw new Error(cli_shared_1.Text.module.add.errorInvalidProduct(product));
}
return product;
}
@@ -98,11 +89,9 @@
}
throw new Error(cli_shared_1.Text.module.add.errorFailedToResolveChoice(moduleType));
}
async resolveSelectedTemplate(product) {
- const moduleMap = product === register_app_commands_1.TemplateContext.SHOW_ALL
- ? await this.moduleService.getAvailableModules()
- : await this.moduleService.getAvailableModules(product);
+ const moduleMap = await this.moduleService.getAvailableModules(product);
const moduleChoiceMap = this.moduleService.getModuleChoice(moduleMap);
const selectedChoice = await this.moduleView.promptForFilterableList(cli_shared_1.Text.module.add.promptSelectModule, Array.from(moduleChoiceMap.keys()), undefined, 10);
const template = moduleChoiceMap.get(selectedChoice);
if (!template) {