feat(FN-2895): merge fusion/fn-2895

- feat(FN-2895): complete Step 7 — documentation and delivery

Fusion-Task-Id: FN-2895
This commit is contained in:
Fusion
2026-04-28 21:50:27 -07:00
committed by gsxdsm
parent c14f2a3991
commit 6bb919864b
9 changed files with 384 additions and 89 deletions

View File

@@ -1,21 +1,29 @@
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { existsSync, readFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { resolveGlobalDir } from "@fusion/core";
import { clearUpdateCheckCache, performUpdateCheck } from "../update-check.js";
import type { ApiRouteRegistrar } from "./types.js";
const __dirname = dirname(fileURLToPath(import.meta.url));
// Walk up from this module to find the @runfusion/fusion package.json. Works
// across layouts: monorepo source (packages/dashboard/src/...), installed
// dependency (node_modules/@runfusion/fusion/dist/...), and the bundled CLI
// binary where dashboard code is inlined into bin.js next to the cli's
// package.json. Falls back to "0.0.0" when nothing is found.
const CLI_PACKAGE_VERSION = (() => {
try {
const packageJsonPath = join(__dirname, "..", "..", "..", "cli", "package.json");
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8")) as {
version?: unknown;
};
if (typeof packageJson.version === "string" && packageJson.version.length > 0) {
return packageJson.version;
let cur = dirname(fileURLToPath(import.meta.url));
for (let i = 0; i < 8; i++) {
const pkgPath = resolve(cur, "package.json");
if (existsSync(pkgPath)) {
const parsed = JSON.parse(readFileSync(pkgPath, "utf-8")) as { name?: string; version?: string };
if (parsed.name === "@runfusion/fusion" && typeof parsed.version === "string" && parsed.version.length > 0) {
return parsed.version;
}
}
const parent = resolve(cur, "..");
if (parent === cur) break;
cur = parent;
}
} catch {
// Fall through to env/default fallback.