pug-site-core 2.0.15 → 2.0.16
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/lib/generate.js +12 -2
- package/package.json +3 -3
package/lib/generate.js
CHANGED
|
@@ -272,7 +272,7 @@ export async function fetchDataToJsonFile(args) {
|
|
|
272
272
|
return Promise.reject(new Error(obj.getDataFn + "获取数据函数不存在"));
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
if (
|
|
275
|
+
if (!isFillFun(obj.getDataFn)) {
|
|
276
276
|
continue;
|
|
277
277
|
}
|
|
278
278
|
|
|
@@ -282,6 +282,13 @@ export async function fetchDataToJsonFile(args) {
|
|
|
282
282
|
await checkData(data, language, obj.getDataFn);
|
|
283
283
|
let outPutPath = obj.outPutPath.split("/").join(pathSymbol);
|
|
284
284
|
if (Array.isArray(data)) {
|
|
285
|
+
await fse.remove(
|
|
286
|
+
paths.resolveRoot(
|
|
287
|
+
"jsonData",
|
|
288
|
+
language,
|
|
289
|
+
...outPutPath.split(pathSymbol).slice(0, -1)
|
|
290
|
+
)
|
|
291
|
+
);
|
|
285
292
|
let name = outPutPath.split(pathSymbol).pop().replace(/\..*$/, "");
|
|
286
293
|
const regex = /^\[.+\]$/;
|
|
287
294
|
if (regex.test(name)) {
|
|
@@ -321,7 +328,7 @@ export async function fetchDataToJsonFile(args) {
|
|
|
321
328
|
return Promise.reject(new Error(`${funName} 获取数据函数不存在`));
|
|
322
329
|
}
|
|
323
330
|
|
|
324
|
-
if (
|
|
331
|
+
if (!isFillFun(funName)) {
|
|
325
332
|
continue;
|
|
326
333
|
}
|
|
327
334
|
|
|
@@ -330,6 +337,9 @@ export async function fetchDataToJsonFile(args) {
|
|
|
330
337
|
let data = await getData[funName](language);
|
|
331
338
|
await checkData(data, language, funName);
|
|
332
339
|
if (Array.isArray(data)) {
|
|
340
|
+
await fse.remove(
|
|
341
|
+
paths.resolveRoot("jsonData", language, ...jsonFilePath.slice(0, -1))
|
|
342
|
+
);
|
|
333
343
|
await async.eachLimit(data, 12, async (item, index) => {
|
|
334
344
|
let lastJsonFilePath;
|
|
335
345
|
if (item.page_name) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pug-site-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.16",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"dev": "nodemon --
|
|
7
|
+
"dev": "nodemon --ignore jsonData/ --ignore node_modules/ --ignore template/ --ext js index.js",
|
|
8
8
|
"getData": "node index.js",
|
|
9
9
|
"getFun": "node index.js",
|
|
10
10
|
"compileFn": "node index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"imagemin-svgo": "^10.0.1"
|
|
46
46
|
},
|
|
47
47
|
"license": "ISC",
|
|
48
|
-
"description": "
|
|
48
|
+
"description": "修复带getData排除函数参数时无法删掉以前json文件问题、优化代码",
|
|
49
49
|
"files": [
|
|
50
50
|
"lib/",
|
|
51
51
|
"index.js"
|