From 793710e43c7ab40b290b74b5ede4a7bca56e4aab Mon Sep 17 00:00:00 2001 From: szymonrybczak Date: Mon, 6 Nov 2023 06:53:07 +0100 Subject: [PATCH 1/2] chore: replace `fs.rmdir` with `fs.rm` --- packages/cli-clean/src/clean.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli-clean/src/clean.ts b/packages/cli-clean/src/clean.ts index d2bcb9fb4..ab7f63aac 100644 --- a/packages/cli-clean/src/clean.ts +++ b/packages/cli-clean/src/clean.ts @@ -2,7 +2,7 @@ import {getLoader, prompt} from '@react-native-community/cli-tools'; import type {Config as CLIConfig} from '@react-native-community/cli-types'; import chalk from 'chalk'; import execa from 'execa'; -import {existsSync as fileExists, rmdir} from 'fs'; +import {existsSync as fileExists, rm} from 'fs'; import os from 'os'; import path from 'path'; import {promisify} from 'util'; @@ -27,14 +27,14 @@ type CleanGroups = { const DEFAULT_GROUPS = ['metro', 'watchman']; -const rmdirAsync = promisify(rmdir); +const rmAsync = promisify(rm); function cleanDir(directory: string): Promise { if (!fileExists(directory)) { return Promise.resolve(); } - return rmdirAsync(directory, {maxRetries: 3, recursive: true}); + return rmAsync(directory, {maxRetries: 3, recursive: true}); } function findPath(startPath: string, files: string[]): string | undefined { From 6d5605265b626dfc3fff5e184c4fed2b6725316d Mon Sep 17 00:00:00 2001 From: szymonrybczak Date: Mon, 6 Nov 2023 10:59:36 +0100 Subject: [PATCH 2/2] feat: add `force` option --- packages/cli-clean/src/clean.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli-clean/src/clean.ts b/packages/cli-clean/src/clean.ts index ab7f63aac..114d109fb 100644 --- a/packages/cli-clean/src/clean.ts +++ b/packages/cli-clean/src/clean.ts @@ -34,7 +34,7 @@ function cleanDir(directory: string): Promise { return Promise.resolve(); } - return rmAsync(directory, {maxRetries: 3, recursive: true}); + return rmAsync(directory, {maxRetries: 3, recursive: true, force: true}); } function findPath(startPath: string, files: string[]): string | undefined {