fast-cocos 1.0.3 → 1.0.5
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/dist/utils.js +7 -7
- package/dist/xlsx/src/XlsxParser.js +7 -0
- package/package.json +1 -1
package/dist/utils.js
CHANGED
|
@@ -11,8 +11,8 @@ var utils;
|
|
|
11
11
|
(function (utils) {
|
|
12
12
|
/**
|
|
13
13
|
* 创建目录
|
|
14
|
-
* @param
|
|
15
|
-
|
|
14
|
+
* @param dir 目录
|
|
15
|
+
*/
|
|
16
16
|
function mkdir(dir) {
|
|
17
17
|
if (!fs_1.default.existsSync(dir)) {
|
|
18
18
|
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
@@ -21,8 +21,8 @@ var utils;
|
|
|
21
21
|
utils.mkdir = mkdir;
|
|
22
22
|
/**
|
|
23
23
|
* 删除目录
|
|
24
|
-
* @param
|
|
25
|
-
|
|
24
|
+
* @param dir 目录
|
|
25
|
+
*/
|
|
26
26
|
function rmdir(dir) {
|
|
27
27
|
if (fs_1.default.existsSync(dir)) {
|
|
28
28
|
fs_1.default.rmSync(dir, { recursive: true });
|
|
@@ -31,7 +31,7 @@ var utils;
|
|
|
31
31
|
utils.rmdir = rmdir;
|
|
32
32
|
/**
|
|
33
33
|
* 获取所有子目录
|
|
34
|
-
* @param
|
|
34
|
+
* @param dir 目录
|
|
35
35
|
*/
|
|
36
36
|
function getSubDirsSync(dir) {
|
|
37
37
|
const subDirs = [];
|
|
@@ -48,7 +48,7 @@ var utils;
|
|
|
48
48
|
utils.getSubDirsSync = getSubDirsSync;
|
|
49
49
|
/**
|
|
50
50
|
* 指定目录中是否包含指定文件扩展名
|
|
51
|
-
* @param
|
|
51
|
+
* @param dir 路径
|
|
52
52
|
* @param {string} ext 文件扩展名,如 ".png"
|
|
53
53
|
*/
|
|
54
54
|
function containsFileExt(dir, ext) {
|
|
@@ -60,7 +60,7 @@ var utils;
|
|
|
60
60
|
utils.containsFileExt = containsFileExt;
|
|
61
61
|
/**
|
|
62
62
|
* 获取文件大小
|
|
63
|
-
* @param
|
|
63
|
+
* @param filePath 文件路径
|
|
64
64
|
*/
|
|
65
65
|
function getFileSize(filePath) {
|
|
66
66
|
const stats = fs_1.default.statSync(filePath);
|
|
@@ -110,6 +110,7 @@ class XlsxParser {
|
|
|
110
110
|
break;
|
|
111
111
|
case SheetType.Array:
|
|
112
112
|
if (sheetInfo.firstColumnMergedArray) {
|
|
113
|
+
console.info("\x1b[36m%s\x1b[0m", "解析首列合并行数组: " + name);
|
|
113
114
|
this.parseFirstColumnMergedArray(sheetInfo);
|
|
114
115
|
}
|
|
115
116
|
else {
|
|
@@ -577,6 +578,8 @@ class XlsxParser {
|
|
|
577
578
|
json[sheetName] = require(filePath);
|
|
578
579
|
});
|
|
579
580
|
this.writeFileSync(this.options["xlsx.json"], json);
|
|
581
|
+
const tmpJsonPath = path_1.default.join(this.options.tmpDir, "config", "xlsx.json");
|
|
582
|
+
this.writeFileSync(tmpJsonPath, json);
|
|
580
583
|
}
|
|
581
584
|
/**
|
|
582
585
|
* 写json文件到本地
|
|
@@ -622,6 +625,8 @@ class XlsxParser {
|
|
|
622
625
|
});
|
|
623
626
|
declareStr += `\n}\n`;
|
|
624
627
|
this.writeFileSync(this.options["xlsx.sheet.d.ts"], declareStr);
|
|
628
|
+
const tmpSheetDtsPath = path_1.default.join(this.options.tmpDir, "config", "xlsx.sheet.d.ts");
|
|
629
|
+
this.writeFileSync(tmpSheetDtsPath, declareStr);
|
|
625
630
|
// xlsx.ts
|
|
626
631
|
const jsonDir = path_1.default.join(this.options.tmpDir);
|
|
627
632
|
const templatePath = path_1.default.join(this.options.execDir, "template", "xlsx.txt");
|
|
@@ -648,6 +653,8 @@ class XlsxParser {
|
|
|
648
653
|
scriptStr = scriptStr.replace("{0}", propertyStr);
|
|
649
654
|
scriptStr = scriptStr.replace("{1}", assignStr);
|
|
650
655
|
this.writeFileSync(this.options["xlsx.ts"], scriptStr);
|
|
656
|
+
const tmpTsPath = path_1.default.join(this.options.tmpDir, "config", "xlsx.ts");
|
|
657
|
+
this.writeFileSync(tmpTsPath, scriptStr);
|
|
651
658
|
}
|
|
652
659
|
}
|
|
653
660
|
exports.default = XlsxParser;
|