overridesText static method

String overridesText(
  1. JustProject project,
  2. List<Checkout> checkouts
)

The new text of project's pubspec_overrides.yaml with exactly checkouts in the dev-link block (none removes it).

Implementation

static String overridesText(JustProject project, List<Checkout> checkouts) {
  final current = project.readText(JustProject.overrides) ?? '';
  final editor = PubspecEditor.parse(current, marker: ManagedBlock.devLinks)
    ..setManaged('dependency_overrides', {
      for (final c in checkouts)
        c.name: PathDependency(pathFrom(project, c.path)),
    });
  return editor.text;
}