diff --git a/Dockerfile b/Dockerfile index 7da884d562a..a022f90f225 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,7 +59,7 @@ RUN corepack enable ENV PNPM_HOME=/home/node/.local/share/pnpm ENV NPM_CONFIG_PREFIX=/home/node/.npm-global ENV GOPATH=/home/node/go -ENV PATH="${PNPM_HOME}:${NPM_CONFIG_PREFIX}/bin:${GOPATH}/bin:${PATH}" +ENV PATH="/usr/local/go/bin:${PNPM_HOME}:${NPM_CONFIG_PREFIX}/bin:${GOPATH}/bin:${PATH}" RUN mkdir -p "${PNPM_HOME}" "${NPM_CONFIG_PREFIX}/bin" "${GOPATH}/bin" && \ chown -R node:node /home/node/.local /home/node/.npm-global /home/node/go @@ -141,7 +141,7 @@ ENV GOPATH=/home/node/go ENV HOMEBREW_PREFIX=/home/linuxbrew/.linuxbrew ENV HOMEBREW_CELLAR=/home/linuxbrew/.linuxbrew/Cellar ENV HOMEBREW_REPOSITORY=/home/linuxbrew/.linuxbrew/Homebrew -ENV PATH="${PNPM_HOME}:${NPM_CONFIG_PREFIX}/bin:${GOPATH}/bin:${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:${PATH}" +ENV PATH="/usr/local/go/bin:${PNPM_HOME}:${NPM_CONFIG_PREFIX}/bin:${GOPATH}/bin:${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:${PATH}" RUN chown node:node /app RUN mkdir -p /home/node/.cache "${PNPM_HOME}" "${NPM_CONFIG_PREFIX}/bin" "${COREPACK_HOME}" \ "${GOPATH}/bin" "${HOMEBREW_REPOSITORY}" "${HOMEBREW_CELLAR}" "${HOMEBREW_PREFIX}/bin" && \ diff --git a/src/plugin-sdk/index.bundle.test.ts b/src/plugin-sdk/index.bundle.test.ts index 1f3afc8ab3a..ac61433eb26 100644 --- a/src/plugin-sdk/index.bundle.test.ts +++ b/src/plugin-sdk/index.bundle.test.ts @@ -1,22 +1,14 @@ import { execFile } from "node:child_process"; import fs from "node:fs/promises"; -import { createRequire } from "node:module"; import os from "node:os"; import path from "node:path"; import { pathToFileURL } from "node:url"; import { promisify } from "node:util"; import { describe, expect, it } from "vitest"; -import { - buildPluginSdkEntrySources, - buildPluginSdkPackageExports, - buildPluginSdkSpecifiers, - pluginSdkEntrypoints, -} from "./entrypoints.js"; +import { buildPluginSdkPackageExports, buildPluginSdkSpecifiers } from "./entrypoints.js"; const pluginSdkSpecifiers = buildPluginSdkSpecifiers(); const execFileAsync = promisify(execFile); -const require = createRequire(import.meta.url); -const tsdownModuleUrl = pathToFileURL(require.resolve("tsdown")).href; describe("plugin-sdk bundled exports", () => { it("emits importable bundled subpath entries", { timeout: 240_000 }, async () => { @@ -24,24 +16,9 @@ describe("plugin-sdk bundled exports", () => { const fixtureDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-plugin-sdk-consumer-")); try { - const buildScriptPath = path.join(fixtureDir, "build-plugin-sdk.mjs"); - await fs.writeFile( - buildScriptPath, - `import { build } from ${JSON.stringify(tsdownModuleUrl)}; -await build(${JSON.stringify({ - clean: true, - config: false, - dts: false, - entry: buildPluginSdkEntrySources(), - env: { NODE_ENV: "production" }, - fixedExtension: false, - logLevel: "error", - outDir, - platform: "node", - })}); -`, - ); - await execFileAsync(process.execPath, [buildScriptPath], { + // Reuse the repo's tsdown config so plugin-sdk bundle checks stay aligned + // with the production build graph and singleton boundaries. + await execFileAsync(process.execPath, ["scripts/tsdown-build.mjs", "--outDir", outDir], { cwd: process.cwd(), }); await fs.symlink( @@ -50,17 +27,12 @@ await build(${JSON.stringify({ "dir", ); - for (const entry of pluginSdkEntrypoints) { - const module = await import(pathToFileURL(path.join(outDir, `${entry}.js`)).href); - expect(module).toBeTypeOf("object"); - } - const packageDir = path.join(fixtureDir, "openclaw"); const consumerDir = path.join(fixtureDir, "consumer"); const consumerEntry = path.join(consumerDir, "import-plugin-sdk.mjs"); - await fs.mkdir(path.join(packageDir, "dist"), { recursive: true }); - await fs.symlink(outDir, path.join(packageDir, "dist", "plugin-sdk"), "dir"); + await fs.mkdir(packageDir, { recursive: true }); + await fs.symlink(outDir, path.join(packageDir, "dist"), "dir"); // Mirror the installed package layout so subpaths can resolve root deps. await fs.symlink( path.join(process.cwd(), "node_modules"),