Skip to content

Commit

Permalink
refactor(@angular-devkit/architect-cli): remove rxjs as a dependency
Browse files Browse the repository at this point in the history
`rxjs` was only a dependency for the `tap` operator which can be replaced
by accessing the result object returned from awaiting the builder output
`Observable` which is already converted to a Promise.
  • Loading branch information
clydin committed Jul 18, 2022
1 parent b2513e5 commit 17a91a0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
1 change: 0 additions & 1 deletion packages/angular_devkit/architect_cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ ts_library(
"@npm//@types/progress",
"@npm//@types/yargs-parser",
"@npm//ansi-colors",
"@npm//rxjs",
],
)

Expand Down
30 changes: 12 additions & 18 deletions packages/angular_devkit/architect_cli/bin/architect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { NodeJsSyncHost, createConsoleLogger } from '@angular-devkit/core/node';
import * as ansiColors from 'ansi-colors';
import { existsSync } from 'fs';
import * as path from 'path';
import { tap } from 'rxjs/operators';
import yargsParser, { camelCase, decamelize } from 'yargs-parser';
import { MultiProgressBar } from '../src/progress';

Expand Down Expand Up @@ -151,27 +150,22 @@ async function _executeTarget(

// Wait for full completion of the builder.
try {
const { success } = await run.output
.pipe(
tap((result) => {
if (result.success) {
parentLogger.info(colors.green('SUCCESS'));
} else {
parentLogger.info(colors.red('FAILURE'));
}
parentLogger.info('Result: ' + JSON.stringify({ ...result, info: undefined }, null, 4));

parentLogger.info('\nLogs:');
logs.forEach((l) => parentLogger.next(l));
logs.splice(0);
}),
)
.toPromise();
const result = await run.output.toPromise();
if (result.success) {
parentLogger.info(colors.green('SUCCESS'));
} else {
parentLogger.info(colors.red('FAILURE'));
}
parentLogger.info('Result: ' + JSON.stringify({ ...result, info: undefined }, null, 4));

parentLogger.info('\nLogs:');
logs.forEach((l) => parentLogger.next(l));
logs.splice(0);

await run.stop();
bars.terminate();

return success ? 0 : 1;
return result.success ? 0 : 1;
} catch (err) {
parentLogger.info(colors.red('ERROR'));
parentLogger.info('\nLogs:');
Expand Down
1 change: 0 additions & 1 deletion packages/angular_devkit/architect_cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"@angular-devkit/core": "0.0.0-PLACEHOLDER",
"ansi-colors": "4.1.3",
"progress": "2.0.3",
"rxjs": "6.6.7",
"symbol-observable": "4.0.0",
"yargs-parser": "21.0.1"
},
Expand Down

0 comments on commit 17a91a0

Please sign in to comment.