diff --git a/lib/src/services/pubspec_service.dart b/lib/src/services/pubspec_service.dart index f66bca8..f8ba633 100644 --- a/lib/src/services/pubspec_service.dart +++ b/lib/src/services/pubspec_service.dart @@ -1,21 +1,21 @@ import 'dart:io'; -import 'package:pubspec_yaml/pubspec_yaml.dart'; +import 'package:yaml/yaml.dart'; /// Provides functionality to interact with the pubspec in the current project class PubspecService { - late PubspecYaml pubspecYaml; + late YamlMap pubspecYaml; - /// Reads the pubpec and caches the value locally + /// Reads the pubspec and caches the value locally Future initialise({String? workingDirectory}) async { final bool hasWorkingDirectory = workingDirectory != null; // stdout.writeln('PubspecService - initialise from pubspec.yaml'); - final pubspecYamlContent = await File( - '${hasWorkingDirectory ? '$workingDirectory/' : ''}pubspec.yaml') - .readAsString(); - pubspecYaml = pubspecYamlContent.toPubspecYaml(); + final pubspecYamlContent = + await File('${hasWorkingDirectory ? '$workingDirectory/' : ''}pubspec.yaml').readAsString(); + + pubspecYaml = loadYaml(pubspecYamlContent) as YamlMap; // stdout.writeln('PubspecService - initialise complete'); } - String get getPackageName => pubspecYaml.name; + String get getPackageName => pubspecYaml['name']; } diff --git a/pubspec.yaml b/pubspec.yaml index 292c6d1..e0883b5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: mockito: ^5.4.3 mustache_template: ^2.0.0 path: ^1.8.1 - pubspec_yaml: ^3.1.0 + yaml: ^3.1.3 recase: ^4.0.0 json_annotation: ^4.8.1 ansicolor: ^2.0.2