From 872737b3c592d8bc627e06b13a2862231183e879 Mon Sep 17 00:00:00 2001 From: Sarun Intaralawan Date: Wed, 17 May 2017 12:46:13 +0700 Subject: [PATCH] fix(@angular/cli): supress module file modification when generating guard with dry-run flag --- packages/@angular/cli/blueprints/guard/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/@angular/cli/blueprints/guard/index.ts b/packages/@angular/cli/blueprints/guard/index.ts index 6387bfab0348..5b320f8fab9a 100644 --- a/packages/@angular/cli/blueprints/guard/index.ts +++ b/packages/@angular/cli/blueprints/guard/index.ts @@ -99,6 +99,13 @@ export default Blueprint.extend({ `; this._writeStatusToUI(chalk.yellow, 'WARNING', warningMessage); } else { + if (options.dryRun) { + this._writeStatusToUI(chalk.yellow, + 'update', + path.relative(this.project.root, this.pathToModule)); + return; + } + const className = stringUtils.classify(`${options.entity.name}Guard`); const fileName = stringUtils.dasherize(`${options.entity.name}.guard`); const fullGeneratePath = path.join(this.project.root, this.generatePath);