@enplug/scripts 1.11.4-dev33 → 1.11.4-dev35
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const axios = require('axios');
|
|
2
2
|
const chalk = require('chalk');
|
|
3
3
|
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
4
5
|
const FormData = require('form-data');
|
|
5
6
|
const inquirer = require('inquirer');
|
|
6
7
|
const loadDevPrivateFile = require('../loadDevPrivateFile');
|
|
7
8
|
const rootPath = __dirname.split('node_modules')[0];
|
|
8
9
|
const getPackageJson = require('../getPackageJson');
|
|
9
|
-
const Blob = require('buffer');
|
|
10
10
|
|
|
11
11
|
const { from, throwError } = require('rxjs');
|
|
12
12
|
const { catchError, switchMap, tap, filter } = require('rxjs/operators');
|
|
@@ -110,17 +110,20 @@ function getCrowdinConfig() {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
function generateFormData(crowdinPath, localPath) {
|
|
113
|
-
|
|
114
|
-
const formData = new FormData();
|
|
113
|
+
|
|
115
114
|
console.log('localPath', localPath);
|
|
116
|
-
|
|
115
|
+
|
|
116
|
+
let filePath = path.join(__dirname, localPath);
|
|
117
|
+
let fileData = fs.readFileSync(filePath);
|
|
118
|
+
console.log('fileData', fileData);
|
|
119
|
+
console.log(fileData.slice(0, 100));
|
|
120
|
+
let formData = new FormData();
|
|
121
|
+
let file = fs.readFileSync(localPath);
|
|
117
122
|
console.log('file', file);
|
|
118
|
-
|
|
119
|
-
// formData.append('
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
// formData.append(`export_patterns[${crowdinPath}]`, '%locale%.json');
|
|
123
|
-
return formData;
|
|
123
|
+
console.log(file.slice(0, 100));
|
|
124
|
+
// formData.append('file', file, 'en.json');
|
|
125
|
+
|
|
126
|
+
return fileData;
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
function postFileToCrowdin(credentials, crowdinPath, localPath) {
|
|
@@ -128,7 +131,7 @@ function generateFormData(crowdinPath, localPath) {
|
|
|
128
131
|
const formData = generateFormData(crowdinPath, localPath);
|
|
129
132
|
|
|
130
133
|
const url = `${CROWDIN_STORAGE_URL}`;
|
|
131
|
-
console.log('formData', formData);
|
|
134
|
+
// console.log('formData', formData);
|
|
132
135
|
return axios.post(url, formData, { headers: {
|
|
133
136
|
"Authorization": AuthStr,
|
|
134
137
|
"Content-Type": 'application/json',
|