* @param {string} codeDir * @param {Array } scannedFiles * @param {Array } excludeFiles * @returns {Promise >}
(codeDir = "", scannedFiles = [], excludeFiles = [])
| 71 | * @returns {Promise<Array<string>>} |
| 72 | */ |
| 73 | async function scanCodeFiles(codeDir = "", scannedFiles = [], excludeFiles = []) { |
| 74 | const codeFiles = fs.readdirSync(codeDir); |
| 75 | for (const codeFile of codeFiles) { |
| 76 | const codeFilePath = path.join(codeDir, codeFile); |
| 77 | if (excludeFiles.some((excludeFile) => codeFilePath.includes(excludeFile))) continue; |
| 78 | try { |
| 79 | if (fs.statSync(codeFilePath).isDirectory()) { |
| 80 | await scanCodeFiles(codeFilePath, scannedFiles, excludeFiles); |
| 81 | } else { |
| 82 | if (INCLUDE_EXT_NAMES.includes(path.extname(codeFilePath))) { |
| 83 | scannedFiles.push(codeFilePath); |
| 84 | } |
| 85 | } |
| 86 | } catch (error) { |
| 87 | // ignore |
| 88 | } |
| 89 | } |
| 90 | return scannedFiles; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * @param {Map<string, boolean>} langKeys |