Skip to content

Commit

Permalink
Refactor copyRecursive function to handle excluded directories
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zanhk committed Sep 16, 2023
1 parent f0024a6 commit be8b4c8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit be8b4c8

Please sign in to comment.