mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
docs: document runner scripts
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// Generates postbuild runtime artifacts: plugin metadata, SDK aliases, stable
|
||||
// runtime aliases, static assets, and compatibility chunks for live upgrades.
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { performance } from "node:perf_hooks";
|
||||
@@ -126,6 +128,7 @@ const LEGACY_PLUGIN_INSTALL_RUNTIME_COMPAT_ALIASES = [
|
||||
aliasFileName: PLUGIN_INSTALL_RUNTIME_ALIAS.aliasFileName,
|
||||
sourceIncludes: LEGACY_PLUGIN_INSTALL_RUNTIME_MARKERS,
|
||||
}));
|
||||
/** Compatibility chunks kept for live gateways loading old CLI exit modules. */
|
||||
export const LEGACY_CLI_EXIT_COMPAT_CHUNKS = [
|
||||
{
|
||||
dest: "dist/memory-state-CcqRgDZU.js",
|
||||
@@ -137,10 +140,16 @@ export const LEGACY_CLI_EXIT_COMPAT_CHUNKS = [
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* Lists generated plugin SDK root-alias outputs.
|
||||
*/
|
||||
export function listPluginSdkRootAliasOutputs() {
|
||||
return [PLUGIN_SDK_ROOT_ALIAS_OUTPUT];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists generated official channel catalog outputs.
|
||||
*/
|
||||
export function listOfficialChannelCatalogOutputs() {
|
||||
return [OFFICIAL_CHANNEL_CATALOG_OUTPUT];
|
||||
}
|
||||
@@ -214,6 +223,9 @@ function resolveStableRootRuntimeAliasCandidate(params) {
|
||||
return wrappers.length === 1 ? wrappers[0].candidate : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists stable aliases for hashed root runtime/contract chunks.
|
||||
*/
|
||||
export function listStableRootRuntimeAliasOutputs(params = {}) {
|
||||
const rootDir = params.rootDir ?? ROOT;
|
||||
const distDir = path.join(rootDir, "dist");
|
||||
@@ -231,6 +243,9 @@ export function listStableRootRuntimeAliasOutputs(params = {}) {
|
||||
.toSorted((left, right) => left.localeCompare(right));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists compatibility chunk outputs required for old CLI exit paths.
|
||||
*/
|
||||
export function listLegacyCliExitCompatOutputs(params = {}) {
|
||||
const chunks = params.chunks ?? LEGACY_CLI_EXIT_COMPAT_CHUNKS;
|
||||
return chunks
|
||||
@@ -238,6 +253,9 @@ export function listLegacyCliExitCompatOutputs(params = {}) {
|
||||
.toSorted((left, right) => left.localeCompare(right));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists legacy hashed runtime aliases that may be needed during live upgrades.
|
||||
*/
|
||||
export function listLegacyRootRuntimeCompatOutputs(params = {}) {
|
||||
const rootDir = params.rootDir ?? ROOT;
|
||||
const distDir = path.join(rootDir, "dist");
|
||||
@@ -262,6 +280,9 @@ export function listLegacyRootRuntimeCompatOutputs(params = {}) {
|
||||
.toSorted((left, right) => left.localeCompare(right));
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all core runtime postbuild outputs expected after a build.
|
||||
*/
|
||||
export function listCoreRuntimePostBuildOutputs(params = {}) {
|
||||
return [
|
||||
...listPluginSdkRootAliasOutputs(),
|
||||
@@ -272,6 +293,9 @@ export function listCoreRuntimePostBuildOutputs(params = {}) {
|
||||
].toSorted((left, right) => left.localeCompare(right));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes stable aliases for current hashed runtime chunks.
|
||||
*/
|
||||
export function writeStableRootRuntimeAliases(params = {}) {
|
||||
const rootDir = params.rootDir ?? ROOT;
|
||||
const distDir = path.join(rootDir, "dist");
|
||||
@@ -294,6 +318,9 @@ export function writeStableRootRuntimeAliases(params = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewrites hashed runtime imports to stable aliases so live updates survive swaps.
|
||||
*/
|
||||
export function rewriteRootRuntimeImportsToStableAliases(params = {}) {
|
||||
const rootDir = params.rootDir ?? ROOT;
|
||||
const distDir = path.join(rootDir, "dist");
|
||||
@@ -415,6 +442,9 @@ function resolveLegacyRootRuntimeCompatTarget(params) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes compatibility aliases for shipped hashed runtime chunk names.
|
||||
*/
|
||||
export function writeLegacyRootRuntimeCompatAliases(params = {}) {
|
||||
const rootDir = params.rootDir ?? ROOT;
|
||||
const distDir = path.join(rootDir, "dist");
|
||||
@@ -445,6 +475,9 @@ export function writeLegacyRootRuntimeCompatAliases(params = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes small compatibility chunks for old CLI exit imports.
|
||||
*/
|
||||
export function writeLegacyCliExitCompatChunks(params = {}) {
|
||||
const rootDir = params.rootDir ?? ROOT;
|
||||
const chunks = params.chunks ?? LEGACY_CLI_EXIT_COMPAT_CHUNKS;
|
||||
@@ -458,6 +491,9 @@ function shouldCopyStaticExtensionAssets(params) {
|
||||
return env.OPENCLAW_RUNTIME_POSTBUILD_STATIC_ASSETS !== "0";
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs every runtime postbuild phase after the main dist build.
|
||||
*/
|
||||
export function runRuntimePostBuild(params = {}) {
|
||||
const timingsEnabled = params.timings ?? process.env.OPENCLAW_RUNTIME_POSTBUILD_TIMINGS !== "0";
|
||||
const runPhase = (label, action) => {
|
||||
|
||||
Reference in New Issue
Block a user