Skip to content

Commit 6e9d020

Browse files
committed
fix: add check for directory before recursive call
1 parent f01b0aa commit 6e9d020

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/scripts/crowdin/import/utils.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { copyFileSync, existsSync, mkdirSync, readdirSync } from "fs"
1+
import { copyFileSync, existsSync, mkdirSync, readdirSync, statSync } from "fs"
22
import { join } from "path"
33

44
import i18Config from "../../../../i18n.config.json"
@@ -45,9 +45,7 @@ export const scrapeDirectory = (
4545
copyFileSync(source, jsonDestinationPath)
4646
// Update .json tracker
4747
trackers.langs[repoLangCode].jsonCopyCount++
48-
} else if (
49-
item.endsWith(".md")
50-
) {
48+
} else if (item.endsWith(".md")) {
5149
const mdDestDirPath: string = join(
5250
TRANSLATIONS_DIR,
5351
repoLangCode,
@@ -60,6 +58,7 @@ export const scrapeDirectory = (
6058
// Update .md tracker
6159
trackers.langs[repoLangCode].mdCopyCount++
6260
} else {
61+
if (!statSync(source).isDirectory()) return
6362
// If another directory, recursively call `scrapeDirectory`
6463
scrapeDirectory(
6564
`${path}/${item}`,

0 commit comments

Comments
 (0)