mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
fix(release): keep legacy memory chunk stub
This commit is contained in:
@@ -10,6 +10,12 @@ import { writeOfficialChannelCatalog } from "./write-official-channel-catalog.mj
|
||||
|
||||
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const ROOT_RUNTIME_ALIAS_PATTERN = /^(?<base>.+\.(?:runtime|contract))-[A-Za-z0-9_-]+\.js$/u;
|
||||
export const LEGACY_CLI_EXIT_COMPAT_CHUNKS = [
|
||||
{
|
||||
dest: "dist/memory-state-CcqRgDZU.js",
|
||||
contents: "export function hasMemoryRuntime() {\n return false;\n}\n",
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* Copy static (non-transpiled) runtime assets that are referenced by their
|
||||
@@ -81,6 +87,14 @@ export function writeStableRootRuntimeAliases(params = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
export function writeLegacyCliExitCompatChunks(params = {}) {
|
||||
const rootDir = params.rootDir ?? ROOT;
|
||||
const chunks = params.chunks ?? LEGACY_CLI_EXIT_COMPAT_CHUNKS;
|
||||
for (const { dest, contents } of chunks) {
|
||||
writeTextFileIfChanged(path.join(rootDir, dest), contents);
|
||||
}
|
||||
}
|
||||
|
||||
export function runRuntimePostBuild(params = {}) {
|
||||
copyPluginSdkRootAlias(params);
|
||||
copyBundledPluginMetadata(params);
|
||||
@@ -88,6 +102,7 @@ export function runRuntimePostBuild(params = {}) {
|
||||
stageBundledPluginRuntimeDeps(params);
|
||||
stageBundledPluginRuntime(params);
|
||||
writeStableRootRuntimeAliases(params);
|
||||
writeLegacyCliExitCompatChunks(params);
|
||||
copyStaticExtensionAssets(params);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
copyStaticExtensionAssets,
|
||||
listStaticExtensionAssetOutputs,
|
||||
writeLegacyCliExitCompatChunks,
|
||||
writeStableRootRuntimeAliases,
|
||||
} from "../../scripts/runtime-postbuild.mjs";
|
||||
import { createScriptTestHarness } from "./test-helpers.js";
|
||||
@@ -79,4 +80,14 @@ describe("runtime postbuild static assets", () => {
|
||||
);
|
||||
await expect(fs.stat(path.join(distDir, "library.js"))).rejects.toThrow();
|
||||
});
|
||||
|
||||
it("writes legacy CLI exit compatibility chunks", async () => {
|
||||
const rootDir = createTempDir("openclaw-runtime-postbuild-");
|
||||
|
||||
writeLegacyCliExitCompatChunks({ rootDir });
|
||||
|
||||
await expect(
|
||||
fs.readFile(path.join(rootDir, "dist", "memory-state-CcqRgDZU.js"), "utf8"),
|
||||
).resolves.toContain("function hasMemoryRuntime()");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user