( from: string, to: string, targets: Array<string | [string, string | string[]]>, )
| 115 | } |
| 116 | |
| 117 | export function massCopy( |
| 118 | from: string, |
| 119 | to: string, |
| 120 | targets: Array<string | [string, string | string[]]>, |
| 121 | ) { |
| 122 | const jobs: [string, string][] = [] |
| 123 | for (const target of targets) { |
| 124 | if (typeof target === 'string') { |
| 125 | jobs.push([dir(from, target), dir(to, target)]) |
| 126 | } else { |
| 127 | const [fromFile, toFile] = target |
| 128 | if (typeof toFile === 'string') { |
| 129 | jobs.push([dir(from, fromFile), dir(to, toFile)]) |
| 130 | } else { |
| 131 | for (const toFileName of toFile) { |
| 132 | jobs.push([dir(from, fromFile), dir(to, toFileName)]) |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | return Promise.all(jobs.map(([from, to]) => fs.copy(from, to))) |
| 139 | } |
| 140 | |
| 141 | /* eslint-disable max-len */ |
| 142 | /** |
no test coverage detected
searching dependent graphs…