@enplug/scripts 1.11.4-dev23 → 1.11.4-dev25
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.
|
@@ -126,12 +126,12 @@ async function postFileToCrowdin(credentials, crowdinPath, localPath) {
|
|
|
126
126
|
const formData = await generateFormData(crowdinPath, localPath);
|
|
127
127
|
|
|
128
128
|
const url = `${CROWDIN_STORAGE_URL}`;
|
|
129
|
-
|
|
130
|
-
return
|
|
129
|
+
console.log('formData', formData);
|
|
130
|
+
return axios.post(url, formData, { headers: {
|
|
131
131
|
"Authorization": AuthStr,
|
|
132
132
|
"Content-Type": "application/json",
|
|
133
133
|
"Crowdin-API-FileName": "en.json"
|
|
134
|
-
} })
|
|
134
|
+
} });
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
async function findCrowdinAppDirectoryId(credentials, crowdinPath) {
|
|
@@ -174,42 +174,44 @@ async function uploadFileToCrowdinStorage(credentials, crowdinPath, localPath) {
|
|
|
174
174
|
throw new Error('Local file does not exist');
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
177
|
+
const response = await postFileToCrowdin(credentials, crowdinPath, localPath)
|
|
178
|
+
return response
|
|
179
|
+
// return postFileToCrowdin(credentials, crowdinPath, localPath).pipe(
|
|
180
|
+
// catchError(error => {
|
|
181
|
+
// // if (error.response.status === HTTP_NOT_FOUND_STATUS_CODE) {
|
|
182
|
+
// // return promptAddFile(crowdinPath).pipe(
|
|
183
|
+
// // filter(({addFileConfirm}) => addFileConfirm === true),
|
|
184
|
+
// // switchMap(() => postFileToCrowdin(credentials, crowdinPath, localPath))
|
|
185
|
+
// // );
|
|
186
|
+
// // }
|
|
187
|
+
// console('ERROR could not upload file to crowdin storage')
|
|
188
|
+
// return throwError(error);
|
|
189
|
+
// }),
|
|
190
|
+
// tap({
|
|
191
|
+
// next: response => {
|
|
192
|
+
// if (response.data) {
|
|
193
|
+
// console.log(`${chalk.green.bold('Translations uploaded to Crowdin')} ${chalk.yellow.bold(`[${crowdinPath}]`)}`);
|
|
194
|
+
// } else {
|
|
195
|
+
// console.error('Unexpected result');
|
|
196
|
+
// console.log(response);
|
|
197
|
+
// }
|
|
198
|
+
// },
|
|
199
|
+
// error: error => {
|
|
200
|
+
// const crowdinError = error.response && error.response.data && error.response.data.error;
|
|
199
201
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
).toPromise();
|
|
202
|
+
// if (crowdinError && crowdinError.code === CROWDIN_DIRECTORY_NOT_FOUND_ERROR_CODE) {
|
|
203
|
+
// console.error(`\n${chalk.red.bold('Directory does not exist')} ${chalk.yellow.bold(`[${crowdinPath}]`)}`);
|
|
204
|
+
// console.log('Create the directory in the Crowdin panel first.');
|
|
205
|
+
// } else if (error.response.status === HTTP_UNAUTHORIZED_STATUS_CODE) {
|
|
206
|
+
// console.error(`\n${chalk.red.bold('Provided Crowdin credentials are incorrect')}`);
|
|
207
|
+
// console.log(`Check the ${chalk.default.yellow('dev.private.json')} file.`);
|
|
208
|
+
// } else {
|
|
209
|
+
// console.error('\nUnexpected error:');
|
|
210
|
+
// console.error(error);
|
|
211
|
+
// }
|
|
212
|
+
// }
|
|
213
|
+
// })
|
|
214
|
+
// ).toPromise();
|
|
213
215
|
}
|
|
214
216
|
|
|
215
217
|
function updateCrowdinFile(credentials, storageId, fileId) {
|