forked from MapComplete/MapComplete
Fix extractlayer and contributors script
This commit is contained in:
parent
d30ed22673
commit
890980d534
2 changed files with 18 additions and 5 deletions
|
@ -15,7 +15,7 @@ function main(args: string[]) {
|
||||||
const layerId = args[1]
|
const layerId = args[1]
|
||||||
|
|
||||||
const themePath = "./assets/themes/" + themeId + "/" + themeId + ".json"
|
const themePath = "./assets/themes/" + themeId + "/" + themeId + ".json"
|
||||||
const contents = <LayoutConfigJson>JSON.parse(readFileSync(themePath, "UTF-8"))
|
const contents = <LayoutConfigJson>JSON.parse(readFileSync(themePath, { encoding: "utf8" }))
|
||||||
const layers = <LayerConfigJson[]>contents.layers.filter((l) => {
|
const layers = <LayerConfigJson[]>contents.layers.filter((l) => {
|
||||||
if (typeof l === "string") {
|
if (typeof l === "string") {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -1,10 +1,23 @@
|
||||||
import { exec } from "child_process"
|
import { exec } from "child_process"
|
||||||
import { writeFile, writeFileSync } from "fs"
|
import { writeFile, writeFileSync } from "fs"
|
||||||
|
|
||||||
function asList(hist: Map<string, number>): {
|
interface Contributor {
|
||||||
contributors: { contributor: string; commits: number }[]
|
/**
|
||||||
} {
|
* The name of the contributor
|
||||||
const ls = []
|
*/
|
||||||
|
contributor: string
|
||||||
|
/**
|
||||||
|
* The number of commits
|
||||||
|
*/
|
||||||
|
commits: number
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ContributorList {
|
||||||
|
contributors: Contributor[]
|
||||||
|
}
|
||||||
|
|
||||||
|
function asList(hist: Map<string, number>): ContributorList {
|
||||||
|
const ls: Contributor[] = []
|
||||||
hist.forEach((commits, contributor) => {
|
hist.forEach((commits, contributor) => {
|
||||||
ls.push({ commits, contributor })
|
ls.push({ commits, contributor })
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue