mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:00:42 +00:00
fix(release): clarify control ui build requirement
This commit is contained in:
@@ -590,6 +590,27 @@ export function collectMissingPackPaths(paths: Iterable<string>): string[] {
|
||||
.toSorted((left, right) => left.localeCompare(right));
|
||||
}
|
||||
|
||||
export function resolveMissingPackBuildHint(missing: readonly string[]): string | null {
|
||||
const needsControlUiBuild = missing.includes("dist/control-ui/index.html");
|
||||
const needsRuntimeBuild = missing.some(
|
||||
(path) =>
|
||||
path !== "dist/control-ui/index.html" &&
|
||||
(path === "dist/build-info.json" || path.startsWith("dist/")),
|
||||
);
|
||||
|
||||
if (!needsControlUiBuild && !needsRuntimeBuild) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (needsControlUiBuild && needsRuntimeBuild) {
|
||||
return "release-check: build and Control UI artifacts are missing. Run `pnpm build && pnpm ui:build` before `pnpm release:check`.";
|
||||
}
|
||||
if (needsControlUiBuild) {
|
||||
return "release-check: Control UI artifacts are missing. Run `pnpm ui:build` before `pnpm release:check`.";
|
||||
}
|
||||
return "release-check: build artifacts are missing. Run `pnpm build` before `pnpm release:check`.";
|
||||
}
|
||||
|
||||
export function collectForbiddenPackPaths(paths: Iterable<string>): string[] {
|
||||
return [...paths]
|
||||
.filter(
|
||||
@@ -817,17 +838,9 @@ async function main() {
|
||||
for (const path of missing) {
|
||||
console.error(` - ${path}`);
|
||||
}
|
||||
if (
|
||||
missing.some(
|
||||
(path) =>
|
||||
path === "dist/build-info.json" ||
|
||||
path === "dist/control-ui/index.html" ||
|
||||
path.startsWith("dist/"),
|
||||
)
|
||||
) {
|
||||
console.error(
|
||||
"release-check: build artifacts are missing. Run `pnpm build` before `pnpm release:check`.",
|
||||
);
|
||||
const buildHint = resolveMissingPackBuildHint(missing);
|
||||
if (buildHint) {
|
||||
console.error(buildHint);
|
||||
}
|
||||
}
|
||||
if (forbidden.length > 0) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
createPackedBundledPluginPostinstallEnv,
|
||||
PACKED_CLI_SMOKE_COMMANDS,
|
||||
packageNameFromSpecifier,
|
||||
resolveMissingPackBuildHint,
|
||||
} from "../scripts/release-check.ts";
|
||||
import { PACKAGE_DIST_INVENTORY_RELATIVE_PATH } from "../src/infra/package-dist-inventory.ts";
|
||||
import { bundledDistPluginFile, bundledPluginFile } from "./helpers/bundled-plugin-paths.js";
|
||||
@@ -585,6 +586,32 @@ describe("collectMissingPackPaths", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveMissingPackBuildHint", () => {
|
||||
it("points missing runtime build artifacts at pnpm build", () => {
|
||||
expect(resolveMissingPackBuildHint(["dist/build-info.json"])).toBe(
|
||||
"release-check: build artifacts are missing. Run `pnpm build` before `pnpm release:check`.",
|
||||
);
|
||||
});
|
||||
|
||||
it("points missing Control UI artifacts at pnpm ui:build", () => {
|
||||
expect(resolveMissingPackBuildHint(["dist/control-ui/index.html"])).toBe(
|
||||
"release-check: Control UI artifacts are missing. Run `pnpm ui:build` before `pnpm release:check`.",
|
||||
);
|
||||
});
|
||||
|
||||
it("points combined runtime and Control UI misses at both build commands", () => {
|
||||
expect(
|
||||
resolveMissingPackBuildHint(["dist/build-info.json", "dist/control-ui/index.html"]),
|
||||
).toBe(
|
||||
"release-check: build and Control UI artifacts are missing. Run `pnpm build && pnpm ui:build` before `pnpm release:check`.",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not emit a build hint for unrelated packed paths", () => {
|
||||
expect(resolveMissingPackBuildHint(["scripts/npm-runner.mjs"])).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("collectPackUnpackedSizeErrors", () => {
|
||||
it("accepts pack results within the unpacked size budget", () => {
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user