From 6879495afb64444e35e329334a853c854591c063 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Mon, 19 Sep 2022 12:34:05 +0200 Subject: [PATCH] Remove obsolete scripts --- scripts/generateIncludedImages.ts | 2 +- scripts/generateWikiPage.ts | 53 ------------------------------- scripts/translationStatistics.ts | 48 ---------------------------- 3 files changed, 1 insertion(+), 102 deletions(-) delete mode 100644 scripts/generateWikiPage.ts delete mode 100644 scripts/translationStatistics.ts diff --git a/scripts/generateIncludedImages.ts b/scripts/generateIncludedImages.ts index 5ddc59b24..95c67aa62 100644 --- a/scripts/generateIncludedImages.ts +++ b/scripts/generateIncludedImages.ts @@ -29,7 +29,7 @@ function genImages(dryrun = false) { if (hasNonAsciiChars) { throw "The svg '" + path + "' has non-ascii characters" } - const name = path.substr(0, path.length - 4).replace(/[ -]/g, "_") + const name = path.substring(0, path.length - 4).replace(/[ -]/g, "_") if (dryrun) { svg = "xxx" diff --git a/scripts/generateWikiPage.ts b/scripts/generateWikiPage.ts deleted file mode 100644 index 97ba993e0..000000000 --- a/scripts/generateWikiPage.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { writeFile } from "fs" -import Translations from "../UI/i18n/Translations" -import * as themeOverview from "../assets/generated/theme_overview.json" - -function generateWikiEntry(layout: { - hideFromOverview: boolean - id: string - shortDescription: any -}) { - if (layout.hideFromOverview) { - return "" - } - - const languagesInDescr = [] - for (const shortDescriptionKey in layout.shortDescription) { - languagesInDescr.push(shortDescriptionKey) - } - - const languages = languagesInDescr.map((ln) => `{{#language:${ln}|en}}`).join(", ") - let auth = "Yes" - return `{{service_item -|name= [https://mapcomplete.osm.be/${layout.id} ${layout.id}] -|region= Worldwide -|lang= ${languages} -|descr= A MapComplete theme: ${Translations.T(layout.shortDescription) - .textFor("en") - .replace(".*<\/a>/, "]]")} -|material= {{yes|[https://mapcomplete.osm.be/ ${auth}]}} -|image= MapComplete_Screenshot.png -|genre= POI, editor, ${layout.id} -}}` -} - -let wikiPage = - '{|class="wikitable sortable"\n' + - "! Name, link !! Genre !! Covered region !! Language !! Description !! Free materials !! Image\n" + - "|-" - -for (const layout of themeOverview) { - if (layout.hideFromOverview) { - continue - } - wikiPage += "\n" + generateWikiEntry(layout) -} - -wikiPage += "\n|}" - -writeFile("Docs/wikiIndex.txt", wikiPage, (err) => { - if (err !== null) { - console.log("Could not save wikiindex", err) - } -}) diff --git a/scripts/translationStatistics.ts b/scripts/translationStatistics.ts deleted file mode 100644 index bf178f4c2..000000000 --- a/scripts/translationStatistics.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Utils } from "../Utils" -import { AllKnownLayouts } from "../Customizations/AllKnownLayouts" -import TranslatorsPanel from "../UI/BigComponents/TranslatorsPanel" -import * as languages from "../assets/generated/used_languages.json" -{ - const usedLanguages = languages.languages - - // Some statistics - console.log( - Utils.FixedLength("", 12) + " " + usedLanguages.map((l) => Utils.FixedLength(l, 6)).join("") - ) - const all = new Map() - - usedLanguages.forEach((ln) => all.set(ln, [])) - - for (const layoutId of Array.from(AllKnownLayouts.allKnownLayouts.keys())) { - const layout = AllKnownLayouts.allKnownLayouts.get(layoutId) - if (layout.hideFromOverview) { - continue - } - const { completeness, total } = TranslatorsPanel.MissingTranslationsFor(layout) - process.stdout.write(Utils.FixedLength(layout.id, 12) + " ") - for (const language of usedLanguages) { - const compl = completeness.get(language) - all.get(language).push((compl ?? 0) / total) - if (compl === undefined) { - process.stdout.write(" ") - continue - } - const percentage = Math.round((100 * compl) / total) - process.stdout.write(Utils.FixedLength(percentage + "%", 6)) - } - process.stdout.write("\n") - } - - process.stdout.write(Utils.FixedLength("average", 12) + " ") - for (const language of usedLanguages) { - const ratios = all.get(language) - let sum = 0 - ratios.forEach((x) => (sum += x)) - const percentage = Math.round(100 * (sum / ratios.length)) - process.stdout.write(Utils.FixedLength(percentage + "%", 6)) - } - process.stdout.write("\n") - console.log( - Utils.FixedLength("", 12) + " " + usedLanguages.map((l) => Utils.FixedLength(l, 6)).join("") - ) -}