import { execSync } from "node:child_process";
import { rmSync } from "node:fs";
import * as esbuild from "esbuild";
rmSync("dist-js", { recursive: true, force: true });
await esbuild.build({
entryPoints: ["guest-js/index.ts"],
bundle: true,
format: "esm",
outfile: "dist-js/index.js",
external: ["@tauri-apps/api", "@tauri-apps/api/core"],
platform: "browser",
target: "es2021",
});
await esbuild.build({
entryPoints: ["guest-js/index.ts"],
bundle: true,
format: "cjs",
outfile: "dist-js/index.cjs",
external: ["@tauri-apps/api", "@tauri-apps/api/core"],
platform: "browser",
target: "es2021",
});
execSync("tsc --project tsconfig.json --emitDeclarationOnly", {
stdio: "inherit",
});