npm package diff
Package: @forge/cli
Versions: 11.3.0-next.14-experimental-f55f6f2 - 11.3.0-next.16-experimental-8477be1
File: package/out/command-line/uninstall-command-helpers.js
Index: package/out/command-line/uninstall-command-helpers.js
===================================================================
--- package/out/command-line/uninstall-command-helpers.js
+++ package/out/command-line/uninstall-command-helpers.js
@@ -18,8 +18,9 @@
value: id,
extra: {
installationIdx: idx,
product: product,
+ autoSelectId: !!secondaryProducts?.length ? id : undefined,
required: !!secondaryProducts?.length
}
});
if (secondaryProducts) {
@@ -47,9 +48,24 @@
const secondUninstall = options
.filter((_, idx) => selectedSitesIndexes.includes(idx))
.filter(({ extra }) => extra?.required)
.map(({ extra }) => filteredInstallations[extra.installationIdx]);
- return [firstUninstall, secondUninstall];
+ const installationIds = new Set([...firstUninstall, ...secondUninstall].map(({ id }) => id));
+ const groups = options.reduce((acc, option, idx) => {
+ if (!installationIds.has(option.value)) {
+ return acc;
+ }
+ const group = acc.get(option.value) || new Set();
+ group.add(idx);
+ acc.set(option.value, group);
+ return acc;
+ }, new Map());
+ const selectedSitesIndexSet = new Set(selectedSitesIndexes);
+ const wholeGroupSelected = Array.from(installationIds).some((id) => {
+ const group = groups.get(id);
+ return group && group.size > 1 && Array.from(group).every((idx) => selectedSitesIndexSet.has(idx));
+ });
+ return [firstUninstall, secondUninstall, wholeGroupSelected];
};
exports.getInstallationsFromSelection = getInstallationsFromSelection;
const performSingleUninstall = async (installId, installationContext, { ui, commands: { uninstallAppCommand } }) => {
const installation = await ui.displayProgress(() => uninstallAppCommand.execute(installId, installationContext), cli_shared_1.Text.uninstall.cmd.start, (result) => ({