feat: add NPX CLI and OpenClaw build pipeline, optimize npm package size

Adds esbuild steps for npx-cli (57KB, Node.js ESM) and openclaw plugin
(12KB). Creates .npmignore to exclude node_modules and Bun binary from
npm package, reducing pack size from 146MB to 2MB.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-02-26 23:56:34 -05:00
parent 85eb796b18
commit 3a09c1bb1a
5 changed files with 129 additions and 7 deletions
+5 -5
View File
@@ -66,14 +66,14 @@ export function claudeMemDataDirectory(): string {
/**
* Resolve the root of the installed npm package.
*
* The CLI entry point lives at `<pkg>/dist/cli/index.js`. Walking up
* from `import.meta.url` (or `__dirname` equivalent) we reach the
* package root where `plugin/` can be found.
* After bundling, the CLI entry point lives at `<pkg>/dist/npx-cli/index.js`.
* Walking up 2 levels from `import.meta.url` reaches the package root
* where `plugin/` and `package.json` can be found.
*/
export function npmPackageRootDirectory(): string {
const currentFilePath = fileURLToPath(import.meta.url);
// <pkg>/dist/npx-cli/utils/paths.js -> up 3 levels -> <pkg>
return join(dirname(currentFilePath), '..', '..', '..');
// <pkg>/dist/npx-cli/index.js -> up 2 levels -> <pkg>
return join(dirname(currentFilePath), '..', '..');
}
/**