cleanup(bundling): replace fs-extra with node:fs (#28113)
This commit is contained in:
parent
151c8380fa
commit
28c12b50bd
@ -10,6 +10,10 @@
|
||||
{
|
||||
"name": "chalk",
|
||||
"message": "Please use `picocolors` in place of `chalk` for rendering terminal colors"
|
||||
},
|
||||
{
|
||||
"name": "fs-extra",
|
||||
"message": "Please use equivalent utilities from `node:fs` instead."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
"@nx/devkit": "file:../devkit",
|
||||
"@nx/js": "file:../js",
|
||||
"fast-glob": "3.2.7",
|
||||
"fs-extra": "^11.1.0",
|
||||
"picocolors": "^1.1.0",
|
||||
"tsconfig-paths": "^4.1.2",
|
||||
"tslib": "^2.3.0"
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
import * as pc from 'picocolors';
|
||||
import type { ExecutorContext } from '@nx/devkit';
|
||||
import { cacheDir, joinPathFragments, logger, stripIndents } from '@nx/devkit';
|
||||
import {
|
||||
cacheDir,
|
||||
joinPathFragments,
|
||||
logger,
|
||||
stripIndents,
|
||||
writeJsonFile,
|
||||
} from '@nx/devkit';
|
||||
import {
|
||||
copyAssets,
|
||||
copyPackageJson,
|
||||
@ -13,7 +19,6 @@ import * as esbuild from 'esbuild';
|
||||
import { normalizeOptions } from './lib/normalize';
|
||||
|
||||
import { EsBuildExecutorOptions } from './schema';
|
||||
import { removeSync, writeJsonSync } from 'fs-extra';
|
||||
import { createAsyncIterable } from '@nx/devkit/src/utils/async-iterable';
|
||||
import {
|
||||
buildEsbuildOptions,
|
||||
@ -22,6 +27,7 @@ import {
|
||||
} from './lib/build-esbuild-options';
|
||||
import { getExtraDependencies } from './lib/get-extra-dependencies';
|
||||
import { DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
|
||||
import { rmSync } from 'node:fs';
|
||||
import { join, relative } from 'path';
|
||||
|
||||
const BUILD_WATCH_FAILED = `[ ${pc.red(
|
||||
@ -43,7 +49,8 @@ export async function* esbuildExecutor(
|
||||
process.env.NODE_ENV ??= context.configurationName ?? 'production';
|
||||
|
||||
const options = normalizeOptions(_options, context);
|
||||
if (options.deleteOutputPath) removeSync(options.outputPath);
|
||||
if (options.deleteOutputPath)
|
||||
rmSync(options.outputPath, { recursive: true, force: true });
|
||||
|
||||
const assetsResult = await copyAssets(options, context);
|
||||
|
||||
@ -190,7 +197,7 @@ export async function* esbuildExecutor(
|
||||
options.format.length === 1
|
||||
? 'meta.json'
|
||||
: `meta.${options.format[i]}.json`;
|
||||
writeJsonSync(
|
||||
writeJsonFile(
|
||||
joinPathFragments(options.outputPath, filename),
|
||||
buildResult.metafile
|
||||
);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import * as path from 'path';
|
||||
import { removeSync } from 'fs-extra';
|
||||
import { rmSync } from 'node:fs';
|
||||
|
||||
/**
|
||||
* Delete an output directory, but error out if it's the root of the project.
|
||||
@ -10,5 +10,5 @@ export function deleteOutputDir(root: string, outputPath: string) {
|
||||
throw new Error('Output path MUST not be project root directory!');
|
||||
}
|
||||
|
||||
removeSync(resolvedOutputPath);
|
||||
rmSync(resolvedOutputPath, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user