pug-site-core 3.0.10 → 3.0.12

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.
Files changed (2) hide show
  1. package/lib/generate.js +16 -13
  2. package/package.json +2 -2
package/lib/generate.js CHANGED
@@ -447,10 +447,10 @@ export async function buildFn() {
447
447
 
448
448
  let totalCommonData = {};
449
449
  totalCommonData.langCommon = config.commonData;
450
+ let languageData = (await import(paths.languageData)).default
450
451
  await async.each(config.languageList, async (lang) => {
451
- let commonData = await fse.readJSON(
452
- paths.resolveRoot("jsonData", lang, "_common.json")
453
- );
452
+ let commonData = await (await import(paths.getData))["get_common_data"](lang);
453
+ commonData.lang = _.merge(commonData.lang, languageData[lang]);
454
454
  totalCommonData[lang] = commonData;
455
455
  });
456
456
 
@@ -630,7 +630,8 @@ export async function buildStatic() {
630
630
  }
631
631
  } catch (error) {
632
632
  console.error(
633
- `处理数组数据失败 [lang: ${lang}, getDataFn: ${obj.getDataFn}]:`, error
633
+ `处理数组数据失败 [lang: ${lang}, getDataFn: ${obj.getDataFn}]:`,
634
+ error
634
635
  );
635
636
  throw error;
636
637
  }
@@ -727,7 +728,8 @@ export async function buildStatic() {
727
728
  }
728
729
  } catch (error) {
729
730
  console.error(
730
- `处理自定义HTML构建失败 [lang: ${lang}, config: ${JSON.stringify(obj)}]:`,error
731
+ `处理自定义HTML构建失败 [lang: ${lang}, config: ${JSON.stringify(obj)}]:`,
732
+ error
731
733
  );
732
734
  throw error;
733
735
  }
@@ -765,14 +767,6 @@ export async function buildStatic() {
765
767
  return;
766
768
  }
767
769
 
768
- const html = generateHtml(
769
- pagesPugToFn,
770
- funName,
771
- data,
772
- pugTemplate,
773
- commonData
774
- );
775
-
776
770
  // 构建输出路径
777
771
  let finalPugTemplate = pugTemplate;
778
772
  if (data.page_name) {
@@ -788,6 +782,15 @@ export async function buildStatic() {
788
782
  finalPugTemplate.replace(/\.[^.]*$/, ".html")
789
783
  );
790
784
  console.log(htmlPath);
785
+
786
+ const html = generateHtml(
787
+ pagesPugToFn,
788
+ funName,
789
+ data,
790
+ pugTemplate,
791
+ commonData
792
+ );
793
+
791
794
  const compressedHtml = await compressHtml(html, htmlPath);
792
795
  await fse.outputFile(htmlPath, compressedHtml);
793
796
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pug-site-core",
3
- "version": "3.0.10",
3
+ "version": "3.0.12",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -52,7 +52,7 @@
52
52
  "ws": "^8.18.0"
53
53
  },
54
54
  "license": "ISC",
55
- "description": "修复语言数据打包失败的问题",
55
+ "description": "修改静态打包的log顺序",
56
56
  "files": [
57
57
  "lib/",
58
58
  "index.js"