(theme: string, spinner: Ora)
| 31 | } |
| 32 | |
| 33 | export async function createCSSFile(theme: string, spinner: Ora) { |
| 34 | const fileName = "tailgrids.css"; |
| 35 | |
| 36 | try { |
| 37 | spinner.text = `Creating ${fileName}...`; |
| 38 | |
| 39 | const templatePath = path.resolve( |
| 40 | __dirname, |
| 41 | "./templates/themes", |
| 42 | `${theme}.css` |
| 43 | ); |
| 44 | |
| 45 | if (!existsSync(templatePath)) { |
| 46 | throw new Error(`Theme template not found for: "${theme}"`); |
| 47 | } |
| 48 | |
| 49 | await fs.copyFile(templatePath, fileName); |
| 50 | |
| 51 | spinner.succeed( |
| 52 | `Created ${chalk.cyan(fileName)} with ${theme} theme variables` |
| 53 | ); |
| 54 | } catch (error) { |
| 55 | spinner.fail(`Failed to create ${fileName}`); |
| 56 | if (error instanceof Error) { |
| 57 | throw new Error(`Could not create CSS file: ${error.message}`); |
| 58 | } |
| 59 | throw new Error("Could not create CSS file. Check write permissions."); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | export async function replaceMainCSSFile( |
| 64 | theme: string, |
no outgoing calls
no test coverage detected