File size: 457 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { cpSync } from "node:fs"
import { join } from "node:path/posix"

export async function generateTypes(dir: string) {
  const { execa } = await import("execa")

  await execa("pnpm", ["tsc", "--project", "tsconfig.build.json"], {
    cwd: dir,
    stdio: "inherit",
  })

  try {
    cpSync(
      join(dir, "dist", "types", "index.d.ts"),
      join(dir, "dist", "types", "index.d.mts"),
    )
  } catch {
    console.log("No .dts file found")
  }
}