writeTicketJson function

void writeTicketJson(
  1. Directory ticketDir,
  2. TicketJson ticket
)

Writes (overwriting) ticket to <ticketDir>/ticket.json.

The file lives in the ticket workspace, next to the repositories and not inside any of them, so git never sees it and the ticket description cannot reach a remote.

Implementation

void writeTicketJson(Directory ticketDir, TicketJson ticket) {
  if (!ticketDir.existsSync()) {
    ticketDir.createSync(recursive: true);
  }
  File(
    path.join(ticketDir.path, ticketJsonFileName),
  ).writeAsStringSync(ticket.toPrettyJson());
}