chore(openclaw): add tsup build pipeline with ESM output and type declarations (#4335)
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
package-manager-strict-version=false
|
||||||
|
approve-builds=esbuild
|
||||||
+1
-1
@@ -138,7 +138,7 @@ class PlatformProvider implements Mem0Provider {
|
|||||||
|
|
||||||
private async _init(): Promise<void> {
|
private async _init(): Promise<void> {
|
||||||
const { default: MemoryClient } = await import("mem0ai");
|
const { default: MemoryClient } = await import("mem0ai");
|
||||||
const opts: Record<string, string> = { apiKey: this.apiKey };
|
const opts: { apiKey: string; org_id?: string; project_id?: string } = { apiKey: this.apiKey };
|
||||||
if (this.orgId) opts.org_id = this.orgId;
|
if (this.orgId) opts.org_id = this.orgId;
|
||||||
if (this.projectId) opts.project_id = this.projectId;
|
if (this.projectId) opts.project_id = this.projectId;
|
||||||
this.client = new MemoryClient(opts);
|
this.client = new MemoryClient(opts);
|
||||||
|
|||||||
Vendored
+30
@@ -0,0 +1,30 @@
|
|||||||
|
declare module "openclaw/plugin-sdk" {
|
||||||
|
export interface OpenClawPluginApi {
|
||||||
|
pluginConfig: Record<string, unknown>;
|
||||||
|
logger: {
|
||||||
|
info(msg: string): void;
|
||||||
|
warn(msg: string): void;
|
||||||
|
error(msg: string): void;
|
||||||
|
debug(msg: string): void;
|
||||||
|
};
|
||||||
|
resolvePath(p: string): string;
|
||||||
|
registerTool(
|
||||||
|
definition: Record<string, unknown>,
|
||||||
|
metadata?: Record<string, unknown>,
|
||||||
|
): void;
|
||||||
|
on(
|
||||||
|
event: string,
|
||||||
|
handler: (event: any, ctx: any) => any,
|
||||||
|
): void;
|
||||||
|
registerCli(
|
||||||
|
handler: (context: { program: any }) => void,
|
||||||
|
options?: Record<string, unknown>,
|
||||||
|
): void;
|
||||||
|
registerService(service: {
|
||||||
|
id: string;
|
||||||
|
start: () => void;
|
||||||
|
stop: () => void;
|
||||||
|
}): void;
|
||||||
|
[key: string]: unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,19 @@
|
|||||||
"mem0",
|
"mem0",
|
||||||
"long-term-memory"
|
"long-term-memory"
|
||||||
],
|
],
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"import": "./dist/index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"build": "tsup",
|
||||||
"test": "vitest run"
|
"test": "vitest run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -24,6 +36,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/node": "^22.15.0",
|
||||||
|
"tsup": "^8.5.0",
|
||||||
|
"typescript": "^5.8.3",
|
||||||
"vitest": "^4.0.18"
|
"vitest": "^4.0.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+4105
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,5 @@
|
|||||||
|
approveBuilds: esbuild
|
||||||
|
|
||||||
|
onlyBuiltDependencies:
|
||||||
|
- better-sqlite3
|
||||||
|
- protobufjs
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"outDir": "dist",
|
||||||
|
"rootDir": ".",
|
||||||
|
"strict": false,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"types": ["node"],
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"verbatimModuleSyntax": true
|
||||||
|
},
|
||||||
|
"include": ["index.ts", "openclaw-plugin-sdk.d.ts"],
|
||||||
|
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { defineConfig } from "tsup";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
entry: ["index.ts"],
|
||||||
|
format: ["esm"],
|
||||||
|
dts: true,
|
||||||
|
sourcemap: true,
|
||||||
|
clean: true,
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user