fixes asynchronous error
parent
b69511f93a
commit
026f222718
|
|
@ -68,8 +68,7 @@ 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,
|
||||
|
|
@ -83,6 +82,7 @@ const convert = function (from, to, ofType, overwrite = true) {
|
|||
let target = JSON.stringify(targetSource, null, 2);
|
||||
let newFileName = "./" + join(DEST, id + ".json");
|
||||
writeFileSync(newFileName, target, {encoding: "utf8"});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue