Files
PokeHuntLog/tools/install.js
T
notforever-ship-it 073e0556ec Add !PokeBugLog and log PokeHuntLog activity to it (PokeHuntLog 1.2.1)
!PokeBugLog saves Lua errors from any addon, PokeHuntLog messages,
login session info and /bug notes into its saved variables, so bugs
can be read from the file after a /reload. PokeHuntLog now logs tame
detection, pet scans, stable slots, action bar slots and happiness
drops there. tools/install.js copies both addons into the game.
2026-09-15 17:11:38 +01:00

33 lines
1.3 KiB
JavaScript

// Copies the addons from this project into the game's AddOns folder, replacing only these addon folders.
// Usage: node tools/install.js [path to Interface\AddOns]
const fs = require("fs");
const path = require("path");
const ROOT = path.resolve(__dirname, "..");
const ADDONS = ["PokeHuntLog", "!PokeBugLog"];
const target = path.resolve(process.argv[2] || "E:\\Ravencraft\\twmoa_1181\\Interface\\AddOns");
if (!fs.existsSync(target)) {
console.error(`AddOns folder not found: ${target}`);
process.exit(1);
}
for (const name of ADDONS) {
const src = path.join(ROOT, name);
if (!fs.existsSync(path.join(src, `${name}.toc`))) {
console.error(`${name} is missing from the project (was it moved?). Restore it with: git checkout -- "${name}"`);
process.exit(1);
}
}
for (const name of ADDONS) {
const src = path.join(ROOT, name);
const dest = path.join(target, name);
fs.rmSync(dest, { recursive: true, force: true });
fs.cpSync(src, dest, { recursive: true });
const count = fs.readdirSync(dest, { recursive: true }).filter((f) => fs.statSync(path.join(dest, f)).isFile()).length;
const version = (fs.readFileSync(path.join(dest, `${name}.toc`), "utf8").match(/## Version:\s*(\S+)/) || [])[1];
console.log(`Installed ${name} ${version} (${count} files) -> ${dest}`);
}