@enplug/scripts 1.11.4-dev13 → 1.11.4-dev15
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.
|
@@ -162,7 +162,6 @@ async function getFileIdIfExists(credentials, directoryId, fileName) {
|
|
|
162
162
|
const AuthStr = 'Bearer '.concat(credentials.token);
|
|
163
163
|
const resp = await axios.get(url, { headers: { Authorization: AuthStr } });
|
|
164
164
|
const file = resp.data.data.find(d => d.data.name === fileName);
|
|
165
|
-
console.log('file found', file);
|
|
166
165
|
return file.data.id;
|
|
167
166
|
}
|
|
168
167
|
|
|
@@ -186,7 +185,6 @@ async function uploadFileToCrowdinStorage(credentials, crowdinPath, localPath) {
|
|
|
186
185
|
tap({
|
|
187
186
|
next: response => {
|
|
188
187
|
if (response.data) {
|
|
189
|
-
console.log('response.data', response.data);
|
|
190
188
|
console.log(`${chalk.green.bold('Translations uploaded to Crowdin')} ${chalk.yellow.bold(`[${crowdinPath}]`)}`);
|
|
191
189
|
} else {
|
|
192
190
|
console.error('Unexpected result');
|
|
@@ -212,6 +210,8 @@ async function uploadFileToCrowdinStorage(credentials, crowdinPath, localPath) {
|
|
|
212
210
|
}
|
|
213
211
|
|
|
214
212
|
function updateCrowdinFile(credentials, storageId, fileId) {
|
|
213
|
+
console.log('storageId', storageId);
|
|
214
|
+
console.log('fileId', fileId);
|
|
215
215
|
const url = `${CROWDIN_PROJECT_URL}/files/${fileId}`;
|
|
216
216
|
const AuthStr = 'Bearer '.concat(credentials.token);
|
|
217
217
|
const body = {
|
|
@@ -67,11 +67,10 @@ async function syncTranslations(s3Client, bucket) {
|
|
|
67
67
|
const subfolderName = path.split('/')[2];
|
|
68
68
|
const folderId = await findCrowdinAppSubFolderId(credentials, appDirectoryId, subfolderName);
|
|
69
69
|
const fileId = await getFileIdIfExists(credentials, folderId, path.split('/')[3]);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
await updateCrowdinFile(credentials, storageId.data.id, fileId);
|
|
70
|
+
const storageId = await uploadFileToCrowdinStorage(credentials, config.crowdinPath, config.localPath);
|
|
71
|
+
if(fileId && storageId) {
|
|
72
|
+
const response = await updateCrowdinFile(credentials, storageId.data.data.id, fileId);
|
|
73
|
+
console.log('response', response.data);
|
|
75
74
|
}
|
|
76
75
|
} else {
|
|
77
76
|
// TODO Update dashboard transtlations file
|