| 57 | }; |
| 58 | |
| 59 | const copyAll = async ({platforms, debug}) => { |
| 60 | const promises = []; |
| 61 | const enabledPlatforms = Object.values(PLATFORM).filter((platform) => platform !== PLATFORM.API && platforms[platform]); |
| 62 | for (const entry of copyEntries) { |
| 63 | if (entry.platforms && !entry.platforms.some((platform) => platforms[platform])) { |
| 64 | continue; |
| 65 | } |
| 66 | const files = await getPaths(`${srcDir}/${entry.path}`); |
| 67 | for (const file of files) { |
| 68 | for (const platform of enabledPlatforms) { |
| 69 | if (entry.platforms === undefined || entry.platforms.includes(platform)) { |
| 70 | promises.push(copyEntry(file, {debug, platform})); |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | await Promise.all(promises); |
| 76 | }; |
| 77 | |
| 78 | /** @type {(changedFiles: string[], watcher: FSWatcher, platforms: any) => Promise<void>} */ |
| 79 | const onChange = async (changedFiles, _, platforms) => { |