Skip to content

Commit

Permalink
chore(aft): Package aft should not have pubspec_overrides.yaml (#…
Browse files Browse the repository at this point in the history
…3733)

* chore(aft): Package `aft` should not have `pubspec_overrides.yaml`

Unlike every other package, aft must work without `pubspec_overrides`. It's counter productive to generate it and and its presence can interfere with local development.

* return
  • Loading branch information
dnys1 authored Sep 12, 2023
1 parent a27372b commit 79a9733
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/aft/lib/src/commands/link_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,29 @@ Map<String, String> _collectDependencies(
return dependencyPaths;
}

/// Removes the `pubspec_overrides.yaml` file for [package].
Future<void> _removePubspecOverride(PackageInfo package) async {
final pubspecOverrides = File(
path.join(package.path, 'pubspec_overrides.yaml'),
);
if (await pubspecOverrides.exists()) {
await pubspecOverrides.delete();
}
}

/// Creates a `pubspec_overrides.yaml` file for [package].
Future<void> _createPubspecOverride(
PackageInfo package,
Map<String, String> dependencyPaths,
// To be merged in
Map<String, Dependency> existingDependencyOverrides,
) async {
// Unlike every other package, aft must work without pubspec_overrides.
// It's counter productive to generate it and its presence can interfere
// with local development.
if (package.name == 'aft') {
return _removePubspecOverride(package);
}
final mergedOverrides = SplayTreeMap.of({
// Merge in existing dependency overrides since `pub` will only use the
// pubspec_overrides file if it exists.
Expand Down

0 comments on commit 79a9733

Please sign in to comment.