fast-cocos 1.0.4 → 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 +6 -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);
|
|
@@ -578,6 +578,8 @@ class XlsxParser {
|
|
|
578
578
|
json[sheetName] = require(filePath);
|
|
579
579
|
});
|
|
580
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);
|
|
581
583
|
}
|
|
582
584
|
/**
|
|
583
585
|
* 写json文件到本地
|
|
@@ -623,6 +625,8 @@ class XlsxParser {
|
|
|
623
625
|
});
|
|
624
626
|
declareStr += `\n}\n`;
|
|
625
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);
|
|
626
630
|
// xlsx.ts
|
|
627
631
|
const jsonDir = path_1.default.join(this.options.tmpDir);
|
|
628
632
|
const templatePath = path_1.default.join(this.options.execDir, "template", "xlsx.txt");
|
|
@@ -649,6 +653,8 @@ class XlsxParser {
|
|
|
649
653
|
scriptStr = scriptStr.replace("{0}", propertyStr);
|
|
650
654
|
scriptStr = scriptStr.replace("{1}", assignStr);
|
|
651
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);
|
|
652
658
|
}
|
|
653
659
|
}
|
|
654
660
|
exports.default = XlsxParser;
|