From 5460c66223c67330678a9aaa5a2d37aea613334e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 17:31:51 +0100 Subject: [PATCH] chore(deps): bump fs-extra from 11.2.0 to 11.3.0 (#5380) --- .github/actions/check-public-api/index.js | 51 ++++++++++++++++------- packages/generator-common/package.json | 2 +- packages/generator/package.json | 2 +- test-packages/e2e-tests/package.json | 2 +- yarn.lock | 8 ++-- 5 files changed, 43 insertions(+), 22 deletions(-) diff --git a/.github/actions/check-public-api/index.js b/.github/actions/check-public-api/index.js index 088ba4e2a1..90ff22cde6 100644 --- a/.github/actions/check-public-api/index.js +++ b/.github/actions/check-public-api/index.js @@ -72048,7 +72048,17 @@ function mkDirAndCopy (srcMode, src, dest, opts) { } function copyDir (src, dest, opts) { - fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) + const dir = fs.opendirSync(src) + + try { + let dirent + + while ((dirent = dir.readSync()) !== null) { + copyDirItem(dirent.name, src, dest, opts) + } + } finally { + dir.closeSync() + } } function copyDirItem (item, src, dest, opts) { @@ -72224,23 +72234,28 @@ async function onDir (srcStat, destStat, src, dest, opts) { await fs.mkdir(dest) } - const items = await fs.readdir(src) + const promises = [] // loop through the files in the current directory to copy everything - await Promise.all(items.map(async item => { - const srcItem = path.join(src, item) - const destItem = path.join(dest, item) - - // skip the item if it is matches by the filter function - const include = await runFilter(srcItem, destItem, opts) - if (!include) return - - const { destStat } = await stat.checkPaths(srcItem, destItem, 'copy', opts) + for await (const item of await fs.opendir(src)) { + const srcItem = path.join(src, item.name) + const destItem = path.join(dest, item.name) + + promises.push( + runFilter(srcItem, destItem, opts).then(include => { + if (include) { + // only copy the item if it matches the filter function + return stat.checkPaths(srcItem, destItem, 'copy', opts).then(({ destStat }) => { + // If the item is a copyable file, `getStatsAndPerformCopy` will copy it + // If the item is a directory, `getStatsAndPerformCopy` will call `onDir` recursively + return getStatsAndPerformCopy(destStat, srcItem, destItem, opts) + }) + } + }) + ) + } - // If the item is a copyable file, `getStatsAndPerformCopy` will copy it - // If the item is a directory, `getStatsAndPerformCopy` will call `onDir` recursively - return getStatsAndPerformCopy(destStat, srcItem, destItem, opts) - })) + await Promise.all(promises) if (!destStat) { await fs.chmod(dest, srcStat.mode) @@ -72772,6 +72787,7 @@ const api = [ 'chown', 'close', 'copyFile', + 'cp', 'fchmod', 'fchown', 'fdatasync', @@ -72779,8 +72795,10 @@ const api = [ 'fsync', 'ftruncate', 'futimes', + 'glob', 'lchmod', 'lchown', + 'lutimes', 'link', 'lstat', 'mkdir', @@ -72795,6 +72813,7 @@ const api = [ 'rm', 'rmdir', 'stat', + 'statfs', 'symlink', 'truncate', 'unlink', @@ -72803,6 +72822,8 @@ const api = [ ].filter(key => { // Some commands are not available on some systems. Ex: // fs.cp was added in Node.js v16.7.0 + // fs.statfs was added in Node v19.6.0, v18.15.0 + // fs.glob was added in Node.js v22.0.0 // fs.lchown is not available on at least some Linux return typeof fs[key] === 'function' }) diff --git a/packages/generator-common/package.json b/packages/generator-common/package.json index 81fa26cb21..f3dfd91481 100644 --- a/packages/generator-common/package.json +++ b/packages/generator-common/package.json @@ -38,7 +38,7 @@ "dependencies": { "@sap-cloud-sdk/util": "^3.24.0", "fast-levenshtein": "~3.0.0", - "fs-extra": "^11.2.0", + "fs-extra": "^11.3.0", "glob": "^11.0.1", "typescript": "~5.7.3", "prettier": "^3.4.2", diff --git a/packages/generator/package.json b/packages/generator/package.json index a5e03edfa0..a0f29541bf 100644 --- a/packages/generator/package.json +++ b/packages/generator/package.json @@ -46,7 +46,7 @@ "@sap-cloud-sdk/util": "^3.24.0", "@types/fs-extra": "^11.0.4", "fast-xml-parser": "^4.5.1", - "fs-extra": "^11.2.0", + "fs-extra": "^11.3.0", "ts-morph": "^25.0.0", "typescript": "~5.7.3", "voca": "^1.4.1", diff --git a/test-packages/e2e-tests/package.json b/test-packages/e2e-tests/package.json index 1e73704080..ddad65c918 100644 --- a/test-packages/e2e-tests/package.json +++ b/test-packages/e2e-tests/package.json @@ -39,7 +39,7 @@ "axios": "^1.7.9", "execa": "^5.0.0", "express": "^4.21.2", - "fs-extra": "^11.2.0", + "fs-extra": "^11.3.0", "http-proxy-middleware": "^3.0.3", "json-schema-faker": "^0.5.8", "mock-fs": "^5.3.0", diff --git a/yarn.lock b/yarn.lock index 8cff7887fa..228bd4fa90 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4832,10 +4832,10 @@ fs-constants@^1.0.0: resolved "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@^11.2.0: - version "11.2.0" - resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b" - integrity sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw== +fs-extra@^11.2.0, fs-extra@^11.3.0: + version "11.3.0" + resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz#0daced136bbaf65a555a326719af931adc7a314d" + integrity sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew== dependencies: graceful-fs "^4.2.0" jsonfile "^6.0.1"