UNPKG

778 BJavaScriptView Raw
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.deleteOutputDir = void 0;
11const path_1 = require("path");
12const rimraf = require("rimraf");
13/**
14 * Delete an output directory, but error out if it's the root of the project.
15 */
16function deleteOutputDir(root, outputPath) {
17 const resolvedOutputPath = path_1.resolve(root, outputPath);
18 if (resolvedOutputPath === root) {
19 throw new Error('Output path MUST not be project root directory!');
20 }
21 rimraf.sync(resolvedOutputPath);
22}
23exports.deleteOutputDir = deleteOutputDir;