parsePubspec static method

Map<String, String> parsePubspec(
  1. String projectRoot
)

Parse pubspec.yaml — returns { name, version }.

Implementation

static Map<String, String> parsePubspec(String projectRoot) {
  final content =
      File(p.join(projectRoot, 'pubspec.yaml')).readAsStringSync();
  final yaml = loadYaml(content) as Map;
  return {
    'name': yaml['name']?.toString() ?? '',
    'version': (yaml['version']?.toString() ?? '1.0.0').split('+').first,
  };
}