Make Table Formulas a built-in feature

The formula engine, the rendered results, and the formula help now
come from src/lib/formulas/. The editor and the renderer call this
module directly. The tableFormulas contribution type is removed.

- Add the tableFormulas general setting (default on) and a switch in
  Settings > General. When it is off, formulas show as source text.
- Do not load an installed runestone.table-formulas package. Settings
  > Plug-ins marks it as included with RuneStone and tells the user
  that it can be removed. The user's files stay in place.
- Translate the formula help and the error descriptions into French,
  Japanese, and Simplified Chinese.
- Port the plugin unit tests. Test the setting and use a test-only
  contribution for the generic plugin lifecycle tests.
- Smoke tests load only Terminal. The formula and lifecycle tests use
  the built-in feature and its setting.
- Remove scripts/buildPlugins.mjs, the build:plugins script, and the
  plugin-packages requirement of the smoke runner.
- Remove RuneStone_Table_Formulas from the menu audit scope. It had no
  menu surfaces.
- Update the README, the user guides, and the developer references.
This commit is contained in:
Knotty Wyvern
2026-10-28 01:05:43 -07:00
parent 72671e5d01
commit 5e1533c371
43 changed files with 580 additions and 198 deletions
-22
View File
@@ -1,22 +0,0 @@
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")));
+1 -1
View File
@@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url';
const root = fileURLToPath(new URL('../', import.meta.url));
const pluginRepos = process.env.RUNESTONE_PLUGIN_REPOS || path.resolve(root, '..');
export const projects = ['RuneStone', 'RuneStone_Project_Management', 'RuneStone_Terminal', 'RuneStone_Background_Slideshow', 'RuneStone_Local_Autocomplete', 'RuneStone_Git', 'RuneStone_PDF_Viewer', 'RuneStone_Table_Formulas', 'RuneStone_CSV_Viewer'];
export const projects = ['RuneStone', 'RuneStone_Project_Management', 'RuneStone_Terminal', 'RuneStone_Background_Slideshow', 'RuneStone_Local_Autocomplete', 'RuneStone_Git', 'RuneStone_PDF_Viewer', 'RuneStone_CSV_Viewer'];
const patterns = {
action: /\b(?:showActionMenu|actionMenu)\s*\(/g,
svelteMenu: /<ContextMenu\b/g,
+1 -5
View File
@@ -6,7 +6,7 @@
// After the parallel run, the runner runs each failed test again, one at a time (--retries, default 1).
// A test that passes on a retry counts as "flaky". The summary lists it, but the run does not fail.
// A test declares what it needs on a line near the top:
// // @requires plugin:terminal plugin:table-formulas repo:RuneStone_Git/dist electron
// // @requires plugin:terminal repo:RuneStone_Git/dist electron
// The runner skips a test, with the reason, when a requirement is missing.
// A test that fails because of a known app defect states it near the top:
// // @known-issue <the defect>
@@ -68,10 +68,6 @@ function missing(requirement) {
const dist = env.RUNESTONE_TERMINAL_DIST || path.join(pluginRepos, "RuneStone_Terminal", "dist");
return existsSync(path.join(dist, "main.js")) ? null : `the Terminal plugin is not built at ${dist}`;
}
if (kind === "plugin") {
const entry = path.join(root, "plugin-packages", value, "main.js");
return existsSync(entry) ? null : `plugin-packages/${value} is missing; run pnpm build:plugins`;
}
if (kind === "repo") {
const target = path.join(pluginRepos, value);
return existsSync(target) ? null : `${target} is missing; set RUNESTONE_PLUGIN_REPOS to the folder of the plugin checkouts`;