fixes asynchronous error

pull/64/head
macniel 2025-11-01 10:45:01 +01:00
parent b69511f93a
commit 026f222718
1 changed files with 14 additions and 14 deletions

View File

@ -68,21 +68,21 @@ const convert = function (from, to, ofType, overwrite = true) {
} else { } else {
console.debug("processing file", join(source, file)) console.debug("processing file", join(source, file))
let originalSource = JSON.parse(readFileSync(join(source, file), {encoding: "utf8"})); let originalSource = JSON.parse(readFileSync(join(source, file), {encoding: "utf8"}));
let id = randomID("DSA_4-1" + TYPE + originalSource.name.trim()); randomID("DSA_4-1" + TYPE + originalSource.name.trim()).then(id => {
let targetSource = {
let targetSource = { _id: id,
_id: id, _key: "!items!" + id,
_key: "!items!" + id, type: TYPE,
type: TYPE, img: originalSource.image,
img: originalSource.image, name: originalSource.name.trim(),
name: originalSource.name.trim(), system: {...originalSource},
system: {...originalSource}, }
} delete targetSource.system.image;
delete targetSource.system.image; let target = JSON.stringify(targetSource, null, 2);
let target = JSON.stringify(targetSource, null, 2); let newFileName = "./" + join(DEST, id + ".json");
let newFileName = "./" + join(DEST, id + ".json"); writeFileSync(newFileName, target, {encoding: "utf8"});
writeFileSync(newFileName, target, {encoding: "utf8"}); })
} }
}); });
} }