* @param {string[]} matchedFiles * @returns {Promise >}
(matchedFiles)
| 138 | * @returns {Promise<Record<string, string>>} |
| 139 | */ |
| 140 | async function uploadDocumentsToStorage(matchedFiles) { |
| 141 | const resultMap = {}; |
| 142 | let count = 0; |
| 143 | for (const matchedFilePath of matchedFiles) { |
| 144 | const crowdinPath = toCrowdinPath(matchedFilePath); |
| 145 | // Hashing is used to make sure we always create the same storage for the same file path in Crowdin |
| 146 | const storageName = toHash(crowdinPath); |
| 147 | log.info(`Uploading '${crowdinPath}' to Crowdin storage (${++count} of ${matchedFiles.length})`); |
| 148 | const storageData = await addStorage(storageName, matchedFilePath, DOCUMENT_CONTENT_TYPE); |
| 149 | resultMap[matchedFilePath] = storageData.id; |
| 150 | } |
| 151 | return resultMap; |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * @param {string[]} matchedFiles |
no test coverage detected