Skip to content

Commit 05af52b

Browse files
committed
refactor(@angular-devkit/architect-cli): remove unused progress bar functionality
The progress bar functionality within the Angular builders was not utilized, making the 'progress' dependency unnecessary. Furthermore, the 'progress' dependency has not been updated in approximately 7 years, indicating it may no longer be actively maintained.
1 parent 7c7e6a6 commit 05af52b

File tree

4 files changed

+1
-167
lines changed

4 files changed

+1
-167
lines changed

packages/angular_devkit/architect_cli/bin/architect.ts

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
* found in the LICENSE file at https://angular.dev/license
88
*/
99

10-
import { Architect, BuilderInfo, BuilderProgressState, Target } from '@angular-devkit/architect';
10+
import { Architect } from '@angular-devkit/architect';
1111
import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node';
1212
import { JsonValue, json, logging, schema, tags, workspaces } from '@angular-devkit/core';
1313
import { NodeJsSyncHost, createConsoleLogger } from '@angular-devkit/core/node';
1414
import * as ansiColors from 'ansi-colors';
1515
import { existsSync } from 'node:fs';
1616
import * as path from 'node:path';
1717
import yargsParser, { camelCase, decamelize } from 'yargs-parser';
18-
import { MultiProgressBar } from '../src/progress';
1918

2019
function findUp(names: string | string[], from: string) {
2120
if (!Array.isArray(names)) {
@@ -59,16 +58,6 @@ function usage(logger: logging.Logger, exitCode = 0): never {
5958
return process.exit(exitCode);
6059
}
6160

62-
function _targetStringFromTarget({ project, target, configuration }: Target) {
63-
return `${project}:${target}${configuration !== undefined ? ':' + configuration : ''}`;
64-
}
65-
66-
interface BarInfo {
67-
status?: string;
68-
builder: BuilderInfo;
69-
target?: Target;
70-
}
71-
7261
// Create a separate instance to prevent unintended global changes to the color configuration
7362
const colors = ansiColors.create();
7463

@@ -106,47 +95,6 @@ async function _executeTarget(
10695
}
10796

10897
const run = await architect.scheduleTarget(targetSpec, camelCasedOptions, { logger });
109-
const bars = new MultiProgressBar<number, BarInfo>(':name :bar (:current/:total) :status');
110-
111-
run.progress.subscribe((update) => {
112-
const data = bars.get(update.id) || {
113-
id: update.id,
114-
builder: update.builder,
115-
target: update.target,
116-
status: update.status || '',
117-
name: (
118-
(update.target ? _targetStringFromTarget(update.target) : update.builder.name) +
119-
' '.repeat(80)
120-
).substring(0, 40),
121-
};
122-
123-
if (update.status !== undefined) {
124-
data.status = update.status;
125-
}
126-
127-
switch (update.state) {
128-
case BuilderProgressState.Error:
129-
data.status = 'Error: ' + update.error;
130-
bars.update(update.id, data);
131-
break;
132-
133-
case BuilderProgressState.Stopped:
134-
data.status = 'Done.';
135-
bars.complete(update.id);
136-
bars.update(update.id, data, update.total, update.total);
137-
break;
138-
139-
case BuilderProgressState.Waiting:
140-
bars.update(update.id, data);
141-
break;
142-
143-
case BuilderProgressState.Running:
144-
bars.update(update.id, data, update.current, update.total);
145-
break;
146-
}
147-
148-
bars.render();
149-
});
15098

15199
// Wait for full completion of the builder.
152100
try {
@@ -163,7 +111,6 @@ async function _executeTarget(
163111
logs.splice(0);
164112

165113
await run.stop();
166-
bars.terminate();
167114

168115
return result.success ? 0 : 1;
169116
} catch (err) {

packages/angular_devkit/architect_cli/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
"@angular-devkit/architect": "workspace:0.0.0-EXPERIMENTAL-PLACEHOLDER",
1818
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
1919
"ansi-colors": "4.1.3",
20-
"progress": "2.0.3",
2120
"yargs-parser": "22.0.0"
22-
},
23-
"devDependencies": {
24-
"@types/progress": "2.0.7"
2521
}
2622
}

packages/angular_devkit/architect_cli/src/progress.ts

Lines changed: 0 additions & 102 deletions
This file was deleted.

pnpm-lock.yaml

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)