From 7e2744576c987053fccf6036b60911bfd5921ebe Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 7 Sep 2021 21:03:29 +0200 Subject: [PATCH] More work on the charging stations theme --- Logic/Tags/RegexTag.ts | 8 +- Logic/Tags/TagUtils.ts | 45 ++- .../layers/charging_station/.~lock.types.csv# | 1 - .../charging_station/charging_station.json | 271 +++++++++++++++--- .../charging_station.protojson | 147 ++++++++-- assets/layers/charging_station/csvToJson.ts | 26 +- .../layers/charging_station/license_info.json | 10 + assets/layers/charging_station/types.csv | 2 +- .../charging_station/under_construction.svg | 60 ++++ package.json | 3 +- 10 files changed, 476 insertions(+), 97 deletions(-) delete mode 100644 assets/layers/charging_station/.~lock.types.csv# create mode 100644 assets/layers/charging_station/under_construction.svg diff --git a/Logic/Tags/RegexTag.ts b/Logic/Tags/RegexTag.ts index 68ca88d089..64f370c35c 100644 --- a/Logic/Tags/RegexTag.ts +++ b/Logic/Tags/RegexTag.ts @@ -2,10 +2,10 @@ import {Tag} from "./Tag"; import {TagsFilter} from "./TagsFilter"; export class RegexTag extends TagsFilter { - private readonly key: RegExp | string; - private readonly value: RegExp | string; - private readonly invert: boolean; - private readonly matchesEmpty: boolean + public readonly key: RegExp | string; + public readonly value: RegExp | string; + public readonly invert: boolean; + public readonly matchesEmpty: boolean constructor(key: string | RegExp, value: RegExp | string, invert: boolean = false) { super(); diff --git a/Logic/Tags/TagUtils.ts b/Logic/Tags/TagUtils.ts index fff39e8c94..c146e08eaa 100644 --- a/Logic/Tags/TagUtils.ts +++ b/Logic/Tags/TagUtils.ts @@ -7,6 +7,7 @@ import {RegexTag} from "./RegexTag"; import SubstitutingTag from "./SubstitutingTag"; import {Or} from "./Or"; import {AndOrTagConfigJson} from "../../Models/ThemeConfig/Json/TagConfigJson"; +import {isRegExp} from "util"; export class TagUtils { static ApplyTemplate(template: string, tags: any): string { @@ -47,16 +48,15 @@ export class TagUtils { } /*** - * Creates a hash {key --> [values]}, with all the values present in the tagsfilter + * Creates a hash {key --> [values : string | Regex ]}, with all the values present in the tagsfilter * * @param tagsFilters * @constructor */ - static SplitKeys(tagsFilters: TagsFilter[]) { + static SplitKeys(tagsFilters: TagsFilter[], allowRegex = false) { const keyValues = {} // Map string -> string[] - tagsFilters = [...tagsFilters] // copy all + tagsFilters = [...tagsFilters] // copy all, use as queue while (tagsFilters.length > 0) { - // Queue const tagsFilter = tagsFilters.shift(); if (tagsFilter === undefined) { @@ -75,6 +75,21 @@ export class TagUtils { keyValues[tagsFilter.key].push(...tagsFilter.value.split(";")); continue; } + + if(allowRegex && tagsFilter instanceof RegexTag) { + const key = tagsFilter.key + if(isRegExp(key)) { + console.error("Invalid type to flatten the multiAnswer: key is a regex too", tagsFilter); + throw "Invalid type to FlattenMultiAnswer" + } + const keystr = key + if (keyValues[keystr] === undefined) { + keyValues[keystr ] = []; + } + keyValues[keystr].push(tagsFilter); + continue; + } + console.error("Invalid type to flatten the multiAnswer", tagsFilter); throw "Invalid type to FlattenMultiAnswer" @@ -106,16 +121,30 @@ export class TagUtils { return new And(and); } - static MatchesMultiAnswer(tag: TagsFilter, tags: any): boolean { - const splitted = TagUtils.SplitKeys([tag]); + /** + * Returns true if the properties match the tagsFilter, interpreted as a multikey. + * Note that this might match a regex tag + * @param tag + * @param properties + * @constructor + */ + static MatchesMultiAnswer(tag: TagsFilter, properties: any): boolean { + const splitted = TagUtils.SplitKeys([tag], true); for (const splitKey in splitted) { const neededValues = splitted[splitKey]; - if (tags[splitKey] === undefined) { + if (properties[splitKey] === undefined) { return false; } - const actualValue = tags[splitKey].split(";"); + const actualValue = properties[splitKey].split(";"); for (const neededValue of neededValues) { + + if(neededValue instanceof RegexTag) { + if(!neededValue.matchesProperties(properties)) { + return false + } + continue + } if (actualValue.indexOf(neededValue) < 0) { return false; } diff --git a/assets/layers/charging_station/.~lock.types.csv# b/assets/layers/charging_station/.~lock.types.csv# deleted file mode 100644 index 1bcf1ea170..0000000000 --- a/assets/layers/charging_station/.~lock.types.csv# +++ /dev/null @@ -1 +0,0 @@ -,pietervdvn,pietervdvn-Latitude-5591,07.09.2021 18:13,file:///home/pietervdvn/.config/libreoffice/4; \ No newline at end of file diff --git a/assets/layers/charging_station/charging_station.json b/assets/layers/charging_station/charging_station.json index 6b176b381e..d02d87f2fa 100644 --- a/assets/layers/charging_station/charging_station.json +++ b/assets/layers/charging_station/charging_station.json @@ -13,7 +13,9 @@ "osmTags": { "or": [ "amenity=charging_station", - "disused:amenity=charging_station" + "disused:amenity=charging_station", + "planned:amenity=charging_station", + "construction:amenity=charging_station" ] } }, @@ -153,45 +155,135 @@ ] } }, + { + "if": { + "and": [ + "socket:schuko~*", + "socket:schuko!=1" + ] + }, + "then": " Schuko wall plug without ground pin (CEE7/4 type F)", + "hideInAnswer": true + }, { "if": "socket:typee=1", "ifnot": "socket:typee=", "then": " European wall plug with ground pin (CEE7/4 type E)" }, + { + "if": { + "and": [ + "socket:typee~*", + "socket:typee!=1" + ] + }, + "then": " European wall plug with ground pin (CEE7/4 type E)", + "hideInAnswer": true + }, { "if": "socket:chademo=1", "ifnot": "socket:chademo=", "then": " Chademo" }, + { + "if": { + "and": [ + "socket:chademo~*", + "socket:chademo!=1" + ] + }, + "then": " Chademo", + "hideInAnswer": true + }, { "if": "socket:type1_cable=1", "ifnot": "socket:type1_cable=", "then": " Type 1 with cable (J1772)" }, + { + "if": { + "and": [ + "socket:type1_cable~*", + "socket:type1_cable!=1" + ] + }, + "then": " Type 1 with cable (J1772)", + "hideInAnswer": true + }, { "if": "socket:type1=1", "ifnot": "socket:type1=", "then": " Type 1 without cable (J1772)" }, + { + "if": { + "and": [ + "socket:type1~*", + "socket:type1!=1" + ] + }, + "then": " Type 1 without cable (J1772)", + "hideInAnswer": true + }, { "if": "socket:type1_combo=1", "ifnot": "socket:type1_combo=", "then": " Type 1 CCS (aka Type 1 Combo)" }, + { + "if": { + "and": [ + "socket:type1_combo~*", + "socket:type1_combo!=1" + ] + }, + "then": " Type 1 CCS (aka Type 1 Combo)", + "hideInAnswer": true + }, { "if": "socket:tesla_supercharger=1", "ifnot": "socket:tesla_supercharger=", "then": " Tesla Supercharger" }, + { + "if": { + "and": [ + "socket:tesla_supercharger~*", + "socket:tesla_supercharger!=1" + ] + }, + "then": " Tesla Supercharger", + "hideInAnswer": true + }, { "if": "socket:type2=1", "ifnot": "socket:type2=", "then": " Type 2 (mennekes)" }, + { + "if": { + "and": [ + "socket:type2~*", + "socket:type2!=1" + ] + }, + "then": " Type 2 (mennekes)", + "hideInAnswer": true + }, { "if": "socket:type2_combo=1", "ifnot": "socket:type2_combo=", "then": " Type 2 CCS (mennekes)" + }, + { + "if": { + "and": [ + "socket:type2_combo~*", + "socket:type2_combo!=1" + ] + }, + "then": " Type 2 CCS (mennekes)", + "hideInAnswer": true } ] }, @@ -199,7 +291,7 @@ "question": { "en": "How much plugs of type Schuko wall plug without ground pin (CEE7/4 type F) are available here?" }, - "render": "There are {socket:schuko} plugs of type Schuko wall plug without ground pin (CEE7/4 type F) available here", + "render": "There are {socket:schuko} plugs of type Schuko wall plug without ground pin (CEE7/4 type F) available here", "freeform": { "key": "socket:schuko", "type": "pnat" @@ -210,7 +302,7 @@ "question": { "en": "How much plugs of type European wall plug with ground pin (CEE7/4 type E) are available here?" }, - "render": "There are {socket:typee} plugs of type European wall plug with ground pin (CEE7/4 type E) available here", + "render": "There are {socket:typee} plugs of type European wall plug with ground pin (CEE7/4 type E) available here", "freeform": { "key": "socket:typee", "type": "pnat" @@ -221,7 +313,7 @@ "question": { "en": "How much plugs of type Chademo are available here?" }, - "render": "There are {socket:chademo} plugs of type Chademo available here", + "render": "There are {socket:chademo} plugs of type Chademo available here", "freeform": { "key": "socket:chademo", "type": "pnat" @@ -232,7 +324,7 @@ "question": { "en": "How much plugs of type Type 1 with cable (J1772) are available here?" }, - "render": "There are {socket:type1_cable} plugs of type Type 1 with cable (J1772) available here", + "render": "There are {socket:type1_cable} plugs of type Type 1 with cable (J1772) available here", "freeform": { "key": "socket:type1_cable", "type": "pnat" @@ -243,7 +335,7 @@ "question": { "en": "How much plugs of type Type 1 without cable (J1772) are available here?" }, - "render": "There are {socket:type1} plugs of type Type 1 without cable (J1772) available here", + "render": "There are {socket:type1} plugs of type Type 1 without cable (J1772) available here", "freeform": { "key": "socket:type1", "type": "pnat" @@ -254,7 +346,7 @@ "question": { "en": "How much plugs of type Type 1 CCS (aka Type 1 Combo) are available here?" }, - "render": "There are {socket:type1_combo} plugs of type Type 1 CCS (aka Type 1 Combo) available here", + "render": "There are {socket:type1_combo} plugs of type Type 1 CCS (aka Type 1 Combo) available here", "freeform": { "key": "socket:type1_combo", "type": "pnat" @@ -265,7 +357,7 @@ "question": { "en": "How much plugs of type Tesla Supercharger are available here?" }, - "render": "There are {socket:tesla_supercharger} plugs of type Tesla Supercharger available here", + "render": "There are {socket:tesla_supercharger} plugs of type Tesla Supercharger available here", "freeform": { "key": "socket:tesla_supercharger", "type": "pnat" @@ -276,7 +368,7 @@ "question": { "en": "How much plugs of type Type 2 (mennekes) are available here?" }, - "render": "There are {socket:type2} plugs of type Type 2 (mennekes) available here", + "render": "There are {socket:type2} plugs of type Type 2 (mennekes) available here", "freeform": { "key": "socket:type2", "type": "pnat" @@ -287,7 +379,7 @@ "question": { "en": "How much plugs of type Type 2 CCS (mennekes) are available here?" }, - "render": "There are {socket:type2_combo} plugs of type Type 2 CCS (mennekes) available here", + "render": "There are {socket:type2_combo} plugs of type Type 2 CCS (mennekes) available here", "freeform": { "key": "socket:type2_combo", "type": "pnat" @@ -444,37 +536,28 @@ }, "mappings": [ { - "if": { - "and": [ - "no:network=yes" - ] - }, + "if": "no:network=yes", "then": { "en": "Not part of a bigger network" } }, { - "if": { - "and": [ - "network=AeroVironment" - ] + "if": "network=none", + "then": { + "en": "Not part of a bigger network" }, + "hideInAnswer": true + }, + { + "if": "network=AeroVironment", "then": "AeroVironment" }, { - "if": { - "and": [ - "network=Blink" - ] - }, + "if": "network=Blink", "then": "Blink" }, { - "if": { - "and": [ - "network=eVgo" - ] - }, + "if": "network=eVgo", "then": "eVgo" } ] @@ -501,6 +584,55 @@ } ] }, + { + "#": "phone", + "question": { + "en": "What number can one call if there is a problem with this charging station?" + }, + "render": { + "en": "In case of problems, call {phone}" + }, + "freeform": { + "key": "phone", + "type": "phone" + } + }, + { + "#": "email", + "question": { + "en": "What is the email address of the operator?" + }, + "render": { + "en": "In case of problems, send an email to {email}" + }, + "freeform": { + "key": "email", + "type": "email" + } + }, + { + "#": "website", + "question": { + "en": "What is the website of the operator?" + }, + "render": { + "en": "More info on {website}" + }, + "freeform": { + "key": "website", + "type": "url" + } + }, + { + "#": "ref", + "question": { + "en": "What is the reference number of this charging station?" + }, + "render": "Reference number is {ref}", + "freeform": { + "key": "ref" + } + }, { "#": "Operational status", "question": { @@ -508,13 +640,6 @@ "nl": "Is dit oplaadpunt operationeel?" }, "mappings": [ - { - "if": "operational_status=", - "then": { - "en": "This charging station works", - "nl": "Dit oplaadpunt werkt" - } - }, { "if": "operational_status=broken", "then": { @@ -522,6 +647,30 @@ "nl": "Dit oplaadpunt is kapot" } }, + { + "if": { + "and": [ + "planned:amenity=charging_station", + "amenity=" + ] + }, + "then": { + "en": "A charging station is planned here", + "nl": "Hier zal binnenkort een oplaadpunt gebouwd worden" + } + }, + { + "if": { + "and": [ + "construction:amenity=charging_station", + "amenity=" + ] + }, + "then": { + "en": "A charging station is constructed here", + "nl": "Hier wordt op dit moment een oplaadpunt gebouwd" + } + }, { "if": { "and": [ @@ -533,6 +682,13 @@ "en": "This charging station has beed permanently disabled and is not in use anymore but is still visible", "nl": "Dit oplaadpunt is niet meer in gebruik maar is wel nog aanwezig" } + }, + { + "if": "amenity=charging_station", + "then": { + "en": "This charging station works", + "nl": "Dit oplaadpunt werkt" + } } ] } @@ -565,6 +721,16 @@ }, "then": "cross_bottom_right:#c22;" }, + { + "if": { + "or": [ + "proposed:amenity=charging_station", + "planned:amenity=charging_station" + ] + }, + "then": "./assets/layers/charging_station/under_construction.svg", + "badge": true + }, { "if": { "and": [ @@ -631,45 +797,60 @@ } ] }, + { + "options": [ + { + "question": { + "en": "Only working charging stations" + }, + "osmTags": { + "and": [ + "operational_status!=broken", + "amenity=charging_station" + ] + } + } + ] + }, { "options": [ { "question": "All connectors" }, { - "question": "Has a Schuko wall plug without ground pin (CEE7/4 type F) connector", + "question": "Has a Schuko wall plug without ground pin (CEE7/4 type F) connector", "osmTags": "socket:schuko~*" }, { - "question": "Has a European wall plug with ground pin (CEE7/4 type E) connector", + "question": "Has a European wall plug with ground pin (CEE7/4 type E) connector", "osmTags": "socket:typee~*" }, { - "question": "Has a Chademo connector", + "question": "Has a Chademo connector", "osmTags": "socket:chademo~*" }, { - "question": "Has a Type 1 with cable (J1772) connector", + "question": "Has a Type 1 with cable (J1772) connector", "osmTags": "socket:type1_cable~*" }, { - "question": "Has a Type 1 without cable (J1772) connector", + "question": "Has a Type 1 without cable (J1772) connector", "osmTags": "socket:type1~*" }, { - "question": "Has a Type 1 CCS (aka Type 1 Combo) connector", + "question": "Has a Type 1 CCS (aka Type 1 Combo) connector", "osmTags": "socket:type1_combo~*" }, { - "question": "Has a Tesla Supercharger connector", + "question": "Has a Tesla Supercharger connector", "osmTags": "socket:tesla_supercharger~*" }, { - "question": "Has a Type 2 (mennekes) connector", + "question": "Has a Type 2 (mennekes) connector", "osmTags": "socket:type2~*" }, { - "question": "Has a Type 2 CCS (mennekes) connector", + "question": "Has a Type 2 CCS (mennekes) connector", "osmTags": "socket:type2_combo~*" } ] diff --git a/assets/layers/charging_station/charging_station.protojson b/assets/layers/charging_station/charging_station.protojson index a5aa6f068c..e16799f3ca 100644 --- a/assets/layers/charging_station/charging_station.protojson +++ b/assets/layers/charging_station/charging_station.protojson @@ -13,7 +13,9 @@ "osmTags": { "or": [ "amenity=charging_station", - "disused:amenity=charging_station" + "disused:amenity=charging_station", + "planned:amenity=charging_station", + "construction:amenity=charging_station" ] } }, @@ -288,37 +290,28 @@ }, "mappings": [ { - "if": { - "and": [ - "no:network=yes" - ] - }, + "if": "no:network=yes", "then": { "en": "Not part of a bigger network" } }, { - "if": { - "and": [ - "network=AeroVironment" - ] + "if": "network=none", + "then": { + "en": "Not part of a bigger network" }, + "hideInAnswer": true + }, + { + "if": "network=AeroVironment", "then": "AeroVironment" }, { - "if": { - "and": [ - "network=Blink" - ] - }, + "if": "network=Blink", "then": "Blink" }, { - "if": { - "and": [ - "network=eVgo" - ] - }, + "if": "network=eVgo", "then": "eVgo" } ] @@ -345,6 +338,52 @@ } ] }, + {"#": "phone", + "question": { + "en": "What number can one call if there is a problem with this charging station?" + }, + "render": { + "en": "In case of problems, call {phone}" + }, + "freeform": { + "key": "phone", + "type": "phone" + } + }, + {"#": "email", + "question": { + "en": "What is the email address of the operator?" + }, + "render": { + "en": "In case of problems, send an email to {email}" + }, + "freeform": { + "key": "email", + "type": "email" + } + }, + {"#": "website", + "question": { + "en": "What is the website of the operator?" + }, + "render": { + "en": "More info on {website}" + }, + "freeform": { + "key": "website", + "type": "url" + } + }, + { + "#": "ref", + "question": { + "en": "What is the reference number of this charging station?" + }, + "render": "Reference number is {ref}", + "freeform": { + "key": "ref" + } + }, { "#": "Operational status", "question": { @@ -352,13 +391,6 @@ "nl": "Is dit oplaadpunt operationeel?" }, "mappings": [ - { - "if": "operational_status=", - "then": { - "en": "This charging station works", - "nl": "Dit oplaadpunt werkt" - } - }, { "if": "operational_status=broken", "then": { @@ -366,6 +398,30 @@ "nl": "Dit oplaadpunt is kapot" } }, + { + "if": { + "and": [ + "planned:amenity=charging_station", + "amenity=" + ] + }, + "then": { + "en": "A charging station is planned here", + "nl": "Hier zal binnenkort een oplaadpunt gebouwd worden" + } + }, + { + "if": { + "and": [ + "construction:amenity=charging_station", + "amenity=" + ] + }, + "then": { + "en": "A charging station is constructed here", + "nl": "Hier wordt op dit moment een oplaadpunt gebouwd" + } + }, { "if": { "and": [ @@ -377,6 +433,13 @@ "en": "This charging station has beed permanently disabled and is not in use anymore but is still visible", "nl": "Dit oplaadpunt is niet meer in gebruik maar is wel nog aanwezig" } + }, + { + "if": "amenity=charging_station", + "then": { + "en": "This charging station works", + "nl": "Dit oplaadpunt werkt" + } } ] } @@ -402,10 +465,23 @@ "iconOverlays": [ { "if": { - "or": ["disused:amenity=charging_station","operational_status=broken"] + "or": [ + "disused:amenity=charging_station", + "operational_status=broken" + ] }, "then": "cross_bottom_right:#c22;" }, + { + "if": { + "or": [ + "proposed:amenity=charging_station", + "planned:amenity=charging_station" + ] + }, + "then": "./assets/layers/charging_station/under_construction.svg", + "badge": true + }, { "if": { "and": [ @@ -471,6 +547,21 @@ } } ] + }, + { + "options": [ + { + "question": { + "en": "Only working charging stations" + }, + "osmTags": { + "and": [ + "operational_status!=broken", + "amenity=charging_station" + ] + } + } + ] } ] } diff --git a/assets/layers/charging_station/csvToJson.ts b/assets/layers/charging_station/csvToJson.ts index 894b7674a7..bb347be29c 100644 --- a/assets/layers/charging_station/csvToJson.ts +++ b/assets/layers/charging_station/csvToJson.ts @@ -6,7 +6,7 @@ function run(file, protojson) { const entries: string[] = Utils.NoNull(readFileSync(file, "utf8").split("\n").map(str => str.trim())) entries.shift() - const result = [] + const overview_question_answers = [] const questions = [] const filterOptions: { question: string, osmTags?: string } [] = [ { @@ -20,27 +20,35 @@ function run(file, protojson) { continue; } + const txt = ` ${description}` const json = { if: `${key}=1`, ifnot: `${key}=`, - then: ` ${description}`, - + then: txt, } if (whitelist) { - const countries = whitelist.split(";").map(country => "_country!=" + country) //HideInAnswer if it is in the wrong country + const countries = whitelist.replace(/"/g, '').split(",").map(country => "_country!=" + country) //HideInAnswer if it is in the wrong country json["hideInAnswer"] = {or: countries} } - result.push(json) - + overview_question_answers.push(json) + // We add a second time for any amount to trigger a visualisation; but this is not an answer option + const no_ask_json = { + if: {and: [`${key}~*`,`${key}!=1`] + }, + then: txt, + hideInAnswer: true + } + overview_question_answers.push(no_ask_json) + const indivQ = { question: { en: `How much plugs of type ${description} are available here?` }, - render: `There are {${key}} plugs of type ${description} available here`, + render: `There are {${key}} plugs of type ${description} available here`, freeform: { key: key, type: "pnat" @@ -52,7 +60,7 @@ function run(file, protojson) { questions.push(indivQ) filterOptions.push({ - question: `Has a ${description} connector`, + question: `Has a ${description} connector`, osmTags: `${key}~*` }) } @@ -62,7 +70,7 @@ function run(file, protojson) { "en": "Which charging stations are available here?" }, "multiAnswer": true, - "mappings": result + "mappings": overview_question_answers } questions.unshift(toggles) diff --git a/assets/layers/charging_station/license_info.json b/assets/layers/charging_station/license_info.json index d11e020e8f..e7454df97c 100644 --- a/assets/layers/charging_station/license_info.json +++ b/assets/layers/charging_station/license_info.json @@ -98,5 +98,15 @@ "sources": [ "https://commons.wikimedia.org/wiki/File:Type3c.svg" ] + }, + { + "path": "under_construction.svg", + "license": "Public domain", + "authors": [ + "Sarang" + ], + "sources": [ + "https://upload.wikimedia.org/wikipedia/commons/2/20/UnderCon_icon.svg" + ] } ] \ No newline at end of file diff --git a/assets/layers/charging_station/types.csv b/assets/layers/charging_station/types.csv index 8ecef20472..fd303181d0 100644 --- a/assets/layers/charging_station/types.csv +++ b/assets/layers/charging_station/types.csv @@ -1,5 +1,5 @@ Key in OSM,image,Description,Country-whitelist,,,,,,, -socket:schuko,CEE7_4F.svg,Schuko wall plug without ground pin (CEE7/4 type F),be,fr,ma,tn,pl,cs,sk,mo +socket:schuko,CEE7_4F.svg,Schuko wall plug without ground pin (CEE7/4 type F),"be,fr,ma,tn,pl,cs,sk,mo" socket:typee,TypeE.svg,European wall plug with ground pin (CEE7/4 type E),,,,,,,, socket:chademo,Chademo_type4.svg,Chademo,,,,,,,, socket:type1_cable,Type1_J1772.svg,Type 1 with cable (J1772),,,,,,,, diff --git a/assets/layers/charging_station/under_construction.svg b/assets/layers/charging_station/under_construction.svg new file mode 100644 index 0000000000..02761dba0e --- /dev/null +++ b/assets/layers/charging_station/under_construction.svg @@ -0,0 +1,60 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/package.json b/package.json index e6df28878d..ad24fb535b 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "reset:layeroverview": "echo {\\\"layers\\\":[], \\\"themes\\\":[]} > ./assets/generated/known_layers_and_themes.json", "generate": "mkdir -p ./assets/generated && npm run reset:layeroverview && npm run generate:images && npm run generate:translations && npm run generate:layeroverview", "build": "rm -rf dist/ && npm run generate && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*", - "prepare-deploy": "npm run generate && npm run test && npm run generate:editor-layer-index && npm run generate:layeroverview && npm run generate:layouts && npm run build && rm -rf .cache", + "generate:charging-stations": "cd ./assets/layers/charging_station && ts-node csvToJson.ts && cd -", + "prepare-deploy": "npm run generate && npm run test && npm run generate:editor-layer-index && npm run generate:charging-stations && npm run generate:layeroverview && npm run generate:layouts && npm run build && rm -rf .cache", "deploy:staging": "npm run prepare-deploy && rm -rf ~/git/pietervdvn.github.io/Staging/* && cp -r dist/* ~/git/pietervdvn.github.io/Staging/ && cd ~/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean", "deploy:pietervdvn": "cd ~/git/pietervdvn.github.io/ && git pull && cd - && npm run prepare-deploy && rm -rf ~/git/pietervdvn.github.io/MapComplete/* && cp -r dist/* ~/git/pietervdvn.github.io/MapComplete/ && cd ~/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean", "deploy:production": "cd ~/git/mapcomplete.github.io/ && git pull && cd - && rm -rf ./assets/generated && npm run prepare-deploy && npm run optimize-images && rm -rf ~/git/mapcomplete.github.io/* && cp -r dist/* ~/git/mapcomplete.github.io/ && cd ~/git/mapcomplete.github.io/ && echo \"mapcomplete.osm.be\" > CNAME && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean && npm run gittag",