{"size": 714, "ext": "js", "max_stars_repo_path": "cli/copyedit.js", "max_stars_repo_name": "fallonfarmer/dailygraphics-next", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "cli/copyedit.js", "max_issues_repo_name": "fallonfarmer/dailygraphics-next", "max_issues_repo_issues_event_min_datetime": "2020-08-05T20:55:07.000Z", "max_issues_repo_issues_event_max_datetime": "2020-08-05T21:02:45.000Z", "max_forks_repo_path": "cli/copyedit.js", "max_forks_repo_name": "fallonfarmer/dailygraphics-next", "max_forks_repo_forks_event_min_datetime": "2020-02-19T17:14:38.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-19T17:14:38.000Z"}
{"max_stars_count": null, "max_issues_count": 3, "max_forks_count": 1, "avg_line_length": 31.0434782609, "max_line_length": 89, "alphanum_fraction": 0.6638655462}
var fs = require("fs").promises;
var path = require("path");

var sheets = require("../lib/sheetOps");
var processHTML = require("../lib/processHTML");
var readJSON = require("../lib/readJSON");

module.exports = async function(config, argv, slugs) {
  var template = path.join(config.templatePath, "copyedit.html");
  config.user = await sheets.testConnection();
  for (var slug of slugs) {
    var manifest = await readJSON(path.join(config.graphicsPath, slug, "manifest.json"));
    var { sheet } = manifest;
    var COPY = await sheets.getSheet(sheet);
    var email = await processHTML(template, { sheet, slug, COPY, config })
    console.log(`
GRAPHIC FOR COPY EDIT: ${slug}
=============
${email}

`);
  }
}