ci: skip bundled dts in artifact build

This commit is contained in:
Peter Steinberger
2026-05-29 23:56:21 +01:00
parent b1e5c9d7fa
commit 0e6937cc1b
2 changed files with 32 additions and 5 deletions

View File

@@ -156,6 +156,14 @@ export const BUILD_ALL_PROFILES = {
],
};
export const BUILD_ALL_PROFILE_STEP_ENV = {
ciArtifacts: {
tsdown: {
OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "1",
},
},
};
export function resolveBuildAllSteps(profile = "full") {
const labels = BUILD_ALL_PROFILES[profile];
if (!labels) {
@@ -166,19 +174,24 @@ export function resolveBuildAllSteps(profile = "full") {
const missing = labels.filter((label) => !BUILD_ALL_STEPS.some((step) => step.label === label));
throw new Error(`Build profile ${profile} references unknown steps: ${missing.join(", ")}`);
}
return selected;
const envOverrides = BUILD_ALL_PROFILE_STEP_ENV[profile] ?? {};
return selected.map((step) => {
const env = envOverrides[step.label];
return env ? { ...step, env: { ...(step.env ?? {}), ...env } } : step;
});
}
function resolveStepEnv(step, env, platform) {
const stepEnv = step.env ? { ...env, ...step.env } : env;
if (platform !== "win32" || !step.windowsNodeOptions) {
return env;
return stepEnv;
}
const currentNodeOptions = env.NODE_OPTIONS?.trim() ?? "";
const currentNodeOptions = stepEnv.NODE_OPTIONS?.trim() ?? "";
if (currentNodeOptions.includes(step.windowsNodeOptions)) {
return env;
return stepEnv;
}
return {
...env,
...stepEnv,
NODE_OPTIONS: currentNodeOptions
? `${currentNodeOptions} ${step.windowsNodeOptions}`
: step.windowsNodeOptions,

View File

@@ -4,6 +4,7 @@ import path from "node:path";
import { describe, expect, it } from "vitest";
import {
BUILD_ALL_PROFILES,
BUILD_ALL_PROFILE_STEP_ENV,
BUILD_ALL_STEPS,
formatBuildAllDuration,
formatBuildAllTimingSummary,
@@ -195,6 +196,19 @@ describe("resolveBuildAllSteps", () => {
]);
});
it("skips bundled tsdown declarations for CI artifacts", () => {
const tsdown = resolveBuildAllSteps("ciArtifacts").find((step) => step.label === "tsdown");
expect(BUILD_ALL_PROFILE_STEP_ENV.ciArtifacts.tsdown).toEqual({
OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "1",
});
expect(
resolveBuildAllStep(tsdown!, { env: { OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "0" } }).options.env,
).toMatchObject({
OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "1",
});
});
it("uses a minimal built runtime profile for gateway watch regression", () => {
expect(resolveBuildAllSteps("gatewayWatch").map((step) => step.label)).toEqual([
"tsdown",