Version 1.9 (#6)

This commit is contained in:
Simon Lecoq
2020-10-20 00:19:58 +02:00
committed by GitHub
parent 047d8630e6
commit f21273172d
23 changed files with 454 additions and 860 deletions

View File

@@ -2,6 +2,7 @@
import path from "path"
import fs from "fs"
import metrics from "../src/metrics.mjs"
import setup from "../src/setup.mjs"
import build from "../utils/build.mjs"
import octokit from "@octokit/graphql"
import OctokitRest from "@octokit/rest"
@@ -19,11 +20,9 @@
const graphql = octokit.graphql.defaults({headers:{authorization: `token ${token}`}})
const rest = new OctokitRest.Octokit({auth:token})
//Load svg template, style and query
const [template, style, query] = await Promise.all(["template.svg", "style.css", "query.graphql"].map(async file => `${await fs.promises.readFile(path.join("src", file))}`))
//Compute render
const rendered = await metrics({login:"lowlighter", q:{}}, {template, style, query, graphql, rest, plugins:{}})
const conf = await setup()
const rendered = await metrics({login:"lowlighter", q:{}}, {graphql, rest, plugins:{}, conf})
//Ensure it's a well-formed SVG image
const parsed = libxmljs.parseXml(rendered)