diff --git a/packages/@angular/cli/blueprints/component/index.ts b/packages/@angular/cli/blueprints/component/index.ts index 4013b3259aea..97e8e291f7d7 100644 --- a/packages/@angular/cli/blueprints/component/index.ts +++ b/packages/@angular/cli/blueprints/component/index.ts @@ -203,10 +203,6 @@ export default Blueprint.extend({ }, afterInstall: function (options: any) { - if (options.dryRun) { - return; - } - const returns: Array = []; const className = stringUtils.classify(`${options.entity.name}Component`); const fileName = stringUtils.dasherize(`${options.entity.name}.component`); @@ -214,6 +210,12 @@ export default Blueprint.extend({ const importPath = componentDir ? `./${componentDir}/${fileName}` : `./${fileName}`; if (!options.skipImport) { + if (options.dryRun) { + this._writeStatusToUI(chalk.yellow, + 'update', + path.relative(this.project.root, this.pathToModule)); + return; + } const preChange = fs.readFileSync(this.pathToModule, 'utf8'); returns.push( diff --git a/packages/@angular/cli/blueprints/directive/index.ts b/packages/@angular/cli/blueprints/directive/index.ts index a5e002314949..f387e9002781 100644 --- a/packages/@angular/cli/blueprints/directive/index.ts +++ b/packages/@angular/cli/blueprints/directive/index.ts @@ -132,10 +132,6 @@ export default Blueprint.extend({ }, afterInstall: function(options: any) { - if (options.dryRun) { - return; - } - const returns: Array = []; const className = stringUtils.classify(`${options.entity.name}Directive`); const fileName = stringUtils.dasherize(`${options.entity.name}.directive`); @@ -145,6 +141,12 @@ export default Blueprint.extend({ const importPath = relativeDir ? `./${relativeDir}/${fileName}` : `./${fileName}`; if (!options.skipImport) { + if (options.dryRun) { + this._writeStatusToUI(chalk.yellow, + 'update', + path.relative(this.project.root, this.pathToModule)); + return; + } returns.push( astUtils.addDeclarationToModule(this.pathToModule, className, importPath) .then((change: any) => change.apply(NodeHost)) @@ -155,9 +157,9 @@ export default Blueprint.extend({ } return result; })); - this._writeStatusToUI(chalk.yellow, - 'update', - path.relative(this.project.root, this.pathToModule)); + this._writeStatusToUI(chalk.yellow, + 'update', + path.relative(this.project.root, this.pathToModule)); } return Promise.all(returns); diff --git a/packages/@angular/cli/blueprints/pipe/index.ts b/packages/@angular/cli/blueprints/pipe/index.ts index 2b8548515439..95fc69f39813 100644 --- a/packages/@angular/cli/blueprints/pipe/index.ts +++ b/packages/@angular/cli/blueprints/pipe/index.ts @@ -112,10 +112,6 @@ export default Blueprint.extend({ }, afterInstall: function(options: any) { - if (options.dryRun) { - return; - } - const returns: Array = []; const className = stringUtils.classify(`${options.entity.name}Pipe`); const fileName = stringUtils.dasherize(`${options.entity.name}.pipe`); @@ -125,6 +121,12 @@ export default Blueprint.extend({ const importPath = relativeDir ? `./${relativeDir}/${fileName}` : `./${fileName}`; if (!options.skipImport) { + if (options.dryRun) { + this._writeStatusToUI(chalk.yellow, + 'update', + path.relative(this.project.root, this.pathToModule)); + return; + } returns.push( astUtils.addDeclarationToModule(this.pathToModule, className, importPath) .then((change: any) => change.apply(NodeHost)) @@ -135,9 +137,9 @@ export default Blueprint.extend({ } return result; })); - this._writeStatusToUI(chalk.yellow, - 'update', - path.relative(this.project.root, this.pathToModule)); + this._writeStatusToUI(chalk.yellow, + 'update', + path.relative(this.project.root, this.pathToModule)); } return Promise.all(returns);