Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/firehose/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 0.13.2-wip

- Run `pub get` before `dart format` in `groundskeeper`.
- Add `groundskeeper` executable to format and fix packages.
- Add parameter to `locatePackages` to allow locating all packages with `publish_to: none`.
- Inlined GitHub comment management into `firehose` as a first-class executable.
Expand Down
32 changes: 17 additions & 15 deletions pkgs/firehose/bin/groundskeeper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void main(List<String> args) async {
final argResults = parser.parse(args);

final targetDirectory = Directory.current;
final pkgPath = targetDirectory.path;
final runFormat = argResults['format'] != 'false';
final runFix = argResults['fix'] != 'false';

Expand All @@ -31,23 +32,9 @@ Error: Run fix is enabled, but no pubspec.yaml found in ${targetDirectory.path}'
exit(1);
}

if (runFormat) {
print('Running dart format...');
final result = await Process.run(
'dart',
['format', targetDirectory.path],
);
stdout.write(result.stdout);
stderr.write(result.stderr);
if (result.exitCode != 0) {
exit(result.exitCode);
}
}

if (runFix) {
if (isPackage) {
Comment thread
mosuem marked this conversation as resolved.
final repo = Repository(targetDirectory);
final pkg = Package(targetDirectory, repo);
final pkgPath = targetDirectory.path;

// Detect if it is a Flutter package
final isFlutter = pkg.pubspec.dependencies.containsKey('flutter') ||
Expand All @@ -65,7 +52,22 @@ Error: Run fix is enabled, but no pubspec.yaml found in ${targetDirectory.path}'
print('Error: $tool pub get failed in $pkgPath');
exit(pubGetResult.exitCode);
}
}

if (runFormat) {
print('Running dart format...');
final result = await Process.run(
'dart',
['format', pkgPath],
);
stdout.write(result.stdout);
stderr.write(result.stderr);
if (result.exitCode != 0) {
exit(result.exitCode);
}
}

if (runFix) {
print(' Running dart fix --apply...');
final fixResult = await Process.run('dart', ['fix', '--apply'],
workingDirectory: pkgPath);
Expand Down
Loading