Files
t3code/apps/server/scripts/bundle-client.mjs
T
Cursor AgentandTheo Browne 1990db7430 feat: make t3 package publishable for npx
- Remove private:true so package can be published to npm
- Add files field to limit published files to dist/
- Move @acme/contracts to devDependencies (bundled by tsup)
- Add @acme/renderer devDependency for turbo build ordering
- Add bundle-client.mjs: copies renderer build into dist/client/
- Update resolveStaticDir to check dist/client/ first (npx scenario),
  then fall back to monorepo layout (../../renderer/dist)
- Full build pipeline: contracts → renderer → server + bundle client

Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:27:47 +00:00

22 lines
727 B
JavaScript

/**
* Copies the built renderer into dist/client/ so the published npm package
* includes the web UI. This runs as a post-build step.
*/
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rendererDist = path.resolve(__dirname, "../../renderer/dist");
const target = path.resolve(__dirname, "../dist/client");
if (!fs.existsSync(rendererDist)) {
console.log(
"⚠ Renderer dist not found — skipping client bundle. Run `bun run --cwd apps/renderer build` first.",
);
process.exit(0);
}
fs.cpSync(rendererDist, target, { recursive: true });
console.log("✓ Bundled renderer into dist/client");