From db81e2def167a586931600c27a4f52e7dd10469d Mon Sep 17 00:00:00 2001 From: macniel Date: Sat, 1 Nov 2025 11:28:30 +0100 Subject: [PATCH] fixes asynchronous error with gitkeep, but do not process them --- gulpfile.mjs | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/gulpfile.mjs b/gulpfile.mjs index 7f19815f..60071e3b 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -68,29 +68,31 @@ const convert = function (from, to, ofType, overwrite = true) { if (statSync(join(source, file)).isDirectory()) { await filewalker(join(source, file)) } else { - console.debug("processing file", join(source, file)) - let originalSource = JSON.parse(readFileSync(join(source, file), {encoding: "utf8"})) - promises.push(new Promise((resolve2) => { - randomID("DSA_4-1" + TYPE + originalSource.name.trim()).then(id => { - let targetSource = { - _id: id, - _key: "!items!" + id, - type: TYPE, - img: originalSource.image, - name: originalSource.name.trim(), - system: {...originalSource}, - } - delete targetSource.system.image; - let target = JSON.stringify(targetSource, null, 2) - let newFileName = "./" + join(DEST, id + ".json") - if (!existsSync(join("./", DEST))) { - mkdirSync(join("./", DEST)) - } - writeFileSync(newFileName, target, {encoding: "utf8"}) - resolve2() - }) + if (file.endsWith(".json")) { + console.debug("processing file", join(source, file)) + let originalSource = JSON.parse(readFileSync(join(source, file), {encoding: "utf8"})) + promises.push(new Promise((resolve2) => { + randomID("DSA_4-1" + TYPE + originalSource.name.trim()).then(id => { + let targetSource = { + _id: id, + _key: "!items!" + id, + type: TYPE, + img: originalSource.image, + name: originalSource.name.trim(), + system: {...originalSource}, + } + delete targetSource.system.image; + let target = JSON.stringify(targetSource, null, 2) + let newFileName = "./" + join(DEST, id + ".json") + if (!existsSync(join("./", DEST))) { + mkdirSync(join("./", DEST)) + } + writeFileSync(newFileName, target, {encoding: "utf8"}) + resolve2() + }) - })) + })) + } } } }