td-octopus 0.1.0 → 0.1.2
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.
- package/package.json +2 -2
- package/src/back/index.js +5 -2
- package/src/utils/translate.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "td-octopus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "I18N tool",
|
|
5
5
|
"author": "Anthony Li",
|
|
6
6
|
"bin": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"typescript": "^3.2.2",
|
|
26
26
|
"update-notifier": "^4.1.0",
|
|
27
27
|
"vue-template-compiler": "^2.6.14",
|
|
28
|
-
"xlsx": "
|
|
28
|
+
"xlsx": "0.12.2",
|
|
29
29
|
"yargs": "^15.3.1"
|
|
30
30
|
},
|
|
31
31
|
"keywords": [
|
package/src/back/index.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
const path = require('path')
|
|
9
9
|
const fs = require('fs')
|
|
10
|
-
const ts = require('typescript');
|
|
11
10
|
const shell = require('shelljs');
|
|
12
11
|
const { getSpecifiedFiles, isFile } = require('../utils/file')
|
|
13
12
|
const syncLang = require('../utils/syncLang')
|
|
@@ -15,6 +14,10 @@ const { flatObject } = require('../utils/translate');
|
|
|
15
14
|
const { failInfo, highlightText } = require('../utils/colors');
|
|
16
15
|
const { getProjectConfig } = require('../utils/index')
|
|
17
16
|
|
|
17
|
+
function formatExclude(exclude){
|
|
18
|
+
return (exclude || []).map(p => path.resolve(process.cwd(), p));
|
|
19
|
+
}
|
|
20
|
+
|
|
18
21
|
// 匹配I18N.
|
|
19
22
|
const I18N_REGEX = /I18N(\.[a-zA-Z0-9_]+)+/g
|
|
20
23
|
|
|
@@ -38,7 +41,7 @@ function getFilePaths() {
|
|
|
38
41
|
|
|
39
42
|
dirArr.forEach(i => {
|
|
40
43
|
const dirPath = path.resolve(process.cwd(), i);
|
|
41
|
-
const files = getSpecifiedFiles(dirPath)
|
|
44
|
+
const files = getSpecifiedFiles(dirPath, formatExclude(CONFIG.exclude))
|
|
42
45
|
filePaths = filePaths.concat(files)
|
|
43
46
|
})
|
|
44
47
|
|
package/src/utils/translate.js
CHANGED
|
@@ -299,7 +299,7 @@ function generateExcel(addList, path, lang) {
|
|
|
299
299
|
const excleData = [['需要翻译的字段', '中文', '百度翻译', '人工翻译'], ...addList];
|
|
300
300
|
|
|
301
301
|
const options = {
|
|
302
|
-
'!cols': [{ wpx: 100 }, { wpx: 100 }, { wpx: 100 }]
|
|
302
|
+
'!cols': [{ wpx: 100 }, { wpx: 100 }, { wpx: 100 }, { wpx: 100 }]
|
|
303
303
|
};
|
|
304
304
|
|
|
305
305
|
const worksheet = XLSX.utils.aoa_to_sheet(excleData);
|