File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
packages/react-native-node-api-cmake/src Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -245,17 +245,16 @@ export const program = new Command("react-native-node-api-cmake")
245245 `Expected a directory at ${ tripletOutputPath } `
246246 ) ;
247247 // Expect binary file(s), either .node or .so
248- const result = readdirSync ( tripletOutputPath ) . map ( ( file ) => {
249- const filePath = path . join ( tripletOutputPath , file ) ;
250- if ( file . endsWith ( ".so" ) || file . endsWith ( ".node" ) ) {
251- return filePath ;
252- } else {
253- throw new Error (
254- `Expected a .node or .so file, but found ${ file } `
255- ) ;
256- }
257- } ) ;
258- assert . equal ( result . length , 1 , "Expected exactly library file" ) ;
248+ const result = readdirSync ( tripletOutputPath , {
249+ withFileTypes : true ,
250+ } )
251+ . filter (
252+ ( dirent ) =>
253+ dirent . isFile ( ) &&
254+ ( dirent . name . endsWith ( ".so" ) || dirent . name . endsWith ( ".node" ) )
255+ )
256+ . map ( ( dirent ) => path . join ( dirent . parentPath , dirent . name ) ) ;
257+ assert . equal ( result . length , 1 , "Expected exactly one library file" ) ;
259258 return [ triplet , result [ 0 ] ] as const ;
260259 } )
261260 ) as Record < AndroidTriplet , string > ;
You can’t perform that action at this time.
0 commit comments