From 30ab493ab2712b6e0c594417b26f54297b528cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Thu, 26 Oct 2023 16:30:35 +0200 Subject: [PATCH] [flatbuffers] Fix wrong usage of fs.readdirSync() in Node 20 Same as https://github.com/versatica/mediasoup-client/pull/283 --- npm-scripts.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/npm-scripts.mjs b/npm-scripts.mjs index de080af5b1..6403f1adc9 100644 --- a/npm-scripts.mjs +++ b/npm-scripts.mjs @@ -279,7 +279,7 @@ function replaceVersion() const files = fs.readdirSync('node/lib', { withFileTypes : true, - recursive : false + recursive : true }); for (const file of files) @@ -289,7 +289,8 @@ function replaceVersion() continue; } - const filePath = path.join('node/lib', file.name); + // NOTE: dirent.path is only available in Node >= 20. + const filePath = path.join(file.path ?? 'node/lib', file.name); const text = fs.readFileSync(filePath, { encoding: 'utf8' }); const result = text.replace(/__MEDIASOUP_VERSION__/g, PKG.version);