fix: Ignore hidden files when traversing directories

This commit is contained in:
kangfenmao 2025-02-20 11:43:01 +08:00
parent c65d351a3d
commit 34a5b89754

View File

@ -18,6 +18,10 @@ export function getAllFiles(dirPath: string, arrayOfFiles: FileType[] = []): Fil
const files = fs.readdirSync(dirPath)
files.forEach((file) => {
if (file.startsWith('.')) {
return
}
const fullPath = path.join(dirPath, file)
if (fs.statSync(fullPath).isDirectory()) {
arrayOfFiles = getAllFiles(fullPath, arrayOfFiles)