diff --git a/packages/angular/cli/models/schematic-command.ts b/packages/angular/cli/models/schematic-command.ts index 05636b51e602..d041dd78a0d0 100644 --- a/packages/angular/cli/models/schematic-command.ts +++ b/packages/angular/cli/models/schematic-command.ts @@ -311,6 +311,16 @@ export abstract class SchematicCommand< workflow.registry.addSmartDefaultProvider('projectName', getProjectName); workflow.registry.useXDeprecatedProvider(msg => this.logger.warn(msg)); + let shouldReportAnalytics = true; + workflow.engineHost.registerOptionsTransform(async (_, options) => { + if (shouldReportAnalytics) { + shouldReportAnalytics = false; + await this.reportAnalytics([this.description.name], options as Arguments); + } + + return options; + }); + if (options.interactive !== false && isTTY()) { workflow.registry.usePromptProvider((definitions: Array) => { const questions: inquirer.QuestionCollection = definitions @@ -481,9 +491,6 @@ export abstract class SchematicCommand< ...options.additionalOptions, }; - const transformOptions = await workflow.engine.transformOptions(schematic, input).toPromise(); - await this.reportAnalytics([this.description.name], transformOptions as Arguments); - workflow.reporter.subscribe((event: DryRunEvent) => { nothingDone = false;