Fixed the build
This commit is contained in:
parent
560c8e1567
commit
cce9207a35
19 changed files with 183 additions and 29 deletions
|
@ -2,6 +2,7 @@ import {Tag, TagsFilter} from "../Logic/TagsFilter";
|
|||
import {UIElement} from "../UI/UIElement";
|
||||
import {TagDependantUIElementConstructor} from "./UIElementConstructor";
|
||||
import {TagRenderingOptions} from "./TagRenderingOptions";
|
||||
import Translation from "../UI/i18n/Translation";
|
||||
|
||||
export interface Preset {
|
||||
tags: Tag[],
|
||||
|
@ -21,7 +22,7 @@ export class LayerDefinition {
|
|||
/***
|
||||
* This is shown under the 'add new' button to indicate what kind of feature one is adding.
|
||||
*/
|
||||
description: string | UIElement
|
||||
description: string | Translation
|
||||
|
||||
/**
|
||||
* These tags are added whenever a new point is added by the user on the map.
|
||||
|
@ -94,8 +95,8 @@ export class LayerDefinition {
|
|||
static WAYHANDLING_CENTER_AND_WAY = 2;
|
||||
|
||||
constructor(id: string, options: {
|
||||
name: string | UIElement,
|
||||
description: string | UIElement,
|
||||
name: string | Translation,
|
||||
description: string | Translation,
|
||||
presets: Preset[],
|
||||
icon: string,
|
||||
minzoom: number,
|
||||
|
|
|
@ -61,7 +61,7 @@ export default class BikeCafes extends LayerDefinition {
|
|||
return {
|
||||
color: "#00bb00",
|
||||
icon: {
|
||||
iconUrl: self.icon,
|
||||
iconUrl: "./assets/bike/cafe.svg",
|
||||
iconSize: [50, 50],
|
||||
iconAnchor: [25,50]
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ export default class BikeParkings extends LayerDefinition {
|
|||
return {
|
||||
color: "#00bb00",
|
||||
icon: {
|
||||
iconUrl: self.icon,
|
||||
iconUrl: "./assets/bike/parking.svg",
|
||||
iconSize: [50, 50],
|
||||
iconAnchor: [25,50]
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ export class ClimbingTree extends LayerDefinition {
|
|||
super("climbingtree");
|
||||
const t = Translations.t.climbingTrees.layer;
|
||||
this.title = new FixedText(t.title);
|
||||
const icon = "assets/walkbybrussels/tree.svg";
|
||||
const icon = "./assets/themes/nature/tree.svg";
|
||||
this.icon = icon;
|
||||
this.description = t.description;
|
||||
this.style = (tags) => {
|
||||
|
|
|
@ -54,7 +54,7 @@ export class DrinkingWater extends LayerDefinition {
|
|||
return {
|
||||
color: "#00bb00",
|
||||
icon: {
|
||||
iconUrl: self.icon,
|
||||
iconUrl: "./assets/bike/drinking_water.svg",
|
||||
iconSize: [50, 50],
|
||||
iconAnchor: [25,50]
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ export class ClimbingTrees extends Layout {
|
|||
4.3688,
|
||||
Translations.t.climbingTrees.layout.welcome
|
||||
);
|
||||
this.icon = "./assets/walkbybrussels/tree.svg"
|
||||
this.icon = "./assets/themes/nature/tree.svg"
|
||||
this.hideFromOverview = true;
|
||||
}
|
||||
}
|
|
@ -52,7 +52,7 @@ export class Groen extends Layout {
|
|||
"</small>"
|
||||
);
|
||||
|
||||
this.icon = "assets/groen.svg"
|
||||
this.icon = "./assets/groen.svg"
|
||||
this.locationContains = ["buurtnatuur.be"]
|
||||
this.socialImage = "assets/BuurtnatuurFront.jpg"
|
||||
this.description = "Met deze tool kan je natuur in je buurt in kaart brengen en meer informatie geven over je favoriete plekje"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {Layout} from "../Layout";
|
||||
import * as Layer from "../Layers/Bookcases";
|
||||
import {Map} from "../Layers/Map";
|
||||
|
||||
export class MetaMap extends Layout{
|
||||
|
@ -15,6 +14,6 @@ export class MetaMap extends Layout{
|
|||
|
||||
" <h3>Open Map Map</h3>\n" +
|
||||
"This map is a map of physical maps, as known by OpenStreetMap.");
|
||||
this.icon = "assets/osm-logo-buggy-attr.svg"
|
||||
this.icon = "./assets/osm-logo-buggy-attr.svg"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import {Layout} from "../Layout";
|
||||
import * as Layer from "../Layers/Bookcases";
|
||||
import {Widths} from "../Layers/Widths";
|
||||
|
||||
export class StreetWidth extends Layout{
|
||||
|
@ -85,7 +84,7 @@ export class StreetWidth extends Layout{
|
|||
"<li>Laat toeristen verplicht parkeren onder het zand; een (fiets)taxi kan hen naar hun hotel brengen</li>" +
|
||||
"<li>Voorzie in elke straat enkele parkeerplaatsen voor kortparkeren. Zo kunnen leveringen, iemand afzetten,... gebeuren zonder dat er een fietspad of een straat geblokkeerd wordt</li>" +
|
||||
"</ul>");
|
||||
this.icon = "assets/bug.svg";
|
||||
this.icon = "./assets/bug.svg";
|
||||
this.enableSearch = false;
|
||||
this.enableUserBadge = false;
|
||||
this.enableAdd = false;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import {UIElement} from "../../UI/UIElement";
|
||||
import {TagRenderingOptions} from "../TagRenderingOptions";
|
||||
import Translation from "../../UI/i18n/Translation";
|
||||
|
||||
export default class FixedText extends TagRenderingOptions {
|
||||
constructor(category: string | UIElement) {
|
||||
constructor(category: string | Translation) {
|
||||
super({
|
||||
mappings: [
|
||||
{
|
||||
|
|
|
@ -2,11 +2,12 @@ import {And, Tag} from "../../Logic/TagsFilter";
|
|||
import {UIElement} from "../../UI/UIElement";
|
||||
import Translations from "../../UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "../TagRenderingOptions";
|
||||
import Translation from "../../UI/i18n/Translation";
|
||||
|
||||
|
||||
export class NameInline extends TagRenderingOptions{
|
||||
|
||||
constructor(category: string | UIElement ) {
|
||||
constructor(category: string | Translation ) {
|
||||
super({
|
||||
question: "",
|
||||
|
||||
|
|
|
@ -29,6 +29,10 @@ export class ImageCarouselConstructor implements TagDependantUIElementConstructo
|
|||
return new ImageCarousel(dependencies.tags);
|
||||
}
|
||||
|
||||
GetContent(tags: any): string {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class ImageCarousel extends TagDependantUIElement {
|
||||
|
|
8
assets/themes/aed/aed.svg
Normal file
8
assets/themes/aed/aed.svg
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg version="1.1" viewBox="0 0 184 184" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m0 0v184h184v-184z" style="fill:#008855"/>
|
||||
<g style="fill:#fff">
|
||||
<path d="m137 16.1h14.8v14.9h14.9v14.8h-14.9v14.9h-14.8v-14.9h-14.9v-14.8h14.9z"/>
|
||||
<path d="m47.5 56.3c-19.2 0.2-36.4 19.3-31.2 44.5 3.9 19.3 24.4 44.3 60.1 68.5 35.7-24.3 56.2-49.3 60.1-68.5 5.2-25.3-11.9-44.3-31.2-44.5-9.9-0.2-22.3 5.1-28.9 17.7-6.6-12.6-19-17.9-28.9-17.7zm44.3 15.3-16.8 34.5h21.3l-37.3 43.4 14.4-34h-20.7l39.1-43.9z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 549 B |
129
assets/themes/nature/tree.svg
Normal file
129
assets/themes/nature/tree.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 85 KiB |
|
@ -1,6 +1,11 @@
|
|||
import {UIElement} from "./UI/UIElement";
|
||||
// We HAVE to mark this while importing
|
||||
UIElement.runningFromConsole = true;
|
||||
|
||||
import {TagRendering} from "./Customizations/TagRendering";
|
||||
|
||||
TagRendering.injectFunction();
|
||||
|
||||
import {AllKnownLayouts} from "./Customizations/AllKnownLayouts";
|
||||
import {Layout} from "./Customizations/Layout";
|
||||
import {readFileSync, writeFile, writeFileSync} from "fs";
|
||||
|
@ -8,6 +13,7 @@ import Locale from "./UI/i18n/Locale";
|
|||
import svg2img from 'promise-svg2img';
|
||||
import Translation from "./UI/i18n/Translation";
|
||||
import Translations from "./UI/i18n/Translations";
|
||||
import {TagRenderingOptions} from "./Customizations/TagRenderingOptions";
|
||||
|
||||
|
||||
console.log("Building the layouts")
|
||||
|
@ -88,6 +94,8 @@ function createIcon(iconPath: string, size: number) {
|
|||
|
||||
}
|
||||
|
||||
console.log("Creating icon ", name, newname)
|
||||
|
||||
svg2img(iconPath,
|
||||
// @ts-ignore
|
||||
{width: size, height: size, preserveAspectRatio: true})
|
||||
|
@ -95,7 +103,7 @@ function createIcon(iconPath: string, size: number) {
|
|||
console.log("Writing icon", newname)
|
||||
writeFileSync(newname, buffer);
|
||||
}).catch((error) => {
|
||||
console.log("ERROR", error)
|
||||
console.log("ERROR while writing" + iconPath, error)
|
||||
});
|
||||
return newname;
|
||||
}
|
||||
|
@ -105,11 +113,13 @@ function createManifest(layout: Layout, relativePath: string) {
|
|||
|
||||
const icons = [];
|
||||
|
||||
if (layout.icon.endsWith(".svg")) {
|
||||
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];
|
||||
for (const size of sizes) {
|
||||
const name = createIcon(layout.icon, size);
|
||||
const name = createIcon(icon, size);
|
||||
icons.push({
|
||||
src: name,
|
||||
sizes: size + "x" + size,
|
||||
|
@ -117,7 +127,7 @@ function createManifest(layout: Layout, relativePath: string) {
|
|||
})
|
||||
}
|
||||
icons.push({
|
||||
src: layout.icon,
|
||||
src: icon,
|
||||
sizes: "513x513",
|
||||
type: "image/svg"
|
||||
})
|
||||
|
@ -126,7 +136,7 @@ function createManifest(layout: Layout, relativePath: string) {
|
|||
throw "Icon is not an svg for " + layout.name
|
||||
}
|
||||
const ogTitle = Translations.W(layout.title).InnerRender();
|
||||
const ogDescr = Translations.W(layout.description).InnerRender();
|
||||
const ogDescr = Translations.W(layout.description ?? "").InnerRender();
|
||||
|
||||
const manif = {
|
||||
name: name,
|
||||
|
@ -147,7 +157,7 @@ function createLandingPage(layout: Layout) {
|
|||
Locale.language.setData(layout.supportedLanguages[0]);
|
||||
|
||||
const ogTitle = Translations.W(layout.title).InnerRender();
|
||||
const ogDescr = Translations.W(layout.description).InnerRender();
|
||||
const ogDescr = Translations.W(layout.description ?? "").InnerRender();
|
||||
const ogImage = layout.socialImage;
|
||||
|
||||
const og = `
|
||||
|
@ -183,10 +193,11 @@ for (const layoutName in all) {
|
|||
writeFile(manifestLocation, manif, err);
|
||||
|
||||
const landing = createLandingPage(layout);
|
||||
console.log("Generating html-file for ",layout.name)
|
||||
console.log("Generating html-file for ", layout.name)
|
||||
writeFile(enc(layout.name) + ".html", landing, err)
|
||||
console.log("done")
|
||||
}
|
||||
console.log("COunting all translations")
|
||||
|
||||
console.log("Counting all translations")
|
||||
Translations.CountTranslations();
|
||||
console.log("All done!")
|
|
@ -4,13 +4,14 @@ ts-node createLayouts.ts
|
|||
npm run build
|
||||
rm -rf /home/pietervdvn/git/pietervdvn.github.io/MapComplete/*
|
||||
cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/MapComplete/
|
||||
./clean.sh
|
||||
|
||||
cd /home/pietervdvn/git/pietervdvn.github.io/MapComplete/
|
||||
git add .
|
||||
git commit -m "New mapcomplete version"
|
||||
git push
|
||||
|
||||
|
||||
cd -
|
||||
# clean up the mess we made
|
||||
# rm *.js
|
||||
# rm Logic/*.js
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
"staticPath": [
|
||||
{
|
||||
"staticPath": "tiles",
|
||||
"staticOutDir": "tiles/"
|
||||
"staticOutDir": "./tiles/"
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"start": "parcel *.html UI/** Logic/** assets/**/* assets/**/**/* assets/* vendor/* vendor/*/*",
|
||||
"start": "parcel *.html UI/** Logic/** assets/** a vendor/* vendor/*/*",
|
||||
"generate": "ts-node createLayouts.ts",
|
||||
"build": "rm -rf dist/ && parcel build --public-url ./ *.html assets/* assets/**/* assets/**/**/* vendor/* vendor/*/*",
|
||||
"build": "rm -rf dist/ && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
|
||||
"clean": "./clean.sh",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue