async function compileDiagram (workflow, file, format, { puppeteerConfigFile } = {}) {
  const result = file.replace(/\.(?:mmd|md|markdown)$/, '.' + format)

  const args = [
    'src/cli.js',
    '-i',
    join(workflow, file),
    '-o',
    out + '/' + result,
    '-c',
    join(workflow, 'config.json'),
    '-b',
    'lightgray'
  ]

  if (puppeteerConfigFile) {
    args.push('--puppeteerConfigFile', join(workflow, puppeteerConfigFile))
  }

  // execFile will throw with stderr if there is a non-zero exit code
  const output = await promisify(execFile)('node', args)

  if (output.stderr) { // should never happen, so log it if it does happen
    // eslint-disable-next-line no-console
    console.warn(`Running ${args} succeeded but output the following to stderr: ${output.stderr}`)
  }
  return output
}
Process workflow into specified format file

@param {string} workflow - Workflow folder.
@param {string} file - Name of mermaid input file relative to workflow folder.
@param {"svg" | "pdf" | "png" | "md"} format - Format of output file.
@param {Object} [options] - Optional options.
@param {string} [options.puppeteerConfigFile] - If set, puppeteerConfigFile.
Must be relative to workflow folder.
@throws {Error} if mmdc fails to launch, or if it has exitCode != 0