mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
build: reduce build log noise
This commit is contained in:
@@ -4,6 +4,42 @@ const env = {
|
||||
NODE_ENV: "production",
|
||||
};
|
||||
|
||||
function buildInputOptions(options: { onLog?: unknown; [key: string]: unknown }) {
|
||||
if (process.env.OPENCLAW_BUILD_VERBOSE === "1") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const previousOnLog = typeof options.onLog === "function" ? options.onLog : undefined;
|
||||
|
||||
return {
|
||||
...options,
|
||||
onLog(
|
||||
level: string,
|
||||
log: { code?: string },
|
||||
defaultHandler: (level: string, log: { code?: string }) => void,
|
||||
) {
|
||||
if (log.code === "PLUGIN_TIMINGS") {
|
||||
return;
|
||||
}
|
||||
if (typeof previousOnLog === "function") {
|
||||
previousOnLog(level, log, defaultHandler);
|
||||
return;
|
||||
}
|
||||
defaultHandler(level, log);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function nodeBuildConfig(config: Record<string, unknown>) {
|
||||
return {
|
||||
...config,
|
||||
env,
|
||||
fixedExtension: false,
|
||||
platform: "node",
|
||||
inputOptions: buildInputOptions,
|
||||
};
|
||||
}
|
||||
|
||||
const pluginSdkEntrypoints = [
|
||||
"index",
|
||||
"core",
|
||||
@@ -52,32 +88,20 @@ const pluginSdkEntrypoints = [
|
||||
] as const;
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
nodeBuildConfig({
|
||||
entry: "src/index.ts",
|
||||
env,
|
||||
fixedExtension: false,
|
||||
platform: "node",
|
||||
},
|
||||
{
|
||||
}),
|
||||
nodeBuildConfig({
|
||||
entry: "src/entry.ts",
|
||||
env,
|
||||
fixedExtension: false,
|
||||
platform: "node",
|
||||
},
|
||||
{
|
||||
}),
|
||||
nodeBuildConfig({
|
||||
// Ensure this module is bundled as an entry so legacy CLI shims can resolve its exports.
|
||||
entry: "src/cli/daemon-cli.ts",
|
||||
env,
|
||||
fixedExtension: false,
|
||||
platform: "node",
|
||||
},
|
||||
{
|
||||
}),
|
||||
nodeBuildConfig({
|
||||
entry: "src/infra/warning-filter.ts",
|
||||
env,
|
||||
fixedExtension: false,
|
||||
platform: "node",
|
||||
},
|
||||
{
|
||||
}),
|
||||
nodeBuildConfig({
|
||||
// Keep sync lazy-runtime channel modules as concrete dist files.
|
||||
entry: {
|
||||
"channels/plugins/agent-tools/whatsapp-login":
|
||||
@@ -91,27 +115,17 @@ export default defineConfig([
|
||||
"line/send": "src/line/send.ts",
|
||||
"line/template-messages": "src/line/template-messages.ts",
|
||||
},
|
||||
env,
|
||||
fixedExtension: false,
|
||||
platform: "node",
|
||||
},
|
||||
...pluginSdkEntrypoints.map((entry) => ({
|
||||
entry: `src/plugin-sdk/${entry}.ts`,
|
||||
outDir: "dist/plugin-sdk",
|
||||
env,
|
||||
fixedExtension: false,
|
||||
platform: "node" as const,
|
||||
})),
|
||||
{
|
||||
}),
|
||||
...pluginSdkEntrypoints.map((entry) =>
|
||||
nodeBuildConfig({
|
||||
entry: `src/plugin-sdk/${entry}.ts`,
|
||||
outDir: "dist/plugin-sdk",
|
||||
}),
|
||||
),
|
||||
nodeBuildConfig({
|
||||
entry: "src/extensionAPI.ts",
|
||||
env,
|
||||
fixedExtension: false,
|
||||
platform: "node",
|
||||
},
|
||||
{
|
||||
}),
|
||||
nodeBuildConfig({
|
||||
entry: ["src/hooks/bundled/*/handler.ts", "src/hooks/llm-slug-generator.ts"],
|
||||
env,
|
||||
fixedExtension: false,
|
||||
platform: "node",
|
||||
},
|
||||
}),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user