pug-site-core 1.0.12 → 1.0.13
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/index.js +2 -2
- package/lib/generate.js +18 -18
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
compilePagesPugToFn,
|
|
6
6
|
fetchDataToJsonFile,
|
|
7
7
|
buildFn,
|
|
8
|
-
buildStatic
|
|
8
|
+
buildStatic,
|
|
9
9
|
} from "./lib/generate.js";
|
|
10
10
|
|
|
11
11
|
export const pugSiteCore = {
|
|
@@ -15,7 +15,7 @@ export const pugSiteCore = {
|
|
|
15
15
|
fetchDataToJsonFile,
|
|
16
16
|
buildFn,
|
|
17
17
|
buildStatic,
|
|
18
|
-
translateLanguageData
|
|
18
|
+
translateLanguageData,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
// let curCmd = process.env.npm_lifecycle_event;
|
package/lib/generate.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
sleep,
|
|
8
8
|
pagesPathFilter,
|
|
9
9
|
pathSymbol,
|
|
10
|
-
obfuscateJavaScript
|
|
10
|
+
obfuscateJavaScript,
|
|
11
11
|
} from "./utils.js";
|
|
12
12
|
import _ from "lodash";
|
|
13
13
|
import async from "async";
|
|
@@ -57,7 +57,7 @@ export async function compilePagesPugToFn(pugPath) {
|
|
|
57
57
|
basedir: paths.template.root,
|
|
58
58
|
compileDebug: true,
|
|
59
59
|
name: funName,
|
|
60
|
-
filters: getCompilePugFilter()
|
|
60
|
+
filters: getCompilePugFilter(),
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// 提取函数定义部分
|
|
@@ -408,12 +408,12 @@ export async function buildFn() {
|
|
|
408
408
|
totalCommonData[lang] = commonData;
|
|
409
409
|
});
|
|
410
410
|
|
|
411
|
-
await fse.copy(jsonDataPath, paths.resolveRoot(outputPath, "data"), {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
});
|
|
411
|
+
// await fse.copy(jsonDataPath, paths.resolveRoot(outputPath, "data"), {
|
|
412
|
+
// filter: (src, dest) => {
|
|
413
|
+
// // 排除_common.json 文件
|
|
414
|
+
// return !src.endsWith("_common.json");
|
|
415
|
+
// }
|
|
416
|
+
// });
|
|
417
417
|
|
|
418
418
|
await fse.copy(
|
|
419
419
|
paths.template.static,
|
|
@@ -432,7 +432,7 @@ export async function buildFn() {
|
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
return true;
|
|
435
|
-
}
|
|
435
|
+
},
|
|
436
436
|
}
|
|
437
437
|
);
|
|
438
438
|
|
|
@@ -485,7 +485,7 @@ export async function buildStatic() {
|
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
return true;
|
|
488
|
-
}
|
|
488
|
+
},
|
|
489
489
|
}
|
|
490
490
|
);
|
|
491
491
|
|
|
@@ -581,11 +581,11 @@ export async function buildStatic() {
|
|
|
581
581
|
html = pug.compileFile(pugPath, {
|
|
582
582
|
basedir: paths.template.root,
|
|
583
583
|
compileDebug: true,
|
|
584
|
-
filters: getCompilePugFilter()
|
|
584
|
+
filters: getCompilePugFilter(),
|
|
585
585
|
})({
|
|
586
586
|
data: dataItem,
|
|
587
587
|
_pagePath: obj.pugPath,
|
|
588
|
-
common: commonData
|
|
588
|
+
common: commonData,
|
|
589
589
|
});
|
|
590
590
|
fse.ensureFileSync(htmlPath);
|
|
591
591
|
await fse.writeFile(htmlPath, html);
|
|
@@ -600,11 +600,11 @@ export async function buildStatic() {
|
|
|
600
600
|
html = pug.compileFile(pugPath, {
|
|
601
601
|
basedir: paths.template.root,
|
|
602
602
|
compileDebug: true,
|
|
603
|
-
filters: getCompilePugFilter()
|
|
603
|
+
filters: getCompilePugFilter(),
|
|
604
604
|
})({
|
|
605
605
|
data,
|
|
606
606
|
_pagePath: obj.pugPath,
|
|
607
|
-
common: commonData
|
|
607
|
+
common: commonData,
|
|
608
608
|
});
|
|
609
609
|
fse.ensureFileSync(htmlPath);
|
|
610
610
|
await fse.writeFile(htmlPath, html);
|
|
@@ -619,11 +619,11 @@ export async function buildStatic() {
|
|
|
619
619
|
html = pug.compileFile(pugPath, {
|
|
620
620
|
basedir: paths.template.root,
|
|
621
621
|
compileDebug: true,
|
|
622
|
-
filters: getCompilePugFilter()
|
|
622
|
+
filters: getCompilePugFilter(),
|
|
623
623
|
})({
|
|
624
624
|
data,
|
|
625
625
|
_pagePath: obj.pugPath,
|
|
626
|
-
common: commonData
|
|
626
|
+
common: commonData,
|
|
627
627
|
});
|
|
628
628
|
fse.ensureFileSync(htmlPath);
|
|
629
629
|
await fse.writeFile(htmlPath, html);
|
|
@@ -635,7 +635,7 @@ export async function buildStatic() {
|
|
|
635
635
|
|
|
636
636
|
let pagesAllJsonFileName = (
|
|
637
637
|
await fse.readdir(langDataPath, {
|
|
638
|
-
recursive: true
|
|
638
|
+
recursive: true,
|
|
639
639
|
})
|
|
640
640
|
).filter((fileName) => fileName.endsWith(".json"));
|
|
641
641
|
await async.eachLimit(pagesAllJsonFileName, 64, async (jsonFileName) => {
|
|
@@ -676,7 +676,7 @@ export async function buildStatic() {
|
|
|
676
676
|
let html = PagesPugToFn[funName]({
|
|
677
677
|
data,
|
|
678
678
|
_pagePath: pugTemplate,
|
|
679
|
-
common: commonData
|
|
679
|
+
common: commonData,
|
|
680
680
|
});
|
|
681
681
|
if (data.page_name) {
|
|
682
682
|
pugTemplate =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pug-site-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"axios": "^1.7.7"
|
|
38
38
|
},
|
|
39
39
|
"license": "ISC",
|
|
40
|
-
"description": "
|
|
40
|
+
"description": "buildFn 取消生成data目录",
|
|
41
41
|
"files": [
|
|
42
42
|
"lib/",
|
|
43
43
|
"index.js"
|