refactor(@angular/cli): remove extra await

An async function always wraps the return value in a Promise. Using return await just adds extra time before the overreaching promise is resolved without changing the semantics.
This commit is contained in:
Alan Agius 2018-06-25 15:30:40 +02:00 committed by clydin
parent 5c1cafe750
commit f46a883330
3 changed files with 5 additions and 3 deletions

View File

@ -22,7 +22,7 @@ export default class E2eCommand extends ArchitectCommand {
this.configurationOption,
];
public run(options: ArchitectCommandOptions) {
public async run(options: ArchitectCommandOptions) {
return this.runArchitectTarget(options);
}
}

View File

@ -177,7 +177,9 @@ export abstract class ArchitectCommand extends Command<ArchitectCommandOptions>
return await from(this.getProjectNamesByTarget(this.target)).pipe(
concatMap(project => runSingleTarget({ ...targetSpec, project })),
toArray(),
).toPromise().then(results => results.every(res => res === 0) ? 0 : 1);
map(results => results.every(res => res === 0) ? 0 : 1),
)
.toPromise();
} else {
return await runSingleTarget(targetSpec).toPromise();
}

View File

@ -169,7 +169,7 @@ export async function runCommand(commandMap: CommandMap,
return 1;
}
return await command.run(options);
return command.run(options);
}
}