Skip to content

Commit 0e6937c

Browse files
committed
ci: skip bundled dts in artifact build
1 parent b1e5c9d commit 0e6937c

2 files changed

Lines changed: 32 additions & 5 deletions

File tree

scripts/build-all.mjs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ export const BUILD_ALL_PROFILES = {
156156
],
157157
};
158158

159+
export const BUILD_ALL_PROFILE_STEP_ENV = {
160+
ciArtifacts: {
161+
tsdown: {
162+
OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "1",
163+
},
164+
},
165+
};
166+
159167
export function resolveBuildAllSteps(profile = "full") {
160168
const labels = BUILD_ALL_PROFILES[profile];
161169
if (!labels) {
@@ -166,19 +174,24 @@ export function resolveBuildAllSteps(profile = "full") {
166174
const missing = labels.filter((label) => !BUILD_ALL_STEPS.some((step) => step.label === label));
167175
throw new Error(`Build profile ${profile} references unknown steps: ${missing.join(", ")}`);
168176
}
169-
return selected;
177+
const envOverrides = BUILD_ALL_PROFILE_STEP_ENV[profile] ?? {};
178+
return selected.map((step) => {
179+
const env = envOverrides[step.label];
180+
return env ? { ...step, env: { ...(step.env ?? {}), ...env } } : step;
181+
});
170182
}
171183

172184
function resolveStepEnv(step, env, platform) {
185+
const stepEnv = step.env ? { ...env, ...step.env } : env;
173186
if (platform !== "win32" || !step.windowsNodeOptions) {
174-
return env;
187+
return stepEnv;
175188
}
176-
const currentNodeOptions = env.NODE_OPTIONS?.trim() ?? "";
189+
const currentNodeOptions = stepEnv.NODE_OPTIONS?.trim() ?? "";
177190
if (currentNodeOptions.includes(step.windowsNodeOptions)) {
178-
return env;
191+
return stepEnv;
179192
}
180193
return {
181-
...env,
194+
...stepEnv,
182195
NODE_OPTIONS: currentNodeOptions
183196
? `${currentNodeOptions} ${step.windowsNodeOptions}`
184197
: step.windowsNodeOptions,

test/scripts/build-all.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import path from "node:path";
44
import { describe, expect, it } from "vitest";
55
import {
66
BUILD_ALL_PROFILES,
7+
BUILD_ALL_PROFILE_STEP_ENV,
78
BUILD_ALL_STEPS,
89
formatBuildAllDuration,
910
formatBuildAllTimingSummary,
@@ -195,6 +196,19 @@ describe("resolveBuildAllSteps", () => {
195196
]);
196197
});
197198

199+
it("skips bundled tsdown declarations for CI artifacts", () => {
200+
const tsdown = resolveBuildAllSteps("ciArtifacts").find((step) => step.label === "tsdown");
201+
202+
expect(BUILD_ALL_PROFILE_STEP_ENV.ciArtifacts.tsdown).toEqual({
203+
OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "1",
204+
});
205+
expect(
206+
resolveBuildAllStep(tsdown!, { env: { OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "0" } }).options.env,
207+
).toMatchObject({
208+
OPENCLAW_RUN_NODE_SKIP_DTS_BUILD: "1",
209+
});
210+
});
211+
198212
it("uses a minimal built runtime profile for gateway watch regression", () => {
199213
expect(resolveBuildAllSteps("gatewayWatch").map((step) => step.label)).toEqual([
200214
"tsdown",

0 commit comments

Comments
 (0)