MCPcopy Create free account
hub / github.com/craftreactnative/ui / setupBabelConfig

Function setupBabelConfig

cli/src/utils/build-config.ts:143–158  ·  view source on GitHub ↗
(targetPath: string)

Source from the content-addressed store, hash-verified

141 * Main function to setup babel configuration with unistyles plugin
142 */
143export 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}

Callers 1

initCommandFunction · 0.90

Calls 4

detectRootFolderFunction · 0.90
babelConfigExistsFunction · 0.85
createBabelConfigFunction · 0.85

Tested by

no test coverage detected