1
0
mirror of synced 2025-12-21 02:46:50 -05:00

update old script

This commit is contained in:
Sarah Schneider
2021-06-16 21:26:04 -04:00
parent 14394021fa
commit 36c54ea05f
2 changed files with 72 additions and 104 deletions

View File

@@ -0,0 +1,17 @@
const path = require('path')
const walk = require('walk-sync')
// [start-readme]
//
// A helper that returns an array of files for a given path and file extension.
//
// [end-readme]
module.exports = 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/'))
}