Files
RuneStone/scripts/buildPlugins.mjs
T
Knotty Wyvern c66ea1ce83 Add a smoke test runner, a shared harness, and safer build scripts
- pnpm smoke runs tests/smoke/ in parallel. It starts Vite when nothing
  serves SMOKE_URL, finds an installed Chrome when Playwright has no
  Chromium, and skips a test with a reason when a requirement that the
  test declares with "// @requires" is missing. Logs go to
  output/smoke/logs/.
- tests/smoke/_harness/ holds the Playwright launch, page error
  collection, the Tauri IPC mock with an in-memory workspace, and output
  folders. tabs/order uses it as the first converted test.
- Pin Playwright 1.63.0, the version that browser-runtime uses.
- RUNESTONE_PLUGIN_REPOS names the folder of the sibling plugin
  checkouts for buildPlugins, the menu audit, and the smoke tests.
- buildInstaller restores the version fields after Ctrl+C, keeps the
  backups of each attempt, stops when the browser runtime is not staged,
  and writes the file name instead of absolute paths to host.json.
- buildPlugins clears the staged Table Formulas package before copying.
- plugins/choiceMenus used the wrong Local Autocomplete folder name.
2026-10-27 19:55:49 -07:00

23 lines
1.3 KiB
JavaScript

import { mkdir, cp, access, rm } 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 pluginRepos = process.env.RUNESTONE_PLUGIN_REPOS || resolve(root, "..");
const formulasRoot = resolve(process.env.RUNESTONE_TABLE_FORMULAS_ROOT || resolve(pluginRepos, "RuneStone_Table_Formulas"));
const formulasBuild = resolve(formulasRoot, "scripts/build.mjs");
try {
await access(formulasBuild);
} catch {
throw new Error("Clone RuneStone_Table_Formulas beside RuneStone, or set RUNESTONE_PLUGIN_REPOS or 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");
// Remove the previous build, so deleted plugin files do not stay in the package.
await rm(formulasOutput, { recursive: true, force: true });
await mkdir(formulasOutput, { recursive: true });
await cp(resolve(formulasRoot, "dist/plugin"), formulasOutput, { recursive: true });
console.log(await packagePlugin(formulasOutput, resolve(formulasRoot, "releases")));