Skip to content

Commit 18226c6

Browse files
clydinalan-agius4
authored andcommitted
refactor(@angular/cli): remove ora spinner dependency from package
The ora package has been removed now that the progress indicator for the update command is now based on the `listr2` package that is also used by the `ng add` command.
1 parent 4c96537 commit 18226c6

File tree

6 files changed

+5
-78
lines changed

6 files changed

+5
-78
lines changed

packages/angular/cli/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ ts_library(
6969
"@npm//jsonc-parser",
7070
"@npm//listr2",
7171
"@npm//npm-package-arg",
72-
"@npm//ora",
7372
"@npm//pacote",
7473
"@npm//semver",
7574
"@npm//yargs",

packages/angular/cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"listr2": "8.2.1",
3535
"npm-package-arg": "11.0.2",
3636
"npm-pick-manifest": "9.0.1",
37-
"ora": "5.4.1",
3837
"pacote": "18.0.6",
3938
"resolve": "1.22.8",
4039
"semver": "7.6.2",

packages/angular/cli/src/commands/add/cli.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ export default class AddCommandModule
324324
const { success, tempNodeModules } = await packageManager.installTemp(
325325
context.packageIdentifier.toString(),
326326
registry ? [`--registry="${registry}"`] : undefined,
327-
false,
328327
);
329328
const tempRequire = createRequire(tempNodeModules + '/');
330329
assert(context.collectionName, 'Collection name should always be available');
@@ -343,7 +342,6 @@ export default class AddCommandModule
343342
context.savePackage,
344343
registry ? [`--registry="${registry}"`] : undefined,
345344
undefined,
346-
false,
347345
);
348346

349347
if (!success) {

packages/angular/cli/src/utilities/package-manager.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { join } from 'path';
1414
import { PackageManager } from '../../lib/config/workspace-schema';
1515
import { AngularWorkspace, getProjectByCwd } from './config';
1616
import { memoize } from './memoize';
17-
import { Spinner } from './spinner';
1817

1918
interface PackageManagerOptions {
2019
saveDev: string;
@@ -49,7 +48,6 @@ export class PackageManagerUtils {
4948
save: 'dependencies' | 'devDependencies' | true = true,
5049
extraArgs: string[] = [],
5150
cwd?: string,
52-
progress = true,
5351
): Promise<boolean> {
5452
const packageManagerArgs = this.getArguments();
5553
const installArgs: string[] = [packageManagerArgs.install, packageName];
@@ -58,7 +56,7 @@ export class PackageManagerUtils {
5856
installArgs.push(packageManagerArgs.saveDev);
5957
}
6058

61-
return this.run([...installArgs, ...extraArgs], { cwd, silent: true, progress });
59+
return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
6260
}
6361

6462
/** Install all packages. */
@@ -69,14 +67,13 @@ export class PackageManagerUtils {
6967
installArgs.push(packageManagerArgs.installAll);
7068
}
7169

72-
return this.run([...installArgs, ...extraArgs], { cwd, silent: true, progress: false });
70+
return this.run([...installArgs, ...extraArgs], { cwd, silent: true });
7371
}
7472

7573
/** Install a single package temporary. */
7674
async installTemp(
7775
packageName: string,
7876
extraArgs?: string[],
79-
progress = true,
8077
): Promise<{
8178
success: boolean;
8279
tempNodeModules: string;
@@ -121,7 +118,7 @@ export class PackageManagerUtils {
121118
];
122119

123120
return {
124-
success: await this.install(packageName, true, installArgs, tempPath, progress),
121+
success: await this.install(packageName, true, installArgs, tempPath),
125122
tempNodeModules,
126123
};
127124
}
@@ -164,12 +161,9 @@ export class PackageManagerUtils {
164161

165162
private async run(
166163
args: string[],
167-
options: { cwd?: string; silent?: boolean; progress?: boolean } = {},
164+
options: { cwd?: string; silent?: boolean } = {},
168165
): Promise<boolean> {
169-
const { cwd = process.cwd(), silent = false, progress = true } = options;
170-
171-
const spinner = progress ? new Spinner() : undefined;
172-
spinner?.start('Installing packages...');
166+
const { cwd = process.cwd(), silent = false } = options;
173167

174168
return new Promise((resolve) => {
175169
const bufferedOutput: { stream: NodeJS.WriteStream; data: Buffer }[] = [];
@@ -181,12 +175,9 @@ export class PackageManagerUtils {
181175
cwd,
182176
}).on('close', (code: number) => {
183177
if (code === 0) {
184-
spinner?.succeed('Packages successfully installed.');
185178
resolve(true);
186179
} else {
187-
spinner?.stop();
188180
bufferedOutput.forEach(({ stream, data }) => stream.write(data));
189-
spinner?.fail('Packages installation failed, see above.');
190181
resolve(false);
191182
}
192183
});

packages/angular/cli/src/utilities/spinner.ts

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

yarn.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ __metadata:
521521
listr2: "npm:8.2.1"
522522
npm-package-arg: "npm:11.0.2"
523523
npm-pick-manifest: "npm:9.0.1"
524-
ora: "npm:5.4.1"
525524
pacote: "npm:18.0.6"
526525
resolve: "npm:1.22.8"
527526
semver: "npm:7.6.2"

0 commit comments

Comments
 (0)