From be8b4c824ef3cb5729d4dc7414e882498ac4dd5b Mon Sep 17 00:00:00 2001 From: zank Date: Sun, 17 Sep 2023 00:18:23 +0200 Subject: [PATCH] Refactor copyRecursive function to handle excluded directories The copyRecursive function in cli.js has been refactored to properly handle excluded directories. Previously, the function would skip over excluded directories regardless of whether they were actually directories or not. Now, the function checks if the source is a directory before checking if it is excluded, ensuring that only actual directories are skipped if they are in the exclusions list. --- bin/cli.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index 683fa94..06c3d02 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -233,9 +233,10 @@ async function copyRecursive(src, dest) { try { const stats = await fs.stat(src); const isDirectory = stats.isDirectory(); - const isExcluded = exclusions.includes(path.basename(src)); - - if (isExcluded) return; + if (isDirectory) { + const isExcluded = exclusions.includes(path.basename(src)); + if (isExcluded) return; + } if (isDirectory) { await fs.mkdir(dest, { recursive: true });