* @param {string} srcDir * @param {string} dstDir * @param {string} dstLanguage * @returns {Promise }
(srcDir, dstDir, dstLanguage)
| 143 | * @returns {Promise<void>} |
| 144 | */ |
| 145 | async function syncTranslatedConfig(srcDir, dstDir, dstLanguage) { |
| 146 | const srcPath = path.join(srcDir, CROWIN_MKDOCS_CONFIG); |
| 147 | if (!(await fs.exists(srcPath))) { |
| 148 | throw new Error(`Did not find the translated MkDocs config at '${srcPath}'`); |
| 149 | } |
| 150 | const configFileName = ORIGINAL_MKDOCS_CONFIG(dstLanguage); |
| 151 | if (!(await validateYaml(srcPath))) { |
| 152 | log.warn(`Skipping the corrupted translated MkDocs config '${configFileName}'`); |
| 153 | return; |
| 154 | } |
| 155 | |
| 156 | const dstPath = path.join(dstDir, configFileName); |
| 157 | log.info(`Synchronizing '${dstPath}'`); |
| 158 | await fs.mv(srcPath, dstPath); |
| 159 | } |
| 160 | |
| 161 | async function main() { |
| 162 | const buildId = await buildTranslations(); |
no test coverage detected