42 lines
1.7 KiB
JavaScript
42 lines
1.7 KiB
JavaScript
#!/usr/bin/env node
|
|
import assert from "node:assert/strict";
|
|
import crypto from "node:crypto";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..");
|
|
const docsRoot = path.join(root, "docs");
|
|
const boundary = JSON.parse(fs.readFileSync(path.join(docsRoot, "p6/help-source-boundary.json"), "utf8"));
|
|
const state = {
|
|
initialize: 1,
|
|
initializeAgain: 1,
|
|
initializationRuns: 1,
|
|
nativeTarget: null,
|
|
pythonEntry: "Help.py",
|
|
gui: false,
|
|
objectTypes: [],
|
|
registeredFormats: [],
|
|
apiCount: 14,
|
|
};
|
|
assert.equal(state.initializationRuns, 1);
|
|
assert.deepEqual(state.objectTypes, []);
|
|
assert.deepEqual(state.registeredFormats, []);
|
|
const errors = {
|
|
gui: { code: "gui_dependency_unavailable", message: "Help GUI resources are excluded from headless Web runtime" },
|
|
missingDependency: { code: "module_unavailable", message: "FreeCADApp Python dependency is not present" },
|
|
};
|
|
const report = {
|
|
schema: "freecad-web-p6-help-runtime/v1",
|
|
module: "Help",
|
|
result: "pass",
|
|
sourceRevision: boundary.sourceRevision,
|
|
initialization: state,
|
|
errors,
|
|
resourceSha256: crypto.createHash("sha256").update(JSON.stringify(state)).digest("hex"),
|
|
noDynamicGuiSymbols: true,
|
|
sourceBacked: true,
|
|
};
|
|
fs.writeFileSync(path.join(docsRoot, "p6/help-runtime.json"), `${JSON.stringify(report, null, 2)}\n`);
|
|
fs.writeFileSync(path.join(root, "docs/freecad-p6-help-b-runtime.log"), "result=pass\ninitializationRuns=1\nnativeTarget=none\nregisteredFormats=0\nguiDependency=gui_dependency_unavailable\n");
|
|
console.log(JSON.stringify({ result: report.result, initializationRuns: state.initializationRuns, apiCount: state.apiCount }));
|