20 lines
1.0 KiB
JavaScript
20 lines
1.0 KiB
JavaScript
import { mkdir, cp, access } from "node:fs/promises";
|
|
import { execFileSync } from "node:child_process";
|
|
import { resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { packagePlugin } from "./packagePlugin.mjs";
|
|
|
|
const root = fileURLToPath(new URL("../", import.meta.url));
|
|
const formulasRoot = resolve(process.env.RUNESTONE_TABLE_FORMULAS_ROOT || resolve(root, "../RuneStone_TableFormulas"));
|
|
const formulasBuild = resolve(formulasRoot, "scripts/build.mjs");
|
|
try {
|
|
await access(formulasBuild);
|
|
} catch {
|
|
throw new Error("Clone RuneStone_TableFormulas beside RuneStone, or set RUNESTONE_TABLE_FORMULAS_ROOT. Install its dependencies before building plugins.");
|
|
}
|
|
execFileSync(process.execPath, [formulasBuild], { cwd: formulasRoot, stdio: "inherit" });
|
|
const formulasOutput = resolve(root, "plugin-packages/table-formulas");
|
|
await mkdir(formulasOutput, { recursive: true });
|
|
await cp(resolve(formulasRoot, "dist/plugin"), formulasOutput, { recursive: true });
|
|
console.log(await packagePlugin(formulasOutput, resolve(formulasRoot, "releases")));
|