refactor(@angular-devkit/build-angular): remove usage of rimraf package

Use Node.JS `rmdirSync` instead.
This commit is contained in:
Alan Agius 2021-06-04 13:59:28 +02:00
parent 2539023c30
commit c0106f6e3a
4 changed files with 4 additions and 8 deletions

View File

@ -130,7 +130,6 @@ ts_library(
"@npm//@types/node",
"@npm//@types/parse5-html-rewriting-stream",
"@npm//@types/postcss-preset-env",
"@npm//@types/rimraf",
"@npm//@types/sass",
"@npm//@types/semver",
"@npm//@types/text-table",
@ -171,7 +170,6 @@ ts_library(
"@npm//raw-loader",
"@npm//regenerator-runtime",
"@npm//resolve-url-loader",
"@npm//rimraf",
"@npm//rxjs",
"@npm//sass",
"@npm//sass-loader",

View File

@ -53,7 +53,6 @@
"raw-loader": "4.0.2",
"regenerator-runtime": "0.13.7",
"resolve-url-loader": "4.0.0",
"rimraf": "3.0.2",
"rxjs": "6.6.7",
"sass": "1.34.1",
"sass-loader": "12.0.0",

View File

@ -6,17 +6,17 @@
* found in the LICENSE file at https://angular.io/license
*/
import { rmdirSync } from 'fs';
import { resolve } from 'path';
import * as rimraf from 'rimraf';
/**
* Delete an output directory, but error out if it's the root of the project.
*/
export function deleteOutputDir(root: string, outputPath: string) {
export function deleteOutputDir(root: string, outputPath: string): void {
const resolvedOutputPath = resolve(root, outputPath);
if (resolvedOutputPath === root) {
throw new Error('Output path MUST not be project root directory!');
}
rimraf.sync(resolvedOutputPath);
rmdirSync(resolvedOutputPath, { recursive: true, maxRetries: 3 });
}

View File

@ -11,7 +11,6 @@ import { json } from '@angular-devkit/core';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import * as rimraf from 'rimraf';
import { Schema as BrowserBuilderSchema } from '../browser/schema';
import { Schema as ServerBuilderSchema } from '../server/schema';
import { readTsconfig } from '../utils/read-tsconfig';
@ -268,7 +267,7 @@ export async function configureI18nBuild<T extends BrowserBuilderSchema | Server
// Remove temporary directory used for i18n processing
process.on('exit', () => {
try {
rimraf.sync(tempPath);
fs.rmdirSync(tempPath, { recursive: true, maxRetries: 3 });
} catch {}
});
}