Skip to content

Commit 17c0a3f

Browse files
authored
chore: replace rmdirSync to rmSync (#15420)
Replaces deprecated `fs.rmdirSync` with `fs.rmSync` in `examples/localization`, `packages/ui/bundle.js`, and `test/database/up-down-migration`. After upgrading to Node.js 25, running `pnpm build` failed in the `ui` package because `rmdirSync` with the recursive option was removed in v25 (DEP0147). The `rmSync` API with `{ recursive: true }` is the recommended replacement and has been available since Node.js v14.14.0.
1 parent 94254da commit 17c0a3f

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

examples/localization/src/endpoints/seed/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const seed = async ({
5050

5151
const mediaDir = path.resolve(dirname, '../../public/media')
5252
if (fs.existsSync(mediaDir)) {
53-
fs.rmdirSync(mediaDir, { recursive: true })
53+
fs.rmSync(mediaDir, { recursive: true })
5454
}
5555

5656
payload.logger.info(`— Clearing collections and globals...`)

packages/ui/bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async function build() {
8383

8484
try {
8585
fs.renameSync('dist-styles/index.css', `${directoryArg}/styles.css`)
86-
fs.rmdirSync('dist-styles', { recursive: true })
86+
fs.rmSync('dist-styles', { recursive: true })
8787
} catch (err) {
8888
console.error(`Error while renaming index.css and dist-styles: ${err}`)
8989
throw err

test/database/up-down-migration/int.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { existsSync, rmdirSync, rmSync } from 'fs'
1+
import { existsSync, rmSync } from 'fs'
22
import path from 'path'
33
import { buildConfig, getPayload } from 'payload'
44
import { fileURLToPath } from 'url'

0 commit comments

Comments
 (0)