fixes asynchronous error
parent
b69511f93a
commit
026f222718
28
gulpfile.mjs
28
gulpfile.mjs
|
|
@ -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"});
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue