diff --git a/src/commands/optimize.ts b/src/commands/optimize.ts index 96087a90d10..2056e45c6fb 100644 --- a/src/commands/optimize.ts +++ b/src/commands/optimize.ts @@ -84,26 +84,24 @@ export default class Optimize extends Command { this.optimizations = flags.optimization as Optimizations[]; this.outputMethod = flags.output as Outputs; - if (!(report.moveToComponents?.length || report.removeComponents?.length || report.reuseComponents?.length)) { - this.log(`No optimization has been applied since ${this.specFile.getFilePath() ?? this.specFile.getFileURL()} looks optimized!`); - this.metricsMetadata.optimized = false; - return; - } - + this.metricsMetadata.optimized = true; + if (report.moveToComponents?.length) { this.metricsMetadata.optimization_moveToComponents = true; - this.metricsMetadata.optimized = true; } if (report.removeComponents?.length) { this.metricsMetadata.optimization_removeComponents = true; - this.metricsMetadata.optimized = true; } if (report.reuseComponents?.length) { this.metricsMetadata.optimization_reuseComponents = true; - this.metricsMetadata.optimized = true; - return; } + if (!(report.moveToComponents?.length || report.removeComponents?.length || report.reuseComponents?.length)) { + this.log(`No optimization has been applied since ${this.specFile.getFilePath() ?? this.specFile.getFileURL()} looks optimized!`); + this.metricsMetadata.optimized = false; + return; + } + const isTTY = process.stdout.isTTY; if (this.isInteractive && isTTY) { await this.interactiveRun(report);