backupPubspec method

void backupPubspec({
  1. String? filePath,
  2. String? targetPath,
})

Backup the pubspec.yaml

Implementation

void backupPubspec({String? filePath, String? targetPath}) {
  try {
    log("Backing up $filePath");
    File(filePath ?? 'pubspec.yaml').copySync(
      targetPath ?? 'pubspec_backup.yaml',
    );
  } catch (exception) {
    stderr.writeln("Couldn't backup main pubspec.yaml");
    stderr.writeln(exception);
  }
}