@nx/esbuild
Version:
16 lines (15 loc) • 586 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteOutputDir = deleteOutputDir;
const path = require("path");
const node_fs_1 = require("node:fs");
/**
* Delete an output directory, but error out if it's the root of the project.
*/
function deleteOutputDir(root, outputPath) {
const resolvedOutputPath = path.resolve(root, outputPath);
if (resolvedOutputPath === root) {
throw new Error('Output path MUST not be project root directory!');
}
(0, node_fs_1.rmSync)(resolvedOutputPath, { recursive: true, force: true });
}