1import * as _ from 'lodash-es' 2import { resolve } from 'path' 9export const getFilesRec = async (rootPath: string, stopAfterLen=Infinity): Promise<absFileDirPath[]> => { 10 if (stopAfterLen <= 0) return [] 14 if (isDir === null) return [] 17 const dirsAndFiles = _.map(await readdir(rootPath), (fileName: string) => { 21 const dirs = _.compact(await allPromCalls(dirsAndFiles, async (path) => { 22 if (globallyIgnoredPaths.some(ignored => path.endsWith('/' + ignored))) return false 26 const directFiles = _.difference(dirsAndFiles, dirs) 28 let retFiles: absFileDirPath[] = [...directFiles] 31 ...(await getFilesRec(dir, stopAfterLen - retFiles.length)), 39export const globallyIgnoredPaths = [ 40 '.DS_Store', '.next', 'node_modules', 'tmp', 'dist',