Remove maintainer and version fields

This commit is contained in:
pietervdvn 2022-08-22 14:46:55 +02:00
parent 7be371f24a
commit 8f1d63b20a
6 changed files with 27 additions and 29 deletions

View file

@ -6,8 +6,7 @@
"#5": "If you don't know how to run a webserver: go to https://www.base64encode.org/ , copy paste this entire document in the 'encode' field and encode it;",
"#6": "Then, go to https://mapcomplete.osm.be/theme?userlayout=true#your-base64-encoded-file",
"id": "template",
"maintainer": "Write your name here",
"version": "2022-03-12",
"credits": "Write your name here (or remove everything)",
"title": {
"en": "Title of your theme",
"#1": "You can add extra languages here (and in all translation blocks), but make sure 'en' is everywhere"

View file

@ -133,6 +133,7 @@ class UpdateLegacyTheme extends DesugaringStep<LayoutConfigJson> {
delete oldThemeConfig.socialImage
}
if (oldThemeConfig["roamingRenderings"] !== undefined) {
if (oldThemeConfig["roamingRenderings"].length == 0) {
@ -148,6 +149,21 @@ class UpdateLegacyTheme extends DesugaringStep<LayoutConfigJson> {
oldThemeConfig.layers = Utils.NoNull(oldThemeConfig.layers)
delete oldThemeConfig["language"]
delete oldThemeConfig["version"]
if (oldThemeConfig["maintainer"] !== undefined) {
console.log("Maintainer: ", oldThemeConfig["maintainer"], "credits: ", oldThemeConfig["credits"])
if (oldThemeConfig.credits === undefined) {
oldThemeConfig["credits"] = oldThemeConfig["maintainer"]
delete oldThemeConfig["maintainer"]
} else if (oldThemeConfig["maintainer"].toLowerCase().trim() === "mapcomplete") {
delete oldThemeConfig["maintainer"]
} else if (oldThemeConfig["maintainer"].toLowerCase().trim() === "") {
delete oldThemeConfig["maintainer"]
}
}
return {
errors: [],
warnings: [],

View file

@ -32,17 +32,6 @@ export interface LayoutConfigJson {
*/
credits?: string;
/**
* Who does maintain this preset?
*/
maintainer: string;
/**
* A version number, either semantically or by date.
* Should be sortable, where the higher value is the later version
*/
version: string;
/**
* Only used in 'generateLayerOverview': if present, every translation will be checked to make sure it is fully translated.
*

View file

@ -10,9 +10,7 @@ import ExtraLinkConfig from "./ExtraLinkConfig";
export default class LayoutConfig {
public static readonly defaultSocialImage = "assets/SocialImage.png"
public readonly id: string;
public readonly maintainer: string;
public readonly credits?: string;
public readonly version: string;
public readonly language: string[];
public readonly title: Translation;
public readonly shortDescription: Translation;
@ -76,9 +74,7 @@ export default class LayoutConfig {
}
}
const context = this.id
this.maintainer = json.maintainer;
this.credits = json.credits;
this.version = json.version;
this.language = json.mustHaveLanguage ?? Array.from(Object.keys(json.title));
this.usedImages = Array.from(new ExtractImages(official, undefined).convertStrict(json, "while extracting the images of " + json.id + " " + context ?? "")).sort()
{

View file

@ -146,8 +146,8 @@ export default class CopyrightPanel extends Combine {
const iconAttributions = layoutToUse.usedImages.map(CopyrightPanel.IconAttribution)
let maintainer: BaseUIElement = undefined
if (layoutToUse.maintainer !== undefined && layoutToUse.maintainer !== "" && layoutToUse.maintainer.toLowerCase() !== "mapcomplete") {
maintainer = t.themeBy.Subs({author: layoutToUse.maintainer})
if (layoutToUse.credits !== undefined && layoutToUse.credits !== "") {
maintainer = t.themeBy.Subs({author: layoutToUse.credits})
}
const contributions = new ContributorCount(state).Contributors
@ -190,7 +190,6 @@ export default class CopyrightPanel extends Combine {
new Title(t.attributionTitle),
t.attributionContent,
maintainer,
new FixedUiElement(layoutToUse.credits),
dataContributors,
CopyrightPanel.CodeContributors(contributors, t.codeContributionsBy),
CopyrightPanel.CodeContributors(translators, t.translatedBy),

View file

@ -1,10 +1,9 @@
import ScriptUtils from "./ScriptUtils";
import {mkdirSync, writeFileSync} from "fs";
import {writeFileSync} from "fs";
import {FixLegacyTheme, UpdateLegacyLayer} from "../Models/ThemeConfig/Conversion/LegacyJsonConvert";
import Translations from "../UI/i18n/Translations";
import {Translation} from "../UI/i18n/Translation";
import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson";
import {LayoutConfigJson} from "../Models/ThemeConfig/Json/LayoutConfigJson";
/*
* This script reads all theme and layer files and reformats them inplace