29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.ItemgroupStorage = void 0;
|
||
|
const FileUtils_1 = require("../FileUtils");
|
||
|
const path = require("node:path");
|
||
|
const fs = require("node:fs");
|
||
|
class ItemgroupStorage {
|
||
|
constructor(itemgroupDir) {
|
||
|
this.itemgroupDir = itemgroupDir;
|
||
|
FileUtils_1.FileUtils.prepareDirectoryFroWriting(this.itemgroupDir);
|
||
|
}
|
||
|
storeItemgroups(itemgroups) {
|
||
|
console.log("Store Itemgroups");
|
||
|
itemgroups.forEach(itemgroup => {
|
||
|
this.storeItemgroup(itemgroup);
|
||
|
});
|
||
|
}
|
||
|
storeItemgroup(itemgroup) {
|
||
|
const file = path.join(...itemgroup.fileName.split("/"));
|
||
|
const completeFileName = path.join(this.itemgroupDir, file);
|
||
|
const itemgroupDirectory = path.join(...itemgroup.fileName.split("/").slice(0, -1));
|
||
|
const completeItemgroupDirectory = path.join(this.itemgroupDir, itemgroupDirectory);
|
||
|
console.log(completeItemgroupDirectory);
|
||
|
FileUtils_1.FileUtils.prepareDirectoryFroWriting(completeItemgroupDirectory);
|
||
|
fs.writeFileSync(completeFileName + ".json", itemgroup.jsonString, "utf-8");
|
||
|
}
|
||
|
}
|
||
|
exports.ItemgroupStorage = ItemgroupStorage;
|
||
|
//# sourceMappingURL=ItemgroupStorage.js.map
|