From ff4538e981cfff49b6e8433ffcb5ac2d2ea5d07e Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 9 Nov 2021 15:22:05 +0100 Subject: [PATCH] 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 b7b1325a67a291c32ffcaf378f408380d38549bd) --- .../cli/src/commands/update/schematic/index.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/angular/cli/src/commands/update/schematic/index.ts b/packages/angular/cli/src/commands/update/schematic/index.ts index 4e951adee87a..a0b92febe48b 100644 --- a/packages/angular/cli/src/commands/update/schematic/index.ts +++ b/packages/angular/cli/src/commands/update/schematic/index.ts @@ -460,17 +460,15 @@ function _usageMessage( target, }; }) - .filter(({ info, version, target }) => { - return target && semver.compare(info.installed.version, version) < 0; - }) - .filter(({ target }) => { - return target['ng-update']; - }) + .filter( + ({ info, version, target }) => + target?.['ng-update'] && semver.compare(info.installed.version, version) < 0, + ) .map(({ name, info, version, tag, target }) => { // Look for packageGroup. - const packageGroup = target['ng-update']?.['packageGroup']; + const packageGroup = target['ng-update']['packageGroup']; if (packageGroup) { - const packageGroupName = packageGroup?.[0]; + const packageGroupName = target['ng-update']['packageGroupName'] || packageGroup[0]; if (packageGroupName) { if (packageGroups.has(name)) { return null;