@forge/cli

12.22.012.22.0-experimental-04cc2b9
out/command-line/controller/module-controller.js
~out/command-line/controller/module-controller.jsModified
+16−6
Index: package/out/command-line/controller/module-controller.js
===================================================================
--- package/out/command-line/controller/module-controller.js
+++ package/out/command-line/controller/module-controller.js
@@ -1,7 +1,10 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.ModuleController = 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");
 const MODULE_PRODUCTS = [register_app_commands_1.TemplateContext.JIRA, register_app_commands_1.TemplateContext.CONFLUENCE];
 class ModuleController {
@@ -32,10 +35,16 @@
             throw new Error(cli_shared_1.Text.module.add.errorFailedToDownloadTemplate(selectedTemplate.moduleKey));
         }
         const depChanges = this.fileService.checkDependencies(downloadedTemplate, options.force === true);
         const hasConflicts = depChanges.conflicts.length > 0;
-        this.assertNotBlockedByConflicts(depChanges, hasConflicts, options);
+        this.assertNotBlockedByConflicts(depChanges, hasConflicts, './package.json', options);
         const variables = await this.collectVariables(downloadedTemplate, uiType);
+        const frontendPlan = (0, dependencies_merger_1.planFrontendPackageJson)(process.cwd(), downloadedTemplate, variables, options.force === true);
+        const frontendHasConflicts = frontendPlan.depChanges.conflicts.length > 0;
+        const frontendScope = frontendPlan.frontendPackageJsonPath
+            ? path_1.default.relative(process.cwd(), frontendPlan.frontendPackageJsonPath)
+            : 'frontend package.json';
+        this.assertNotBlockedByConflicts(frontendPlan.depChanges, frontendHasConflicts, frontendScope, options);
         if (!options.dryRun) {
             await this.moduleService.downloadModuleBundle(downloadedTemplate, uiType);
         }
         const result = await this.fileService.templateMerge(downloadedTemplate, variables, {
@@ -69,24 +78,25 @@
             throw new Error(cli_shared_1.Text.module.add.errorFailedToResolveChoice(selectedChoice));
         }
         return template;
     }
-    assertNotBlockedByConflicts(depChanges, hasConflicts, options) {
+    assertNotBlockedByConflicts(depChanges, hasConflicts, scope, options) {
         const blocked = hasConflicts && options.force !== true && options.install !== false;
         if (blocked && !options.dryRun) {
-            this.moduleView.renderDepConflictsBlocked(depChanges, 'backend');
+            this.moduleView.renderDepConflictsBlocked(depChanges, scope);
             throw new Error(cli_shared_1.Text.module.add.depConflictsSummary(depChanges.conflicts.length));
         }
     }
     renderRunResult(result, depChanges, hasConflicts, options) {
         if (options.dryRun) {
             this.moduleView.renderApplyResult(result, depChanges);
         }
         if (hasConflicts) {
-            this.renderConflicts(depChanges, 'backend', options);
+            this.renderConflicts(depChanges, './package.json', options);
         }
-        if (result.frontendDepChanges) {
-            this.renderConflicts(result.frontendDepChanges, 'frontend', options);
+        if (result.frontendDepChanges && result.frontendPackageJsonPath) {
+            const frontendScope = path_1.default.relative(process.cwd(), result.frontendPackageJsonPath);
+            this.renderConflicts(result.frontendDepChanges, frontendScope, options);
         }
         for (const w of result.warnings) {
             this.moduleView.warn(w);
         }