( globMatcher: string | string[] | undefined, workPath: string )
| 26 | } |
| 27 | |
| 28 | export async function gatherExtraFiles( |
| 29 | globMatcher: string | string[] | undefined, |
| 30 | workPath: string |
| 31 | ): Promise<Record<string, FileFsRef>> { |
| 32 | if (!globMatcher) return {}; |
| 33 | |
| 34 | debug( |
| 35 | `Gathering extra files for glob \`${JSON.stringify( |
| 36 | globMatcher |
| 37 | )}\` in ${workPath}` |
| 38 | ); |
| 39 | |
| 40 | if (Array.isArray(globMatcher)) { |
| 41 | const allMatches = await Promise.all( |
| 42 | globMatcher.map(pattern => glob(pattern, workPath)) |
| 43 | ); |
| 44 | |
| 45 | return allMatches.reduce((acc, matches) => ({ ...acc, ...matches }), {}); |
| 46 | } |
| 47 | |
| 48 | return glob(globMatcher, workPath); |
| 49 | } |
no test coverage detected