build: exclude private QA from npm package

This commit is contained in:
Peter Steinberger
2026-04-15 09:38:45 -07:00
parent 78ac118427
commit 229eb72cf6
30 changed files with 539 additions and 86 deletions

View File

@@ -4,6 +4,7 @@ import { defineConfig, type UserConfig } from "tsdown";
import {
collectBundledPluginBuildEntries,
listBundledPluginRuntimeDependencies,
NON_PACKAGED_BUNDLED_PLUGIN_DIRS,
} from "./scripts/lib/bundled-plugin-build-entries.mjs";
import { buildPluginSdkEntrySources } from "./scripts/lib/plugin-sdk-entries.mjs";
@@ -92,6 +93,7 @@ function nodeBuildConfig(config: UserConfig): UserConfig {
const bundledPluginBuildEntries = collectBundledPluginBuildEntries();
const bundledPluginRuntimeDependencies = listBundledPluginRuntimeDependencies();
const shouldBuildPrivateQaEntries = process.env.OPENCLAW_BUILD_PRIVATE_QA === "1";
function buildBundledHookEntries(): Record<string, string> {
const hooksRoot = path.join(process.cwd(), "src", "hooks", "bundled");
@@ -235,7 +237,9 @@ const stagedBundledPluginBuildEntries = bundledPluginBuildEntries.filter(({ pack
shouldStageBundledPluginRuntimeDependencies(packageJson),
);
const rootBundledPluginBuildEntries = bundledPluginBuildEntries.filter(
({ packageJson }) => !shouldStageBundledPluginRuntimeDependencies(packageJson),
({ id, packageJson }) =>
!shouldStageBundledPluginRuntimeDependencies(packageJson) &&
(shouldBuildPrivateQaEntries || !NON_PACKAGED_BUNDLED_PLUGIN_DIRS.has(id)),
);
function buildUnifiedDistEntries(): Record<string, string> {
@@ -249,6 +253,12 @@ function buildUnifiedDistEntries(): Record<string, string> {
source,
]),
),
...(shouldBuildPrivateQaEntries
? {
"plugin-sdk/qa-lab": "src/plugin-sdk/qa-lab.ts",
"plugin-sdk/qa-runtime": "src/plugin-sdk/qa-runtime.ts",
}
: {}),
...listBundledPluginEntrySources(rootBundledPluginBuildEntries),
...bundledHookEntries,
};