1
0
mirror of synced 2025-12-20 02:19:14 -05:00
Files
docs/script/helpers/walk-files.js
Kevin Heis b29e37318a Remove import x statements (#20594)
* Clear out most import x

* Update rimraf use

* Move up readme blocks in scripts
2021-07-29 20:28:30 +00:00

20 lines
580 B
JavaScript

#!/usr/bin/env node
// [start-readme]
//
// A helper that returns an array of files for a given path and file extension.
//
// [end-readme]
import path from 'path'
import walk from 'walk-sync'
export default function walkFiles(dir, ext, opts = {}) {
const dirPath = path.posix.join(process.cwd(), dir)
const walkSyncOpts = { includeBasePath: true, directories: false }
return walk(dirPath, walkSyncOpts)
.filter((file) => file.endsWith(ext) && !file.endsWith('README.md'))
.filter((file) => (opts.includeEarlyAccess ? file : !file.includes('/early-access/')))
}