Skip to content

Commit ff4538e

Browse files
alan-agius4clydin
authored andcommitted
fix(@angular/cli): favor ng-update packageGroupName in ng update output
With this change we favor the `packageGroupName` name when specified and only fallback to use the first item in in the `packageGroup` array when it is not specified. Closes #22087 (cherry picked from commit b7b1325)
1 parent 9ea74a1 commit ff4538e

File tree

1 file changed

+6
-8
lines changed
  • packages/angular/cli/src/commands/update/schematic

1 file changed

+6
-8
lines changed

packages/angular/cli/src/commands/update/schematic/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,17 +460,15 @@ function _usageMessage(
460460
target,
461461
};
462462
})
463-
.filter(({ info, version, target }) => {
464-
return target && semver.compare(info.installed.version, version) < 0;
465-
})
466-
.filter(({ target }) => {
467-
return target['ng-update'];
468-
})
463+
.filter(
464+
({ info, version, target }) =>
465+
target?.['ng-update'] && semver.compare(info.installed.version, version) < 0,
466+
)
469467
.map(({ name, info, version, tag, target }) => {
470468
// Look for packageGroup.
471-
const packageGroup = target['ng-update']?.['packageGroup'];
469+
const packageGroup = target['ng-update']['packageGroup'];
472470
if (packageGroup) {
473-
const packageGroupName = packageGroup?.[0];
471+
const packageGroupName = target['ng-update']['packageGroupName'] || packageGroup[0];
474472
if (packageGroupName) {
475473
if (packageGroups.has(name)) {
476474
return null;

0 commit comments

Comments
 (0)