forked from phenom/healer-man
Release Healer Man 0.1.22
This commit is contained in:
1 parent
f6f2375145
commit
7f6001723a
144 files changed
+54107
-690
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { stat } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import {
|
||||
clientRootForRecipe,
|
||||
@@ -10,24 +10,21 @@ import {
|
||||
recipesRoot,
|
||||
workRoot,
|
||||
} from "./lib.mjs";
|
||||
import { runWowExporter } from "./wow-export-tool.mjs";
|
||||
|
||||
async function runExporter(argumentsList) {
|
||||
const executable = path.resolve(projectRoot, "../wow335a/dungeon-export-work/tools/wow.export-0.2.19/wow.export.exe");
|
||||
if (!await exists(executable)) throw new Error("The patched portable wow.export executable was not found.");
|
||||
await new Promise((resolve, reject) => {
|
||||
const child = spawn(executable, ["--disable-auto-update", ...argumentsList], {
|
||||
cwd: path.dirname(executable),
|
||||
stdio: "inherit",
|
||||
windowsHide: true,
|
||||
});
|
||||
child.once("error", reject);
|
||||
child.once("exit", (code) => code === 0 ? resolve() : reject(new Error(`wow.export exited with code ${code}.`)));
|
||||
});
|
||||
async function resultMtime(output) {
|
||||
const resultFile = path.join(output, "automation-result.json");
|
||||
return await exists(resultFile) ? (await stat(resultFile)).mtimeMs : 0;
|
||||
}
|
||||
|
||||
async function checkedResult(slug, output) {
|
||||
async function checkedResult(slug, output, previousMtime) {
|
||||
const resultFile = path.join(output, "automation-result.json");
|
||||
if (!await exists(resultFile)) return { status: "blocked", dungeonId: slug, blockers: ["wow.export produced no automation-result.json."] };
|
||||
if (!await exists(resultFile)) return { status: "blocked", dungeonId: slug, blockers: [`wow.export produced no automation result at ${resultFile}.`] };
|
||||
if ((await stat(resultFile)).mtimeMs <= previousMtime) return {
|
||||
status: "blocked",
|
||||
dungeonId: slug,
|
||||
blockers: [`wow.export did not refresh ${resultFile}; refusing to accept a stale result from an earlier run.`],
|
||||
};
|
||||
const result = await readJson(resultFile);
|
||||
if (!result.ok) return {
|
||||
status: "blocked",
|
||||
@@ -43,13 +40,14 @@ export async function exportDungeonSource(slug) {
|
||||
const recipe = await loadRecipe(slug);
|
||||
const clientRoot = clientRootForRecipe(recipe);
|
||||
const output = path.join(workRoot, slug, "source-export");
|
||||
await runExporter([
|
||||
const previousMtime = await resultMtime(output);
|
||||
await runWowExporter([
|
||||
"--export-dungeon",
|
||||
"--recipe", path.join(recipesRoot, `${slug}.json`),
|
||||
"--client-root", clientRoot,
|
||||
"--output", output,
|
||||
]);
|
||||
const blocked = await checkedResult(slug, output);
|
||||
], { projectRoot });
|
||||
const blocked = await checkedResult(slug, output, previousMtime);
|
||||
if (blocked) return blocked;
|
||||
return { status: "green", dungeonId: slug, output: path.relative(projectRoot, output).replace(/\\/g, "/") };
|
||||
}
|
||||
@@ -58,12 +56,15 @@ export async function exportClientDiscoveryTables(slug) {
|
||||
const recipe = await loadRecipe(slug);
|
||||
const clientRoot = clientRootForRecipe(recipe);
|
||||
const output = path.join(workRoot, slug, "client-dbc");
|
||||
await runExporter([
|
||||
const previousMtime = await resultMtime(output);
|
||||
await runWowExporter([
|
||||
"--discover-dungeon",
|
||||
"--recipe", path.join(recipesRoot, `${slug}.json`),
|
||||
"--client-root", clientRoot,
|
||||
"--output", output,
|
||||
]);
|
||||
], { projectRoot });
|
||||
const blocked = await checkedResult(slug, output, previousMtime);
|
||||
if (blocked) throw new Error(blocked.blockers.join("\n"));
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -88,13 +89,14 @@ export async function exportCreatureSource(slug) {
|
||||
blockers: unresolved.map((creature) => `${creature.name ?? creature.slug} has an unresolved display/composite recipe.`),
|
||||
};
|
||||
const output = path.join(workRoot, slug, "creature-source");
|
||||
await runExporter([
|
||||
const previousMtime = await resultMtime(output);
|
||||
await runWowExporter([
|
||||
"--export-creatures",
|
||||
"--recipe", selected,
|
||||
"--client-root", clientRoot,
|
||||
"--output", output,
|
||||
]);
|
||||
const blocked = await checkedResult(slug, output);
|
||||
], { projectRoot });
|
||||
const blocked = await checkedResult(slug, output, previousMtime);
|
||||
if (blocked) return blocked;
|
||||
return { status: "green", dungeonId: slug, output: path.relative(projectRoot, output).replace(/\\/g, "/") };
|
||||
}
|
||||
Reference in new issue
Block a user