@@ -97,40 +97,15 @@ function cleanupEmptyFilesAndFolders(filepath /*: string */) {
9797 }
9898}
9999
100- function readGeneratedAutolinkingOutput (
101- baseOutputPath /*: string */ ,
102- ) /*: $FlowFixMe */ {
103- // NOTE: Generated by scripts/cocoapods/autolinking.rb in list_native_modules (called by use_native_modules)
104- const autolinkingGeneratedPath = path . resolve (
105- baseOutputPath ,
106- 'build/generated/autolinking/autolinking.json' ,
107- ) ;
108- if ( fs . existsSync ( autolinkingGeneratedPath ) ) {
109- // $FlowFixMe[unsupported-syntax]
110- return require ( autolinkingGeneratedPath ) ;
111- } else {
112- codegenLog (
113- `Could not find generated autolinking output at: ${ autolinkingGeneratedPath } ` ,
114- ) ;
115- return null ;
116- }
117- }
118-
119- function readReactNativeConfig (
120- projectRoot /*: string */ ,
121- baseOutputPath /*: string */ ,
122- ) /*: $FlowFixMe */ {
123- const autolinkingOutput = readGeneratedAutolinkingOutput ( baseOutputPath ) ;
100+ function readReactNativeConfig ( projectRoot /*: string */ ) /*: $FlowFixMe */ {
124101 const rnConfigFilePath = path . resolve ( projectRoot , 'react-native.config.js' ) ;
125- if ( autolinkingOutput ) {
126- return autolinkingOutput ;
127- } else if ( fs . existsSync ( rnConfigFilePath ) ) {
128- // $FlowIgnore[unsupported-syntax]
129- return require ( rnConfigFilePath ) ;
130- } else {
131- codegenLog ( `Could not find React Native config at: ${ rnConfigFilePath } ` ) ;
102+
103+ if ( ! fs . existsSync ( rnConfigFilePath ) ) {
132104 return { } ;
133105 }
106+
107+ // $FlowIgnore[unsupported-syntax]
108+ return require ( rnConfigFilePath ) ;
134109}
135110
136111/**
@@ -139,23 +114,17 @@ function readReactNativeConfig(
139114function findCodegenEnabledLibraries (
140115 pkgJson /*: $FlowFixMe */ ,
141116 projectRoot /*: string */ ,
142- baseOutputPath /*: string */ ,
143117 reactNativeConfig /*: $FlowFixMe */ ,
144118) /*: Array<$FlowFixMe> */ {
145119 const projectLibraries = findProjectRootLibraries ( pkgJson , projectRoot ) ;
146120 if ( pkgJsonIncludesGeneratedCode ( pkgJson ) ) {
147121 return projectLibraries ;
148122 } else {
149- const libraries = [ ...projectLibraries ] ;
150- // If we ran autolinking, we shouldn't try to run our own "autolinking-like"
151- // library discovery
152- if ( ! readGeneratedAutolinkingOutput ( baseOutputPath ) ) {
153- libraries . push ( ...findExternalLibraries ( pkgJson , projectRoot ) ) ;
154- }
155- libraries . push (
123+ return [
124+ ...projectLibraries ,
125+ ...findExternalLibraries ( pkgJson , projectRoot ) ,
156126 ...findLibrariesFromReactNativeConfig ( projectRoot , reactNativeConfig ) ,
157- ) ;
158- return libraries ;
127+ ] ;
159128 }
160129}
161130
0 commit comments