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.
This commit is contained in:
Charles Lyding 2025-03-14 14:40:33 -04:00 committed by Charles
parent 0173c88f50
commit 0948ddebe0
4 changed files with 6 additions and 6 deletions

View File

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

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license * found in the LICENSE file at https://angular.dev/license
*/ */
import { promises as fs } from 'node:fs'; import { rm } from 'node:fs/promises';
import { Argv } from 'yargs'; import { Argv } from 'yargs';
import { import {
CommandModule, CommandModule,
@ -28,7 +28,7 @@ export class CacheCleanModule extends CommandModule implements CommandModuleImpl
run(): Promise<void> { run(): Promise<void> {
const { path } = getCacheConfig(this.context.workspace); const { path } = getCacheConfig(this.context.workspace);
return fs.rm(path, { return rm(path, {
force: true, force: true,
recursive: true, recursive: true,
maxRetries: 3, maxRetries: 3,

View File

@ -7,7 +7,7 @@
*/ */
import { tags } from '@angular-devkit/core'; import { tags } from '@angular-devkit/core';
import { promises as fs } from 'node:fs'; import * as fs from 'node:fs/promises';
import { join } from 'node:path'; import { join } from 'node:path';
import { Argv } from 'yargs'; import { Argv } from 'yargs';
import { import {

View File

@ -8,7 +8,7 @@
import { json, logging } from '@angular-devkit/core'; import { json, logging } from '@angular-devkit/core';
import { execFile } from 'node:child_process'; import { execFile } from 'node:child_process';
import { promises as fs } from 'node:fs'; import * as fs from 'node:fs/promises';
import * as path from 'node:path'; import * as path from 'node:path';
import { env } from 'node:process'; import { env } from 'node:process';
import { colors } from '../utilities/color'; import { colors } from '../utilities/color';