From fea89cd384dfb06648a4c44e005170675394dbf5 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 22 May 2026 14:16:37 +0100 Subject: [PATCH] ci(release): bypass pnpm for tsdown package build --- scripts/tsdown-build.mjs | 31 +++++++++++++++++++++---------- test/scripts/tsdown-build.test.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/scripts/tsdown-build.mjs b/scripts/tsdown-build.mjs index 10800a411d5..c0ab35e7580 100644 --- a/scripts/tsdown-build.mjs +++ b/scripts/tsdown-build.mjs @@ -257,17 +257,28 @@ export function createTsdownOutputScanner(params = {}) { export function resolveTsdownBuildInvocation(params = {}) { const env = resolveTsdownEnv(params.env ?? process.env); + const tsdownArgs = [ + "--config-loader", + "unrun", + "--logLevel", + logLevel, + "--no-clean", + ...extraArgs, + ]; + if (env.OPENCLAW_BUILD_ALL_NO_PNPM === "1") { + return { + command: params.nodeExecPath ?? process.execPath, + args: ["node_modules/tsdown/dist/run.mjs", ...tsdownArgs], + options: { + stdio: ["ignore", "pipe", "pipe"], + shell: false, + windowsVerbatimArguments: undefined, + env, + }, + }; + } const runner = resolvePnpmRunner({ - pnpmArgs: [ - "exec", - "tsdown", - "--config-loader", - "unrun", - "--logLevel", - logLevel, - "--no-clean", - ...extraArgs, - ], + pnpmArgs: ["exec", "tsdown", ...tsdownArgs], nodeExecPath: params.nodeExecPath ?? process.execPath, npmExecPath: params.npmExecPath ?? env.npm_execpath, comSpec: params.comSpec ?? env.ComSpec, diff --git a/test/scripts/tsdown-build.test.ts b/test/scripts/tsdown-build.test.ts index 1039a573050..b471fcab32c 100644 --- a/test/scripts/tsdown-build.test.ts +++ b/test/scripts/tsdown-build.test.ts @@ -69,6 +69,34 @@ describe("resolveTsdownBuildInvocation", () => { expect(result.options.env.NODE_OPTIONS).toBe("--trace-warnings --max-old-space-size=8192"); }); + it("can run tsdown without invoking pnpm", () => { + const result = resolveTsdownBuildInvocation({ + nodeExecPath: "/usr/bin/node", + env: { OPENCLAW_BUILD_ALL_NO_PNPM: "1" }, + }); + + expect(result).toEqual({ + command: "/usr/bin/node", + args: [ + "node_modules/tsdown/dist/run.mjs", + "--config-loader", + "unrun", + "--logLevel", + "warn", + "--no-clean", + ], + options: { + stdio: ["ignore", "pipe", "pipe"], + shell: false, + windowsVerbatimArguments: undefined, + env: { + NODE_OPTIONS: "--max-old-space-size=6144", + OPENCLAW_BUILD_ALL_NO_PNPM: "1", + }, + }, + }); + }); + it("keeps source-checkout prune best-effort", () => { const warn = vi.spyOn(console, "warn").mockImplementation(() => {}); const rmSync = vi.spyOn(fs, "rmSync");