Skip to content

Commit

Permalink
Fix patch-xcode
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Feb 8, 2021
1 parent f622315 commit acff485
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions patches/patch-xcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,29 @@ const path = require( 'path' );
const nodeModulesDir = path.join( __dirname, '../', 'node_modules' );

const fetchRNPackageDirs = ( dir ) => {
const dirList = fs.readdirSync( dir );
const dirList = fs.readdirSync( dir, { withFileTypes: true } );
const packageDirs = [];
dirList.forEach( ( packageName ) => {
const packageDir = path.join( dir, packageName );
if ( packageName.startsWith( '@' ) ) {
packageDirs.push( ...fetchRNPackageDirs( packageDir ) );
} else {
const files = fs.readdirSync( packageDir );
const podSpecs = files.filter( ( file ) =>
file.toLowerCase().endsWith( '.podspec' )
);
if ( podSpecs.length > 0 ) {
packageDirs.push( {
dir: packageDir,
files: podSpecs,
package: packageName,
} );
dirList
.filter( ( file ) => file.isDirectory() )
.map( ( file ) => file.name )
.forEach( ( packageName ) => {
const packageDir = path.join( dir, packageName );
if ( packageName.startsWith( '@' ) ) {
packageDirs.push( ...fetchRNPackageDirs( packageDir ) );
} else {
const files = fs.readdirSync( packageDir );
const podSpecs = files.filter( ( file ) =>
file.toLowerCase().endsWith( '.podspec' )
);
if ( podSpecs.length > 0 ) {
packageDirs.push( {
dir: packageDir,
files: podSpecs,
package: packageName,
} );
}
}
}
} );
} );
return packageDirs;
};

Expand Down

0 comments on commit acff485

Please sign in to comment.