feat(KB-131): bundle workspace dependencies into CLI for npm publish
- Replace tsc with tsup (esbuild) to inline @kb/* workspace code into a single dist/bin.js - Move @kb/core, @kb/dashboard, @kb/engine from dependencies to devDependencies - Add tsup.config.ts that copies dashboard client assets into dist/client/ - Add bundle output tests verifying shebang, inlined code, and no bare @kb/* imports - Add changeset for the bundled CLI build fix
This commit is contained in:
26
packages/cli/tsup.config.ts
Normal file
26
packages/cli/tsup.config.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineConfig } from "tsup";
|
||||
import { cpSync, existsSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const dashboardClientSrc = join(__dirname, "..", "dashboard", "dist", "client");
|
||||
const dashboardClientDest = join(__dirname, "dist", "client");
|
||||
|
||||
export default defineConfig({
|
||||
entry: ["src/bin.ts"],
|
||||
format: ["esm"],
|
||||
platform: "node",
|
||||
target: "node22",
|
||||
noExternal: [/^@kb\//],
|
||||
splitting: false,
|
||||
clean: true,
|
||||
onSuccess: async () => {
|
||||
if (existsSync(dashboardClientSrc)) {
|
||||
cpSync(dashboardClientSrc, dashboardClientDest, { recursive: true });
|
||||
console.log("Copied dashboard client assets to dist/client/");
|
||||
} else {
|
||||
console.warn("WARNING: Dashboard client assets not found at", dashboardClientSrc);
|
||||
}
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user