File tree Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ class PubService {
20
20
final packages = await _processService.runPubGlobalList ();
21
21
for (var package in packages) {
22
22
if (! package.contains (ksStackedCli)) continue ;
23
+
23
24
final splitResults = package.split (' ' );
24
25
if (splitResults.length > 2 ) {
25
26
version = splitResults[1 ];
@@ -28,7 +29,6 @@ class PubService {
28
29
}
29
30
break ;
30
31
}
31
-
32
32
return version;
33
33
}
34
34
Original file line number Diff line number Diff line change 1
1
import 'dart:io' ;
2
-
3
- import 'package:pubspec_yaml/pubspec_yaml.dart' ;
2
+ import 'package:yaml/yaml.dart' ;
4
3
5
4
/// Provides functionality to interact with the pubspec in the current project
6
5
class PubspecService {
7
- late PubspecYaml pubspecYaml;
6
+ late YamlMap pubspecYaml;
8
7
9
- /// Reads the pubpec and caches the value locally
8
+ /// Reads the pubspec and caches the value locally
10
9
Future <void > initialise ({String ? workingDirectory}) async {
11
10
final bool hasWorkingDirectory = workingDirectory != null ;
12
- // stdout.writeln('PubspecService - initialise from pubspec.yaml');
13
- final pubspecYamlContent = await File (
14
- '${hasWorkingDirectory ? '$workingDirectory /' : '' }pubspec.yaml' )
15
- .readAsString ();
16
- pubspecYaml = pubspecYamlContent.toPubspecYaml ();
17
- // stdout.writeln('PubspecService - initialise complete');
11
+
12
+ // Clean the working directory path from quotes and trim whitespace
13
+ final cleanWorkingDirectory = workingDirectory? .replaceAll ('"' , '' ).trim ();
14
+
15
+ final pubspecYamlContent =
16
+ await File ('${hasWorkingDirectory ? '$cleanWorkingDirectory /' : '' }pubspec.yaml' ).readAsString ();
17
+
18
+ pubspecYaml = loadYaml (pubspecYamlContent) as YamlMap ;
18
19
}
19
20
20
- String get getPackageName => pubspecYaml. name;
21
+ String get getPackageName => pubspecYaml[ ' name' ] ;
21
22
}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ dependencies:
14
14
mockito : ^5.4.3
15
15
mustache_template : ^2.0.0
16
16
path : ^1.8.1
17
- pubspec_yaml : ^3.1.0
17
+ yaml : ^3.1.3
18
18
recase : ^4.0.0
19
19
json_annotation : ^4.8.1
20
20
ansicolor : ^2.0.2
You can’t perform that action at this time.
0 commit comments