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 {
console.debug("processing file", join(source, file))
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 = {
_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");
writeFileSync(newFileName, target, {encoding: "utf8"});
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");
writeFileSync(newFileName, target, {encoding: "utf8"});
})
}
});
}