Files
openclaw/scripts/lib/generated-output-utils.mts
T
Peter Steinberger c70aee247e refactor(scripts): migrate JavaScript tools to TypeScript (#121005)
* refactor(scripts): migrate JavaScript tools to TypeScript

* fix(ci): keep changed-scope preflight zero-install

* fix(ci): preserve zero-install script owners

* fix(ci): complete script migration follow-through

* fix(release): keep stable closeout zero-install

* fix(scripts): preserve standalone execution boundaries

* fix(scripts): repair standalone loader boundaries

* fix(scripts): normalize gateway observation ids

* fix(scripts): keep Docker packager standalone

* test(scripts): preserve rebase cleanup helpers

* test(sessions): use tracked temp directory
2026-08-09 07:21:35 -07:00

31 lines
815 B
TypeScript

// Shared write/check/report helpers for generated repository files.
import path from "node:path";
import { writeTextFileIfChanged } from "../runtime-postbuild-shared.mjs";
import { readIfExists } from "./bundled-plugin-source-utils.mts";
/** Write generated output unless check mode only needs stale-state metadata. */
export function writeGeneratedOutput(params: {
check: boolean;
next: string;
outputPath: string;
repoRoot: string;
}) {
const outputPath = path.resolve(params.repoRoot, params.outputPath);
const current = readIfExists(outputPath);
const changed = current !== params.next;
if (params.check) {
return {
changed,
wrote: false,
outputPath,
};
}
return {
changed,
wrote: writeTextFileIfChanged(outputPath, params.next),
outputPath,
};
}