import { mkdirSync, rmSync, cpSync } from "fs"
import { fileURLToPath } from "url"
import path from "path"

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const projectRoot = path.resolve(__dirname, "..")
const srcDir = path.join(projectRoot, "src")
const distDir = path.join(projectRoot, "dist")

function build() {
  console.log("🧹 Cleaning dist directory...")
  rmSync(distDir, { recursive: true, force: true })

  console.log("📁 Creating dist directory...")
  mkdirSync(distDir, { recursive: true })

  console.log("📦 Copying source files to dist...")
  cpSync(srcDir, distDir, { recursive: true })

  console.log("✅ Build completed. Files copied to dist/")
}

build()

