includeExtraRootFiles method

Future<List<String>> includeExtraRootFiles(
  1. String outputDir
)

Copy extra root files to output directory

Implementation

Future<List<String>> includeExtraRootFiles(String outputDir) async {
  final included = <String>[];

  for (final fileName in config.extraRootFiles) {
    final sourcePath = p.join(workingDir, fileName);
    final sourceFile = File(sourcePath);

    if (sourceFile.existsSync()) {
      final destPath = p.join(outputDir, fileName);
      final destFile = File(destPath);

      // Only copy if not already at destination
      if (destPath != sourcePath) {
        await destFile.parent.create(recursive: true);
        await sourceFile.copy(destPath);
      }

      included.add(fileName);

      if (config.verbose) {
        verbose('Included root file: $fileName');
      }
    } else if (config.verbose) {
      warn('Root file not found: $fileName');
    }
  }

  return included;
}