xref: /expo/tools/src/vendoring/common.ts (revision f8111c10)
1import chalk from 'chalk';
2
3import logger from '../Logger';
4import { CopyFileOptions, copyFileWithTransformsAsync } from '../Transforms';
5
6/**
7 * Copies vendored files from source directory to target directory
8 * with transforms applied to their content and relative path.
9 */
10export async function copyVendoredFilesAsync(
11  files: Set<string>,
12  options: Omit<CopyFileOptions, 'sourceFile'>
13): Promise<void> {
14  for (const sourceFile of files) {
15    const { targetFile } = await copyFileWithTransformsAsync({ sourceFile, ...options });
16
17    if (sourceFile !== targetFile) {
18      logger.log('�� Renamed %s to %s', chalk.magenta(sourceFile), chalk.magenta(targetFile));
19    }
20  }
21}
22