#!/usr/bin/env bun import { promises as fs } from "node:fs"; import { build, defineConfig } from "tsup"; import { pick } from "lodash"; import pkg from "../package.json" with { type: "json" }; const tsupConfig = defineConfig({ outDir: "dist", splitting: false, sourcemap: false, dts: true, treeshake: true, platform: "node", define: { "process.env.BABEL_TAILWIND_BUILD": "true", }, banner: { js: "/* eslint-disable */", }, }); await Promise.all([ build({ ...tsupConfig, entry: ["src/classed.tsx"], outDir: "dist", external: ["react", "react/jsx-runtime", "clsx"], format: "esm", clean: true, }), build({ ...tsupConfig, entry: ["src/index.ts"], }), Bun.write( "dist/package.json", JSON.stringify( pick(pkg, ["name", "version", "license", "dependencies", "author"]), null, 2 ) ), Bun.write(`dist/base.d.ts`, `/**\n * \`@tailwind base\` component.\n */\nexport {};`), ]); await Promise.all([ fs.copyFile("README.md", "dist/README.md"), fs.copyFile("LICENSE.md", "dist/LICENSE.md"), ]); process.exit(0);