33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
// scripts/make-dist.mjs
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const distDir = path.resolve("dist");
|
|
if (!fs.existsSync(distDir)) fs.mkdirSync(distDir, { recursive: true });
|
|
|
|
const indexJs = `/* Auto-generated by scripts/make-dist.mjs */
|
|
export { default as Button } from "../src/components/Button.astro";
|
|
export { default as Form } from "../src/components/Form.astro";
|
|
export { default as Field } from "../src/components/Field.astro";
|
|
export { default as MultiSelect } from "../src/components/MultiSelect.astro";
|
|
export { default as ThemeSwitcher } from "../src/components/ThemeSwitcher.astro";
|
|
export { default as ColorSwitcher } from "../src/components/ColorSwitcher.astro";
|
|
export { cn } from "../src/utils/cn.js";
|
|
`;
|
|
|
|
const indexDts = `/* Auto-generated types (lightweight) */
|
|
/// <reference types="astro/client" />
|
|
export const Button: any;
|
|
export const Form: any;
|
|
export const Field: any;
|
|
export const MultiSelect: any;
|
|
export const ThemeSwitcher: any;
|
|
export const ColorSwitcher: any;
|
|
export function cn(...classes: Array<string | number | false | null | undefined>): string;
|
|
`;
|
|
|
|
fs.writeFileSync(path.join(distDir, "index.js"), indexJs, "utf8");
|
|
fs.writeFileSync(path.join(distDir, "index.d.ts"), indexDts, "utf8");
|
|
|
|
console.log("🧱 Wrote dist/index.js and dist/index.d.ts");
|