warmUpCommands function

Future<void> warmUpCommands(
  1. Iterable keys, {
  2. void onProgress(
    1. int current,
    2. int total
    )?,
})

Implementation

Future<void> warmUpCommands(Iterable keys, {void Function(int current, int total)? onProgress}) async {
  // Sequential execution required for proper snapshot creation
  // Parallel execution interferes with Dart's compilation caching
  final commandsList = keys.toList();
  for (var i = 0; i < commandsList.length; i++) {
    final name = commandsList[i];
    await Process.run('dart', ['pub', 'global', 'run', 'generated_commands:$name', '--help'], runInShell: true);
    onProgress?.call(i + 1, commandsList.length);
  }
}