@enplug/scripts 1.11.4-dev7 → 1.11.4-dev9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -152,17 +152,18 @@ async function findCrowdinAppDirectoryId(credentials, crowdinPath) {
|
|
|
152
152
|
async function findCrowdinAppSubFolderId(credentials, directoryId, subfolderName) {
|
|
153
153
|
const url = `${CROWDIN_PROJECT_URL}/directories?directoryId=${directoryId}`;
|
|
154
154
|
const AuthStr = 'Bearer '.concat(credentials.token);
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return directories.data.data.find(d => d.data.name === subfolderName).id;
|
|
155
|
+
const resp = await axios.get(url, { headers: { Authorization: AuthStr } });
|
|
156
|
+
const subdirectory = resp.data.data.find(d => d.data.name === subfolderName)
|
|
157
|
+
return subdirectory.data.id;
|
|
159
158
|
}
|
|
160
159
|
|
|
161
160
|
async function getFileIdIfExists(credentials, directoryId, fileName) {
|
|
162
161
|
const url = `${CROWDIN_PROJECT_URL}/files?directoryId=${directoryId}`;
|
|
163
162
|
const AuthStr = 'Bearer '.concat(credentials.token);
|
|
164
|
-
const
|
|
165
|
-
|
|
163
|
+
const resp = await axios.get(url, { headers: { Authorization: AuthStr } });
|
|
164
|
+
const file = resp.data.find(d => d.data.name === fileName);
|
|
165
|
+
console.log('file found', file);
|
|
166
|
+
return file.data.id;
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
async function uploadFileToCrowdinStorage(credentials, crowdinPath, localPath) {
|
|
@@ -64,7 +64,7 @@ async function syncTranslations(s3Client, bucket) {
|
|
|
64
64
|
const appDirectoryId = await findCrowdinAppDirectoryId(credentials, config.crowdinPath);
|
|
65
65
|
console.log('found directoryId', appDirectoryId);
|
|
66
66
|
if(config.crowdinPath.includes('apps')) {
|
|
67
|
-
const path = crowdinPath.startsWith('/') ? crowdinPath.substr(1) : crowdinPath;
|
|
67
|
+
const path = config.crowdinPath.startsWith('/') ? config.crowdinPath.substr(1) : config.crowdinPath;
|
|
68
68
|
const subfolderName = path.split('/')[2];
|
|
69
69
|
const folderId = await findCrowdinAppSubFolderId(credentials, appDirectoryId, subfolderName);
|
|
70
70
|
console.log('found folderId', folderId);
|