@trumbitta/nx-plugin-openapi
Version:
[](https://www.npmjs.com/@trumbitta/nx-plugin-openapi) []()
23 lines • 932 B
JavaScript
;
// From https://github.com/nrwl/nx/commit/7fcf136cad16a3111ffdc2965551f442e2618409#diff-0e0fabf373c42117939de9dac468f38475b2cb149476275279fecf66383cd2dc
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteOutputDir = void 0;
const tslib_1 = require("tslib");
// Third Parties
const fs_1 = require("fs");
const path_1 = require("path");
const rimraf = tslib_1.__importStar(require("rimraf"));
/**
* Delete an output directory, but error out if it's the root of the project.
*/
function deleteOutputDir(root, outputPath) {
const resolvedOutputPath = path_1.resolve(root, outputPath);
if (resolvedOutputPath === root) {
throw new Error('Output path MUST not be project root directory!');
}
if (fs_1.existsSync(resolvedOutputPath)) {
rimraf.sync(resolvedOutputPath);
}
}
exports.deleteOutputDir = deleteOutputDir;
//# sourceMappingURL=delete-output-dir.js.map