Skip to content

Commit

Permalink
Clean some code
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-rr committed Feb 5, 2024
1 parent 75e0a2d commit 8d227f3
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/commands/optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8d227f3

Please sign in to comment.