#!/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", 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"], external: ["postcss-selector-parser", "postcss", "stylis"], }), Bun.write( "dist/package.json", JSON.stringify( pick(pkg, ["name", "version", "license", "dependencies", "author"]), null, 2 ) ), ]); await Promise.all([ fs.copyFile("README.md", "dist/README.md"), fs.copyFile("LICENSE.md", "dist/LICENSE.md"), fs.copyFile("src/macro.d.ts", "dist/macro.d.ts"), Bun.write(`dist/base.d.ts`, `/**\n * \`@tailwind base\` component.\n */\nexport {};`), ]); process.exit(0);