Build from repo root so @dbmole/core resolves; tsup bundles core into dist while undici/MCP SDK/zod/ssh2 ship as pruned node_modules. Mark ssh2 external in tsup: it is pulled in transitively by the bundled core and ships an optional native crypto addon (pure-JS fallback). Inlining would force esbuild to resolve a .node binary that need not exist on the target; node-gyp also cannot reliably build it on alpine. Externalizing lets ssh2 resolve from node_modules at runtime. npm nests undici under packages/esmole-mcp/node_modules, so the runtime stage copies both the root and the per-package node_modules.
16 lines
575 B
TypeScript
16 lines
575 B
TypeScript
import { defineConfig } from 'tsup'
|
|
|
|
export default defineConfig({
|
|
entry: ['src/index.ts'],
|
|
format: 'esm',
|
|
target: 'node20',
|
|
clean: true,
|
|
noExternal: [/@dbmole\/core/],
|
|
// ssh2 (pulled in transitively by the bundled @dbmole/core) ships a native
|
|
// crypto addon with a pure-JS fallback. Keep it external so esbuild never
|
|
// tries to inline its optional .node binary, which need not exist on the
|
|
// target. ssh2 resolves from node_modules at runtime and falls back to JS.
|
|
external: ['ssh2'],
|
|
banner: { js: '#!/usr/bin/env node' }
|
|
})
|