Skip to content

Commit 0948dde

Browse files
committed
refactor(@angular/cli): import from node:fs/promises where appropriate
Several usages of `import { promises as fs } from 'node:fs'` have been adjusted to import directly from `node:fs/promises`. This is consistent with the rest of the source code usage.
1 parent 0173c88 commit 0948dde

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

packages/angular/cli/lib/init.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import 'symbol-observable';
1010
// symbol polyfill must go first
11-
import { promises as fs } from 'node:fs';
11+
import { readFile } from 'node:fs/promises';
1212
import { createRequire } from 'node:module';
1313
import * as path from 'node:path';
1414
import { SemVer, major } from 'semver';
@@ -62,7 +62,7 @@ let forceExit = false;
6262
let localVersion = cli.VERSION?.full;
6363
if (!localVersion) {
6464
try {
65-
const localPackageJson = await fs.readFile(
65+
const localPackageJson = await readFile(
6666
path.join(path.dirname(projectLocalCli), '../../package.json'),
6767
'utf-8',
6868
);

packages/angular/cli/src/commands/cache/clean/cli.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import { promises as fs } from 'node:fs';
9+
import { rm } from 'node:fs/promises';
1010
import { Argv } from 'yargs';
1111
import {
1212
CommandModule,
@@ -28,7 +28,7 @@ export class CacheCleanModule extends CommandModule implements CommandModuleImpl
2828
run(): Promise<void> {
2929
const { path } = getCacheConfig(this.context.workspace);
3030

31-
return fs.rm(path, {
31+
return rm(path, {
3232
force: true,
3333
recursive: true,
3434
maxRetries: 3,

packages/angular/cli/src/commands/cache/info/cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import { tags } from '@angular-devkit/core';
10-
import { promises as fs } from 'node:fs';
10+
import * as fs from 'node:fs/promises';
1111
import { join } from 'node:path';
1212
import { Argv } from 'yargs';
1313
import {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { json, logging } from '@angular-devkit/core';
1010
import { execFile } from 'node:child_process';
11-
import { promises as fs } from 'node:fs';
11+
import * as fs from 'node:fs/promises';
1212
import * as path from 'node:path';
1313
import { env } from 'node:process';
1414
import { colors } from '../utilities/color';

0 commit comments

Comments
 (0)