Cleaning up log messages, cleaning svg files
This commit is contained in:
parent
d05fbeb919
commit
387d8d4dc1
|
@ -64,7 +64,6 @@ export class FromJSON {
|
|||
}
|
||||
|
||||
public static LayoutFromJSON(json: LayoutConfigJson): Layout {
|
||||
console.log(json)
|
||||
const tr = FromJSON.Translation;
|
||||
|
||||
const layers = json.layers.map(FromJSON.Layer);
|
||||
|
@ -115,7 +114,6 @@ export class FromJSON {
|
|||
return undefined;
|
||||
}
|
||||
const transl = new Translation(tr);
|
||||
transl.addCallback(latest => console.log("tr callback changed to", latest));
|
||||
return transl;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
viewBox="0 0 98 122"
|
||||
height="122"
|
||||
width="98">
|
||||
|
||||
<defs
|
||||
id="defs17" />
|
||||
<metadata
|
||||
|
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
File diff suppressed because it is too large
Load diff
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 45 KiB |
|
@ -13,17 +13,13 @@ import Translations from "./UI/i18n/Translations";
|
|||
import {TagRendering} from "./UI/TagRendering";
|
||||
|
||||
TagRendering.injectFunction();
|
||||
|
||||
|
||||
console.log("Building the layouts")
|
||||
|
||||
|
||||
function enc(str: string): string {
|
||||
return encodeURIComponent(str.toLowerCase());
|
||||
}
|
||||
|
||||
function validate(layout: Layout) {
|
||||
console.log("Validationg ", layout.id)
|
||||
const translations: Translation[] = [];
|
||||
const queue: any[] = [layout]
|
||||
|
||||
|
@ -52,7 +48,6 @@ function validate(layout: Layout) {
|
|||
const txt = translation.translations[ln];
|
||||
const isMissing = txt === undefined || txt === "" || txt.toLowerCase().indexOf("todo") >= 0;
|
||||
if (isMissing) {
|
||||
console.log(`Missing or suspicious ${ln}-translation for '`, translation.txt, ":", txt)
|
||||
missing[ln]++
|
||||
} else {
|
||||
present[ln]++;
|
||||
|
@ -60,7 +55,7 @@ function validate(layout: Layout) {
|
|||
}
|
||||
}
|
||||
|
||||
console.log("Translation completenes for", layout.id);
|
||||
console.log("Translation completenes for theme", layout.id);
|
||||
for (const ln of layout.supportedLanguages) {
|
||||
const amiss = missing[ln];
|
||||
const ok = present[ln];
|
||||
|
@ -129,23 +124,21 @@ function createIcon(iconPath: string, size: number) {
|
|||
}
|
||||
|
||||
console.log("Creating icon ", name, newname)
|
||||
try {
|
||||
svg2img(iconPath,
|
||||
// @ts-ignore
|
||||
{width: size, height: size, preserveAspectRatio: true})
|
||||
.then((buffer) => {
|
||||
console.log("Writing icon", newname)
|
||||
writeFileSync(newname, buffer);
|
||||
}).catch((error) => {
|
||||
console.log("ERROR while writing" + iconPath, error)
|
||||
});
|
||||
|
||||
try{
|
||||
|
||||
svg2img(iconPath,
|
||||
// @ts-ignore
|
||||
{width: size, height: size, preserveAspectRatio: true})
|
||||
.then((buffer) => {
|
||||
console.log("Writing icon", newname)
|
||||
writeFileSync(newname, buffer);
|
||||
}).catch((error) => {
|
||||
console.log("ERROR while writing" + iconPath, error)
|
||||
});
|
||||
|
||||
}catch(e){
|
||||
console.error("Could not read icon",iconPath,"due to",e)
|
||||
} catch (e) {
|
||||
console.error("Could not read icon", iconPath, "due to", e)
|
||||
}
|
||||
|
||||
|
||||
return newname;
|
||||
}
|
||||
|
||||
|
@ -155,7 +148,6 @@ function createManifest(layout: Layout, relativePath: string) {
|
|||
const icons = [];
|
||||
|
||||
let icon = layout.icon;
|
||||
console.log(icon)
|
||||
if (icon.endsWith(".svg")) {
|
||||
// This is an svg. Lets create the needed pngs!
|
||||
const sizes = [72, 96, 120, 128, 144, 152, 180, 192, 384, 512];
|
||||
|
@ -240,16 +232,13 @@ for (const layoutName in all) {
|
|||
};
|
||||
const layout = all[layoutName];
|
||||
validate(layout)
|
||||
console.log("Generating manifest")
|
||||
const manif = JSON.stringify(createManifest(layout, "/MapComplete"));
|
||||
|
||||
const manifestLocation = encodeURIComponent(layout.id.toLowerCase()) + ".webmanifest";
|
||||
writeFile(manifestLocation, manif, err);
|
||||
|
||||
const landing = createLandingPage(layout);
|
||||
console.log("Generating html-file for ", layout.id)
|
||||
writeFile(enc(layout.id) + ".html", landing, err)
|
||||
console.log("done")
|
||||
|
||||
wikiPage += "\n\n"+generateWikiEntry(layout);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue