@enplug/scripts 1.11.4-dev12 → 1.11.4-dev14
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.
|
@@ -118,7 +118,7 @@ function generateFormData(crowdinPath, localPath) {
|
|
|
118
118
|
return formData;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
function postFileToCrowdin(
|
|
121
|
+
function postFileToCrowdin(credentials, crowdinPath, localPath) {
|
|
122
122
|
const AuthStr = 'Bearer '.concat(credentials.token);
|
|
123
123
|
const formData = generateFormData(crowdinPath, localPath);
|
|
124
124
|
|
|
@@ -172,15 +172,15 @@ async function uploadFileToCrowdinStorage(credentials, crowdinPath, localPath) {
|
|
|
172
172
|
throw new Error('Local file does not exist');
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
return postFileToCrowdin(
|
|
175
|
+
return postFileToCrowdin(credentials, crowdinPath, localPath).pipe(
|
|
176
176
|
catchError(error => {
|
|
177
|
-
if (error.response.status === HTTP_NOT_FOUND_STATUS_CODE) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
177
|
+
// if (error.response.status === HTTP_NOT_FOUND_STATUS_CODE) {
|
|
178
|
+
// return promptAddFile(crowdinPath).pipe(
|
|
179
|
+
// filter(({addFileConfirm}) => addFileConfirm === true),
|
|
180
|
+
// switchMap(() => postFileToCrowdin(credentials, crowdinPath, localPath))
|
|
181
|
+
// );
|
|
182
|
+
// }
|
|
183
|
+
console('ERROR could not upload file to crowdin storage')
|
|
184
184
|
return throwError(error);
|
|
185
185
|
}),
|
|
186
186
|
tap({
|
|
@@ -62,17 +62,15 @@ async function syncTranslations(s3Client, bucket) {
|
|
|
62
62
|
|
|
63
63
|
if (isProduction) {
|
|
64
64
|
const appDirectoryId = await findCrowdinAppDirectoryId(credentials, config.crowdinPath);
|
|
65
|
-
console.log('found directoryId', appDirectoryId);
|
|
66
65
|
if(config.crowdinPath.includes('apps')) {
|
|
67
66
|
const path = config.crowdinPath.startsWith('/') ? config.crowdinPath.substr(1) : config.crowdinPath;
|
|
68
67
|
const subfolderName = path.split('/')[2];
|
|
69
68
|
const folderId = await findCrowdinAppSubFolderId(credentials, appDirectoryId, subfolderName);
|
|
70
|
-
console.log('found folderId', folderId);
|
|
71
69
|
const fileId = await getFileIdIfExists(credentials, folderId, path.split('/')[3]);
|
|
72
|
-
|
|
73
|
-
const storageId = await uploadFileToCrowdinStorage(credentials, config.crowdinPath, config.localPath)
|
|
70
|
+
const storageId = await uploadFileToCrowdinStorage(credentials, config.crowdinPath, config.localPath);
|
|
74
71
|
if(fileId) {
|
|
75
|
-
await updateCrowdinFile(credentials, storageId, fileId);
|
|
72
|
+
const response = await updateCrowdinFile(credentials, storageId.data.data.id, fileId);
|
|
73
|
+
console.log('response', response.data);
|
|
76
74
|
}
|
|
77
75
|
} else {
|
|
78
76
|
// TODO Update dashboard transtlations file
|