foundryvtt-wh4-lang-fr-fr/scriptPacker.js

21 lines
495 B
JavaScript
Raw Normal View History

2024-05-16 17:57:51 +02:00
import fs from "fs";
let path = "./scripts/"
let scripts = fs.readdirSync(path);
let count = 0;
let scriptObj = {};
for(let file of scripts)
{
let script = fs.readFileSync(path + file, {encoding:"utf8"});
scriptObj[file.split(".")[0]] = script;
count++;
}
let scriptLoader = `export default function()
{
mergeObject(game.wfrp4e.config.effectScripts, ${JSON.stringify(scriptObj)});
2024-05-16 17:57:51 +02:00
}`
2024-06-07 07:09:07 +02:00
fs.writeFileSync("./modules/loadScripts.js", scriptLoader)
2024-05-16 17:57:51 +02:00
console.log(`Packed ${count} scripts`);