forked from MapComplete/MapComplete
		
	Cleaning up log messages, cleaning svg files
This commit is contained in:
		
							parent
							
								
									d05fbeb919
								
							
						
					
					
						commit
						387d8d4dc1
					
				
					 4 changed files with 785 additions and 888 deletions
				
			
		|  | @ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue