File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,15 @@ import path from "path";
22import fs from "fs" ;
33
44export const getJsonFilePaths = ( artifactPath : string ) : string [ ] => {
5- const files = fs . readdirSync ( artifactPath ) ;
6- const jsonFiles = files . filter (
7- ( filename ) => filename . split ( "." ) . pop ( ) ?. toLowerCase ( ) === "json" ,
8- ) ;
9- const jsonPaths = jsonFiles . map ( ( filename ) =>
10- path . join ( artifactPath , filename ) ,
11- ) ;
12- return jsonPaths ;
5+ let result : string [ ] = [ ]
6+ const files = fs . readdirSync ( artifactPath )
7+ files . forEach ( file => {
8+ const childPath = path . join ( artifactPath , file )
9+ if ( fs . statSync ( childPath ) . isDirectory ( ) ) {
10+ result . push ( ...getJsonFilePaths ( childPath ) )
11+ } else if ( path . extname ( childPath ) === ".json" ) {
12+ result . push ( childPath )
13+ }
14+ } )
15+ return result . sort ( )
1316} ;
You can’t perform that action at this time.
0 commit comments