File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const { exit } = require ( 'process' ) ;
2- const { exec, spawn } = require ( 'child_process' ) ;
2+ const { exec } = require ( 'child_process' ) ;
33const path = require ( 'path' ) ;
4+ const glob = require ( 'glob' ) ;
45
56function runFormatter ( files ) {
67 const command = `yarn clang-format -i ${ files } ` ;
@@ -20,24 +21,18 @@ if (argc > 2) {
2021 const files = process . argv . slice ( 2 ) . join ( ' ' ) ;
2122 runFormatter ( files ) ;
2223} else {
23- const find = spawn ( 'find' , [
24- path . join ( __dirname , '../packages/react-native-gesture-handler/apple' ) ,
25- '-iname' ,
26- '*.h' ,
27- '-o' ,
28- '-iname' ,
29- '*.m' ,
30- '-o' ,
31- '-iname' ,
32- '*.mm' ,
33- '-o' ,
34- '-iname' ,
35- '*.cpp' ,
36- ] ) ;
24+ const pattern = path . join (
25+ __dirname ,
26+ '../packages/react-native-gesture-handler/apple/**/*.{h,m,mm,cpp}'
27+ ) ;
3728
38- find . stdout . on ( 'data' , ( data ) => {
39- files = data . toString ( ) . trim ( ) . replace ( / \n / g, ' ' ) ;
29+ glob ( pattern , ( err , filesArray ) => {
30+ if ( err ) {
31+ console . error ( 'Error finding files:' , err ) ;
32+ return exit ( 1 ) ;
33+ }
4034
35+ const files = filesArray . join ( ' ' ) ;
4136 runFormatter ( files ) ;
4237 } ) ;
4338}
You can’t perform that action at this time.
0 commit comments