mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:40:44 +00:00
perf(test): cache extension boundary prep freshness
This commit is contained in:
@@ -18,8 +18,8 @@ const ROOT_DTS_INPUTS = [
|
||||
"src/video-generation/types.ts",
|
||||
"src/types",
|
||||
];
|
||||
const ROOT_DTS_OUTPUTS = [
|
||||
"dist/plugin-sdk/.tsbuildinfo",
|
||||
const ROOT_DTS_STAMP = "dist/plugin-sdk/.boundary-dts.stamp";
|
||||
const ROOT_DTS_REQUIRED_OUTPUTS = [
|
||||
"dist/plugin-sdk/src/plugin-sdk/error-runtime.d.ts",
|
||||
"dist/plugin-sdk/src/plugin-sdk/plugin-entry.d.ts",
|
||||
"dist/plugin-sdk/src/plugin-sdk/provider-auth.d.ts",
|
||||
@@ -34,8 +34,8 @@ const PACKAGE_DTS_INPUTS = [
|
||||
"src/video-generation/types.ts",
|
||||
"src/types",
|
||||
];
|
||||
const PACKAGE_DTS_OUTPUTS = [
|
||||
"packages/plugin-sdk/dist/.tsbuildinfo",
|
||||
const PACKAGE_DTS_STAMP = "packages/plugin-sdk/dist/.boundary-dts.stamp";
|
||||
const PACKAGE_DTS_REQUIRED_OUTPUTS = [
|
||||
"packages/plugin-sdk/dist/src/plugin-sdk/error-runtime.d.ts",
|
||||
"packages/plugin-sdk/dist/src/plugin-sdk/plugin-entry.d.ts",
|
||||
"packages/plugin-sdk/dist/src/plugin-sdk/provider-auth.d.ts",
|
||||
@@ -128,6 +128,12 @@ function removeIncrementalStateForMissingOutput(params) {
|
||||
fs.rmSync(resolve(repoRoot, params.tsBuildInfoPath), { force: true });
|
||||
}
|
||||
|
||||
function writeStampFile(relativePath) {
|
||||
const filePath = resolve(repoRoot, relativePath);
|
||||
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
||||
fs.writeFileSync(filePath, `${new Date().toISOString()}\n`, "utf8");
|
||||
}
|
||||
|
||||
export function createPrefixedOutputWriter(label, target) {
|
||||
let buffered = "";
|
||||
const prefix = `[${label}] `;
|
||||
@@ -241,16 +247,18 @@ export async function runNodeStepsInParallel(steps) {
|
||||
export async function main(argv = process.argv.slice(2)) {
|
||||
try {
|
||||
const mode = parseMode(argv);
|
||||
const rootDtsFresh = isArtifactSetFresh({
|
||||
inputPaths: ROOT_DTS_INPUTS,
|
||||
outputPaths: ROOT_DTS_OUTPUTS,
|
||||
includeFile: isRelevantTypeInput,
|
||||
});
|
||||
const packageDtsFresh = isArtifactSetFresh({
|
||||
inputPaths: PACKAGE_DTS_INPUTS,
|
||||
outputPaths: PACKAGE_DTS_OUTPUTS,
|
||||
includeFile: isRelevantTypeInput,
|
||||
});
|
||||
const rootDtsFresh =
|
||||
isArtifactSetFresh({
|
||||
inputPaths: ROOT_DTS_INPUTS,
|
||||
outputPaths: [ROOT_DTS_STAMP],
|
||||
includeFile: isRelevantTypeInput,
|
||||
}) && !hasMissingOutput(ROOT_DTS_REQUIRED_OUTPUTS);
|
||||
const packageDtsFresh =
|
||||
isArtifactSetFresh({
|
||||
inputPaths: PACKAGE_DTS_INPUTS,
|
||||
outputPaths: [PACKAGE_DTS_STAMP],
|
||||
includeFile: isRelevantTypeInput,
|
||||
}) && !hasMissingOutput(PACKAGE_DTS_REQUIRED_OUTPUTS);
|
||||
const entryShimsFresh = isArtifactSetFresh({
|
||||
inputPaths: [
|
||||
...ENTRY_SHIMS_INPUTS,
|
||||
@@ -264,13 +272,14 @@ export async function main(argv = process.argv.slice(2)) {
|
||||
if (mode === "all") {
|
||||
if (!rootDtsFresh) {
|
||||
removeIncrementalStateForMissingOutput({
|
||||
outputPaths: ROOT_DTS_OUTPUTS,
|
||||
outputPaths: ROOT_DTS_REQUIRED_OUTPUTS,
|
||||
tsBuildInfoPath: "dist/plugin-sdk/.tsbuildinfo",
|
||||
});
|
||||
pendingSteps.push({
|
||||
label: "plugin-sdk boundary dts",
|
||||
args: [tscBin, "-p", "tsconfig.plugin-sdk.dts.json"],
|
||||
timeoutMs: 300_000,
|
||||
stampPath: ROOT_DTS_STAMP,
|
||||
});
|
||||
} else {
|
||||
process.stdout.write("[plugin-sdk boundary dts] fresh; skipping\n");
|
||||
@@ -278,13 +287,14 @@ export async function main(argv = process.argv.slice(2)) {
|
||||
}
|
||||
if (!packageDtsFresh) {
|
||||
removeIncrementalStateForMissingOutput({
|
||||
outputPaths: PACKAGE_DTS_OUTPUTS,
|
||||
outputPaths: PACKAGE_DTS_REQUIRED_OUTPUTS,
|
||||
tsBuildInfoPath: "packages/plugin-sdk/dist/.tsbuildinfo",
|
||||
});
|
||||
pendingSteps.push({
|
||||
label: "plugin-sdk package boundary dts",
|
||||
args: [tscBin, "-p", "packages/plugin-sdk/tsconfig.json"],
|
||||
timeoutMs: 300_000,
|
||||
stampPath: PACKAGE_DTS_STAMP,
|
||||
});
|
||||
} else {
|
||||
process.stdout.write("[plugin-sdk package boundary dts] fresh; skipping\n");
|
||||
@@ -292,6 +302,11 @@ export async function main(argv = process.argv.slice(2)) {
|
||||
|
||||
if (pendingSteps.length > 0) {
|
||||
await runNodeStepsInParallel(pendingSteps);
|
||||
for (const step of pendingSteps) {
|
||||
if (step.stampPath) {
|
||||
writeStampFile(step.stampPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mode === "all" && (!entryShimsFresh || pendingSteps.length > 0)) {
|
||||
|
||||
Reference in New Issue
Block a user