@enplug/scripts 1.11.4-dev12 → 1.11.4-dev13
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,20 +172,21 @@ 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({
|
|
187
187
|
next: response => {
|
|
188
188
|
if (response.data) {
|
|
189
|
+
console.log('response.data', response.data);
|
|
189
190
|
console.log(`${chalk.green.bold('Translations uploaded to Crowdin')} ${chalk.yellow.bold(`[${crowdinPath}]`)}`);
|
|
190
191
|
} else {
|
|
191
192
|
console.error('Unexpected result');
|
|
@@ -62,17 +62,16 @@ 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
70
|
console.log('found fileId', fileId);
|
|
73
71
|
const storageId = await uploadFileToCrowdinStorage(credentials, config.crowdinPath, config.localPath)
|
|
72
|
+
console.log('storageId', storageId);
|
|
74
73
|
if(fileId) {
|
|
75
|
-
await updateCrowdinFile(credentials, storageId, fileId);
|
|
74
|
+
await updateCrowdinFile(credentials, storageId.data.id, fileId);
|
|
76
75
|
}
|
|
77
76
|
} else {
|
|
78
77
|
// TODO Update dashboard transtlations file
|