import { $, Glob } from "bun"; import path from "path"; import { existsSync } from "fs"; // Cross-platform directory removal if (process.platform === "win32") { // await $`cmd /c "rmdir /s /q dist"`; } else { await $`rm -rf ./dist`; } // await Bun.build({ // entrypoints: ["./src/index.ts"], // env: "inline", // target: "bun", // outdir: `./dist`, // minify: true, // }); // Build all files in src for (const entrypoint of new Glob("./src/**/*.ts").scanSync()) { const parts = entrypoint.split(path.sep); const entrypointPath = path.join(...parts.slice(2, -1)); await Bun.build({ entrypoints: [entrypoint], target: "bun", outdir: path.join("dist", entrypointPath), env: "inline", minify: true, }); }