mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-18 03:23:57 +08:00
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:
parent
5c1cafe750
commit
f46a883330
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ export async function runCommand(commandMap: CommandMap,
|
||||
return 1;
|
||||
}
|
||||
|
||||
return await command.run(options);
|
||||
return command.run(options);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user