#!/usr/bin/env tsx
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Read the CSS file
const cssPath = path.resolve(__dirname, "../ui/style.css");
const cssContent = fs.readFileSync(cssPath, "utf-8");
// Escape the CSS content for embedding in a TypeScript string
const escapedCss = cssContent
.replace(/\\/g, "\\\\")
.replace(/`/g, "\\`")
.replace(/\$/g, "\\$");
// Generate the TypeScript module
const tsContent = `// This file is auto-generated by buildStyles.ts
// DO NOT EDIT MANUALLY
export const EMBEDDED_STYLES = \`${escapedCss}\`;
`;
// Write the generated file
const outputPath = path.resolve(__dirname, "../ui/embeddedStyles.ts");
fs.writeFileSync(outputPath, tsContent, "utf-8");
console.log("✅ Generated embeddedStyles.ts with embedded CSS");