add exports server/client
cb53eb80
1 file(s) · +10 −1
| 4 | 4 | import fs from "fs-extra"; |
|
| 5 | 5 | import pc from "picocolors"; |
|
| 6 | 6 | import yoctoSpinner from "yocto-spinner"; |
|
| 7 | - | import { honoClientTemplate, honoRpcTemplate } from "@/utils/templates"; |
|
| 8 | 7 | import type { ProjectOptions } from "@/types"; |
|
| 9 | 8 | import { EXTRAS_DIR } from "@/utils"; |
|
| 10 | 9 | import { nameGenerator } from "@/utils/name-generator"; |
|
| 10 | + | import { honoClientTemplate, honoRpcTemplate } from "@/utils/templates"; |
|
| 11 | 11 | ||
| 12 | 12 | export async function rpcInstaller( |
|
| 13 | 13 | options: Required<ProjectOptions>, |
|
| 34 | 34 | ||
| 35 | 35 | // Update the dev script to include parallel TypeScript compilation |
|
| 36 | 36 | serverPkg.scripts.dev = "bun --watch run src/index.ts & tsc --watch"; |
|
| 37 | + | ||
| 38 | + | // Add exports mapping for server/client subpath |
|
| 39 | + | serverPkg.exports = { |
|
| 40 | + | ...serverPkg.exports, |
|
| 41 | + | "./client": { |
|
| 42 | + | types: "./dist/client.d.ts", |
|
| 43 | + | default: "./dist/client.js", |
|
| 44 | + | }, |
|
| 45 | + | }; |
|
| 37 | 46 | ||
| 38 | 47 | await fs.writeJson(serverPkgPath, serverPkg, { spaces: 2 }); |
|
| 39 | 48 | ||