Skip to content

Commit c5c36ba

Browse files
committed
fix: convert if/else logic to reduce nested if level
1 parent 7524cd6 commit c5c36ba

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/file-util.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,11 @@ export function copyModuleContents(directory: string, tmpDir: string, baseDirect
4444
fs.mkdirSync(newDir, { recursive: true });
4545
// Note: Important we pass the original base directory.
4646
copyModuleContents(filePath, newDir, baseDir); // Recursion for directory contents
47-
} else {
47+
} else if (!shouldExcludeFile(baseDir, filePath, config.moduleAssetExcludePatterns)) {
4848
// Handle file copying
49-
if (!shouldExcludeFile(baseDir, filePath, config.moduleAssetExcludePatterns)) {
50-
fs.copyFileSync(filePath, path.join(tmpDir, file));
51-
} else {
52-
info(`Excluding file: ${filePath}`);
53-
}
49+
fs.copyFileSync(filePath, path.join(tmpDir, file));
50+
} else {
51+
info(`Excluding file: ${filePath}`);
5452
}
5553
}
56-
}
54+
}

0 commit comments

Comments
 (0)