(targetPath: string)
| 141 | * Main function to setup babel configuration with unistyles plugin |
| 142 | */ |
| 143 | export async function setupBabelConfig(targetPath: string): Promise<void> { |
| 144 | const rootFolder = await detectRootFolder(targetPath); |
| 145 | const configExists = await babelConfigExists(targetPath); |
| 146 | |
| 147 | if (!configExists) { |
| 148 | // Create new babel.config.js assuming Expo |
| 149 | await createBabelConfig(targetPath, rootFolder); |
| 150 | } else { |
| 151 | // Modify existing babel.config.js |
| 152 | const wasModified = await addUnistylesToBabelConfig(targetPath, rootFolder); |
| 153 | if (!wasModified) { |
| 154 | // Plugin was already configured, nothing to do |
| 155 | return; |
| 156 | } |
| 157 | } |
| 158 | } |
no test coverage detected