Skip to content

Commit 1500b84

Browse files
committed
support passing an array of file extensions
1 parent e586baa commit 1500b84

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

script/helpers/walk-files.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import path from 'path'
1010
import walk from 'walk-sync'
1111

1212
export default function walkFiles(dir, ext, opts = {}) {
13+
const extensions = Array.isArray(ext) ? ext : [ext]
1314
const dirPath = path.posix.join(process.cwd(), dir)
1415
const walkSyncOpts = { includeBasePath: true, directories: false }
1516

1617
return walk(dirPath, walkSyncOpts)
17-
.filter((file) => file.endsWith(ext) && !file.endsWith('README.md'))
18+
.filter((file) => extensions.some((ext) => file.endsWith(ext)) && !file.endsWith('README.md'))
1819
.filter((file) => (opts.includeEarlyAccess ? file : !file.includes('/early-access/')))
1920
}

0 commit comments

Comments
 (0)