From d3194b749133579751e74ec7e346d3d87febd6f3 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sat, 12 Mar 2022 16:35:27 +0100 Subject: [PATCH] Fixes to taginfo generation --- scripts/generateTaginfoProjectFiles.ts | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/scripts/generateTaginfoProjectFiles.ts b/scripts/generateTaginfoProjectFiles.ts index 55a33268e..11e2b346a 100644 --- a/scripts/generateTaginfoProjectFiles.ts +++ b/scripts/generateTaginfoProjectFiles.ts @@ -5,6 +5,7 @@ import {readFileSync, writeFileSync} from "fs"; import LayoutConfig from "../Models/ThemeConfig/LayoutConfig"; import LayerConfig from "../Models/ThemeConfig/LayerConfig"; import Constants from "../Models/Constants"; +import {Utils} from "../Utils"; /** * Generates all the files in "Docs/TagInfo". These are picked up by the taginfo project, showing a link to the mapcomplete theme if the key is used @@ -118,6 +119,10 @@ function generateTagInfoEntry(layout: LayoutConfig): any { } usedTags.push(...generateLayerUsage(layer, layout)) } + + if(usedTags.length == 0){ + return undefined + } let icon = layout.icon; @@ -148,7 +153,7 @@ function generateTagInfoEntry(layout: LayoutConfig): any { } // Write the URLS to the taginfo repository. Might fail if the repository is not checked ou -function generateProjectsOverview() { +function generateProjectsOverview(files: string[]) { try { const tagInfoList = "../taginfo-projects/project_list.txt" let projectList = readFileSync(tagInfoList, "UTF8") @@ -169,17 +174,23 @@ function generateProjectsOverview() { } +function main(){ + + console.log("Creating taginfo project files") Locale.language.setData("en") Translation.forcedLanguage = "en" -const files = [] - -for (const layout of AllKnownLayouts.layoutsList) { - if (layout.hideFromOverview) { - continue; + const files = [] + + for (const layout of AllKnownLayouts.layoutsList) { + if (layout.hideFromOverview) { + continue; + } + files.push(generateTagInfoEntry(layout)); } - files.push(generateTagInfoEntry(layout)); + generateProjectsOverview(Utils.NoNull(files)); } -generateProjectsOverview(); \ No newline at end of file + +main() \ No newline at end of file