* @returns {Promise }
(locale)
| 175 | * @returns {Promise<string[]>} |
| 176 | */ |
| 177 | async function getLocaleFiles(locale) { |
| 178 | /** @type {string[]} */ |
| 179 | const results = []; |
| 180 | |
| 181 | /** @type {(dir: string) => Promise<void>} */ |
| 182 | const walk = async (dir) => { |
| 183 | const entries = await fs.readdir(dir); |
| 184 | const matched = entries.filter((f) => f === `${locale}.config` || f.endsWith(`.${locale}.config`)); |
| 185 | results.push(...matched); |
| 186 | |
| 187 | for (const e of entries) { |
| 188 | const p = `${dir}/${e}`; |
| 189 | const stat = await fs.stat(p); |
| 190 | if (stat.isDirectory()) { |
| 191 | walk(p); |
| 192 | } |
| 193 | } |
| 194 | }; |
| 195 | |
| 196 | await walk(LOCALES_ROOT); |
| 197 | |
| 198 | return results; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * @param {string} text |
no test coverage detected