From 0f58a17c4ce92495d96721bc3f2b632a890bbab4 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 19 Jan 2023 11:31:58 +0000 Subject: [PATCH] feat(@angular/cli): log number of files update during `ng update` This commit updates `ng update` to include the number of files updated when a migration is completed. Closes #24488 --- .../angular/cli/src/commands/update/cli.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/angular/cli/src/commands/update/cli.ts b/packages/angular/cli/src/commands/update/cli.ts index 118f6ae15bb6..c2c7ed05f58c 100644 --- a/packages/angular/cli/src/commands/update/cli.ts +++ b/packages/angular/cli/src/commands/update/cli.ts @@ -387,16 +387,29 @@ export class UpdateCommandModule extends CommandModule { logger.info(' ' + description.join('.\n ')); } - const result = await this.executeSchematic( + const { success, files } = await this.executeSchematic( workflow, migration.collection.name, migration.name, ); - if (!result.success) { + if (!success) { return 1; } - logger.info(' Migration completed.'); + let modifiedFilesText: string; + switch (files.size) { + case 0: + modifiedFilesText = 'No changes made'; + break; + case 1: + modifiedFilesText = '1 file modified'; + break; + default: + modifiedFilesText = `${files.size} files modified`; + break; + } + + logger.info(` Migration completed (${modifiedFilesText}).`); // Commit migration if (commit) {