pug-site-core 3.0.24 → 3.0.25

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 +6 -4
  2. package/package.json +2 -2
package/lib/generate.js CHANGED
@@ -214,11 +214,13 @@ export async function fetchDataToJsonFile(args) {
214
214
 
215
215
  let saveJsonData = async (filePath, data) => {
216
216
  let finalPath = paths.resolveRoot("jsonData", filePath);
217
- // await fse.remove(finalPath);
217
+
218
218
  // 如果 路径存在,跳过写入
219
- if (await fse.pathExists(finalPath)) {
219
+ if (args.includes("skip") && await fse.pathExists(finalPath)) {
220
220
  return;
221
221
  }
222
+
223
+ await fse.remove(finalPath);
222
224
  await fse.outputJson(finalPath, data);
223
225
  };
224
226
 
@@ -253,8 +255,8 @@ export async function fetchDataToJsonFile(args) {
253
255
  return Promise.resolve();
254
256
  };
255
257
 
256
- // 如果没有过滤条件,清空输出目录
257
- if (!filterFun.length && !filterLang.length) {
258
+ // 如果没有过滤条件且不是skip模式,清空输出目录
259
+ if (!filterFun.length && !filterLang.length && !args.includes("skip")) {
258
260
  await fse.remove(paths.resolveRoot("jsonData"));
259
261
  }
260
262
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pug-site-core",
3
- "version": "3.0.24",
3
+ "version": "3.0.25",
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": "getData不删旧数据,增量写文件",
55
+ "description": "getData不删旧数据,增量写文件,通过getData skip触发",
56
56
  "files": [
57
57
  "lib/",
58
58
  "index.js"