forked from laurentenhoor/devclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.mjs
More file actions
27 lines (24 loc) · 777 Bytes
/
build.mjs
File metadata and controls
27 lines (24 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* esbuild bundler — produces a single dist/index.js with all dependencies inlined.
*
* Eliminates the need for `npm install` at plugin install time.
* openclaw/plugin-sdk is kept external (peer dependency provided by the host).
*/
import esbuild from "esbuild";
import { readFileSync } from "node:fs";
const pkg = JSON.parse(readFileSync("package.json", "utf-8"));
await esbuild.build({
entryPoints: ["index.ts"],
bundle: true,
outfile: "dist/index.js",
format: "esm",
platform: "node",
target: "es2022",
external: ["openclaw", "openclaw/*"],
sourcemap: true,
define: {
__PLUGIN_VERSION__: JSON.stringify(pkg.version),
__PACKAGE_NAME__: JSON.stringify(pkg.name),
},
});
console.log(`Built dist/index.js (${pkg.name}@${pkg.version})`);