import fs from 'fs' export const buildDtsFile = (dtsPath: string, stringifiedThemes: string) => { const oldDtsContent = fs.existsSync(dtsPath) ? fs.readFileSync(dtsPath, 'utf-8') : '' const dtsContent = [ `// NOTE: This file is generated by uniwind and it should not be edited manually.`, `/// `, '', `declare module 'uniwind' {`, ` export interface UniwindConfig {`, ` themes: readonly ${stringifiedThemes}`, ` }`, `}`, '', `export {}`, '', ].join('\n') if (oldDtsContent === dtsContent) { return } fs.writeFileSync(dtsPath, dtsContent) }