@@ -80,6 +80,20 @@ function fenced(lang, body) {
8080 return `${ lang } \n${ body . trimEnd ( ) } \n\`\`\`` ;
8181}
8282
83+ /**
84+ * Keep only the `dependencies { ... }` block from the Android response. The Wizard
85+ * prepends a `repositories { ... }` block (already documented separately in the README's
86+ * "Add repository into android/build.gradle" section) and a build.gradle.kts label
87+ * comment, which would otherwise duplicate the repository setup and mislead readers.
88+ */
89+ function androidDependenciesOnly ( text ) {
90+ const idx = text . search ( / ^ d e p e n d e n c i e s \s * \{ / m) ;
91+ if ( idx === - 1 ) {
92+ throw new Error ( 'Could not find `dependencies {` in the Android API response' ) ;
93+ }
94+ return text . slice ( idx ) ;
95+ }
96+
8397/**
8498 * Inject the React Native linking lines into the iOS Podfile target. The Wizard renders
8599 * a plain native target (`target 'Sample' do ... end`); RN apps additionally need the
@@ -128,7 +142,7 @@ async function main() {
128142
129143 // android uses kts (`kt`) verbatim; ios ignores the language, returns Ruby, and gets
130144 // the React Native linking injected into its target.
131- const android = await fetchDependencyBlock ( 'android' , version , 'kt' ) ;
145+ const android = androidDependenciesOnly ( await fetchDependencyBlock ( 'android' , version , 'kt' ) ) ;
132146 const ios = addReactNativeLinking ( await fetchDependencyBlock ( 'ios' , version ) ) ;
133147
134148 let readme = await readFile ( README , 'utf8' ) ;
0 commit comments