..
This commit is contained in:
+17
-10
@@ -1,21 +1,28 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
let path = "./scripts/"
|
||||
let scripts = fs.readdirSync(path);
|
||||
let basePath = "./scripts/";
|
||||
let scripts = fs.readdirSync(basePath);
|
||||
let count = 0;
|
||||
let scriptObj = {};
|
||||
for(let file of scripts)
|
||||
{
|
||||
let script = fs.readFileSync(path + file, {encoding:"utf8"});
|
||||
scriptObj[file.split(".")[0]] = script;
|
||||
count++;
|
||||
|
||||
for (let file of scripts) {
|
||||
let fullPath = path.join(basePath, file);
|
||||
|
||||
// Ignoriere Verzeichnisse
|
||||
if (fs.lstatSync(fullPath).isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let script = fs.readFileSync(fullPath, { encoding: "utf8" });
|
||||
scriptObj[file.split(".")[0]] = script;
|
||||
count++;
|
||||
}
|
||||
|
||||
let scriptLoader = `export default function()
|
||||
{
|
||||
mergeObject(game.wfrp4e.config.effectScripts, ${JSON.stringify(scriptObj)});
|
||||
|
||||
}`
|
||||
|
||||
fs.writeFileSync("./modules/loadScripts.js", scriptLoader)
|
||||
console.log(`Packed ${count} scripts`);
|
||||
fs.writeFileSync("./modules/loadScripts.js", scriptLoader);
|
||||
console.log(`Packed ${count} scripts`);
|
||||
|
||||
Reference in New Issue
Block a user