forked from MapComplete/MapComplete
More fancyness, less bugs
This commit is contained in:
parent
16612b10ef
commit
2177db376c
27 changed files with 821 additions and 607 deletions
|
@ -100,7 +100,7 @@ const alreadyWritten = []
|
|||
|
||||
function createIcon(iconPath: string, size: number, layout: LayoutConfig) {
|
||||
let name = iconPath.split(".").slice(0, -1).join(".");
|
||||
if (name.startsWith("../")) {
|
||||
if (name.startsWith("./")) {
|
||||
name = name.substr(2)
|
||||
}
|
||||
const newname = `${name}${size}.png`
|
||||
|
@ -151,7 +151,7 @@ function createManifest(layout: LayoutConfig, relativePath: string) {
|
|||
let path = layout.icon;
|
||||
if (layout.icon.startsWith("<")) {
|
||||
// THis is already the svg
|
||||
path = "../assets/generated/" + layout.id + "_logo.svg"
|
||||
path = "./assets/generated/" + layout.id + "_logo.svg"
|
||||
writeFileSync(path, layout.icon)
|
||||
}
|
||||
|
||||
|
@ -212,19 +212,19 @@ function createLandingPage(layout: LayoutConfig) {
|
|||
}
|
||||
|
||||
const og = `
|
||||
<meta property="og:image" content="${ogImage ?? '../assets/svg/add.svg'}">
|
||||
<meta property="og:image" content="${ogImage ?? './assets/svg/add.svg'}">
|
||||
<meta property="og:title" content="${ogTitle}">
|
||||
<meta property="og:description" content="${ogDescr}">`
|
||||
|
||||
let icon = layout.icon;
|
||||
if (icon.startsWith("<?xml") || icon.startsWith("<svg")) {
|
||||
// This already is an svg
|
||||
icon = `../assets/generated/${layout.id}_icon.svg`
|
||||
icon = `./assets/generated/${layout.id}_icon.svg`
|
||||
writeFileSync(icon, layout.icon);
|
||||
}
|
||||
|
||||
let output = template
|
||||
.replace(`../manifest.manifest`, `../${enc(layout.id)}.webmanifest`)
|
||||
.replace(`./manifest.manifest`, `./${enc(layout.id)}.webmanifest`)
|
||||
.replace("<!-- $$$OG-META -->", og)
|
||||
.replace(/<title>.+?<\/title>/, `<title>${ogTitle}</title>`)
|
||||
.replace("Loading MapComplete, hang on...", `Loading MapComplete theme <i>${ogTitle}</i>...`)
|
||||
|
@ -243,6 +243,11 @@ function createLandingPage(layout: LayoutConfig) {
|
|||
return output;
|
||||
}
|
||||
|
||||
const generatedDir = "./assets/generated";
|
||||
if (! existsSync(generatedDir)) {
|
||||
mkdirSync(generatedDir)
|
||||
}
|
||||
|
||||
const blacklist = ["", "test", ".", "..", "manifest", "index", "land", "preferences", "account", "openstreetmap"]
|
||||
const all = AllKnownLayouts.allSets;
|
||||
|
||||
|
@ -251,10 +256,7 @@ let wikiPage = "{|class=\"wikitable sortable\"\n" +
|
|||
"|-";
|
||||
|
||||
|
||||
const generatedDir = "../assets/generated";
|
||||
if (! existsSync(generatedDir)) {
|
||||
mkdirSync(generatedDir)
|
||||
}
|
||||
|
||||
|
||||
for (const layoutName in all) {
|
||||
if (blacklist.indexOf(layoutName.toLowerCase()) >= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue