utiller 1.0.291 → 1.0.292
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.
|
@@ -120,11 +120,13 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
120
120
|
key: "findSpecificFolderByPath",
|
|
121
121
|
value: function findSpecificFolderByPath(path, folderName) {
|
|
122
122
|
var absolute = _path5["default"].resolve(path);
|
|
123
|
-
var
|
|
124
|
-
while (
|
|
125
|
-
|
|
123
|
+
var parts = absolute.split(_path5["default"].sep);
|
|
124
|
+
while (parts.length) {
|
|
125
|
+
var joined = _path5["default"].join.apply(_path5["default"], (0, _toConsumableArray2["default"])(parts).concat([folderName]));
|
|
126
|
+
if (_fs["default"].existsSync(joined)) return joined;
|
|
127
|
+
parts.pop();
|
|
126
128
|
}
|
|
127
|
-
return
|
|
129
|
+
return null;
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
/** {numpages, numrender, info, text, version} */
|
|
@@ -593,10 +595,10 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
593
595
|
}, {
|
|
594
596
|
key: "getNamesOfFolderChild",
|
|
595
597
|
value: function getNamesOfFolderChild(path) {
|
|
596
|
-
return
|
|
597
|
-
return
|
|
598
|
-
}).map(function (
|
|
599
|
-
return
|
|
598
|
+
return this.getChildPathByPath(path).filter(function (p) {
|
|
599
|
+
return p.isDirectory;
|
|
600
|
+
}).map(function (p) {
|
|
601
|
+
return p.dirName;
|
|
600
602
|
});
|
|
601
603
|
}
|
|
602
604
|
|
|
@@ -650,7 +652,7 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
650
652
|
}, {
|
|
651
653
|
key: "isImageFile",
|
|
652
654
|
value: function isImageFile(file) {
|
|
653
|
-
return
|
|
655
|
+
return ["svg", "png", "jpg", "jpeg"].includes(file.extension);
|
|
654
656
|
}
|
|
655
657
|
|
|
656
658
|
/** 把內容都抹掉each 是 fileName, ex:index.js*/
|
|
@@ -1841,15 +1843,15 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
1841
1843
|
/**
|
|
1842
1844
|
* from, destination
|
|
1843
1845
|
*
|
|
1844
|
-
* 讓file content清除後,在寫入資料, 避免
|
|
1846
|
+
* 讓file content清除後,在寫入資料, 避免to(destination) file address改變*/
|
|
1845
1847
|
)
|
|
1846
1848
|
}, {
|
|
1847
1849
|
key: "rewriteFile2File",
|
|
1848
|
-
value: function rewriteFile2File(from,
|
|
1850
|
+
value: function rewriteFile2File(from, to) {
|
|
1849
1851
|
var content = this.getFileContextInRaw(from);
|
|
1850
|
-
if (
|
|
1851
|
-
this.appendFile(
|
|
1852
|
-
this.appendInfo("rewrite from:".concat(from, " =>
|
|
1852
|
+
if (!content.trim()) throw new _index2["default"](9999, "".concat(from, " \u70BA\u7A7A\uFF0C\u907F\u514D\u8986\u84CB"));
|
|
1853
|
+
this.appendFile(to, content, true, true);
|
|
1854
|
+
this.appendInfo("rewrite from:".concat(from, " => to:").concat(to, " \u6210\u529F"));
|
|
1853
1855
|
}
|
|
1854
1856
|
|
|
1855
1857
|
/** 取得file第一行statement */
|
package/package.json
CHANGED