From e1791d3acb0cb8b375296536351aad86f141d7d8 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 17 Jan 2023 03:37:26 +0100 Subject: [PATCH] Fix the build --- .../mapcomplete-changes.json | 110 ++++-------------- scripts/build.sh | 38 +++--- vite.config.js | 19 ++- 3 files changed, 54 insertions(+), 113 deletions(-) diff --git a/assets/themes/mapcomplete-changes/mapcomplete-changes.json b/assets/themes/mapcomplete-changes/mapcomplete-changes.json index 9cbbdc87c..137bb9260 100644 --- a/assets/themes/mapcomplete-changes/mapcomplete-changes.json +++ b/assets/themes/mapcomplete-changes/mapcomplete-changes.json @@ -1,21 +1,13 @@ { "id": "mapcomplete-changes", "title": { - "en": "Changes made with MapComplete", - "de": "Mit MapComplete vorgenommene Änderungen", - "nl": "Wijzigingen gemaakt met MapComplete" + "en": "Changes made with MapComplete" }, "shortDescription": { - "en": "Shows changes made by MapComplete", - "de": "Zeigt Änderungen, die von MapComplete vorgenommen wurden", - "nl": "Toont wijzigingen gemaakt met MapComplete" + "en": "Shows changes made by MapComplete" }, "description": { - "en": "This map shows all the changes made with MapComplete", - "ca": "Aquest mapa mostra tots els canvis fets amb MapComplete", - "de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen", - "fr": "Cette carte montre tous les changements faits avec MapComplete", - "nl": "Deze kaart toont alle wijzigingen gemaakt met MapComplete" + "en": "This maps shows all the changes made with MapComplete" }, "icon": "./assets/svg/logo.svg", "hideFromOverview": true, @@ -28,10 +20,7 @@ { "id": "mapcomplete-changes", "name": { - "en": "Changeset centers", - "de": "Zentrum der Änderungssätze", - "fr": "Centres de modifications de paramètres", - "nl": "Middelpunt van de wijzigingenset" + "en": "Changeset centers" }, "minzoom": 0, "source": { @@ -42,58 +31,41 @@ }, "title": { "render": { - "en": "Changeset for {theme}", - "de": "Änderungssatz für {theme}", - "nl": "Changeset voor {theme}" + "en": "Changeset for {theme}" } }, "description": { - "en": "Shows all MapComplete changes", - "de": "Zeigt alle MapComplete-Änderungen", - "fr": "Montre tous les changements de MapComplete", - "nl": "Toon alle MapComplete wijzigingen" + "en": "Shows all MapComplete changes" }, "tagRenderings": [ { "id": "show_changeset_id", "render": { - "en": "Changeset {id}", - "de": "Änderungssatz {id}", - "nl": "Wijzigingenset {id}" + "en": "Changeset {id}" } }, { "id": "contributor", "question": { - "en": "What contributor did make this change?", - "de": "Welcher Mitwirkende hat diese Änderung vorgenommen?", - "fr": "Quel contributeur a fait ce changement ?", - "nl": "Welke bijdrager maakte deze wijziging?" + "en": "What contributor did make this change?" }, "freeform": { "key": "user" }, "render": { - "en": "Change made by {user}", - "de": "Änderung vorgenommen von {user}", - "fr": "Modification faite par {user}", - "nl": "Wijziging gemaakt door {user}" + "en": "Change made by {user}" } }, { "id": "theme-id", "question": { - "en": "What theme was used to make this change?", - "de": "Welches Thema wurde für diese Änderung verwendet?", - "nl": "Welk thema is gebruikt voor deze wijziging?" + "en": "What theme was used to make this change?" }, "freeform": { "key": "theme" }, "render": { - "en": "Change with theme {theme}", - "de": "Geändert mit Thema {theme}", - "nl": "Wijziging met thema {theme}" + "en": "Change with theme {theme}" } }, { @@ -102,32 +74,19 @@ "key": "locale" }, "question": { - "en": "What locale (language) was this change made in?", - "de": "In welchem Gebietsschema (Sprache) wurde diese Änderung vorgenommen?", - "fr": "En quelle langue est-ce que ce changement a été fait ?", - "nl": "In welke taal (en cultuur) werd deze wijziging gemaakt?" + "en": "What locale (language) was this change made in?" }, "render": { - "en": "User locale is {locale}", - "de": "Benutzergebietsschema ist {locale}", - "fr": "La langue de l'utilisateur est {locale}", - "nl": "De locale van de bijdrager is {locale}" + "en": "User locale is {locale}" } }, { "id": "host", "render": { - "en": "Change with {host}", - "ca": "Canvi amb {host}", - "de": "Geändert über {host}", - "fr": "Changement avec {host}", - "nl": "Wijziging met {host}" + "en": "Change with with {host}" }, "question": { - "en": "What host (website) was this change made with?", - "de": "Über welchen Host (Webseite) wurde diese Änderung vorgenommen?", - "fr": "Depuis quel serveur (site web) ce changement a-t-il été fait ?", - "nl": "Op welk webadres werd deze wijziging gemaakt?" + "en": "What host (website) was this change made with?" }, "freeform": { "key": "host" @@ -468,10 +427,7 @@ } ], "question": { - "en": "Themename contains {search}", - "de": "Themename enthält {search}", - "fr": "Nom de thème contenant {search}", - "nl": "Themanaam bevat {search}" + "en": "Themename contains {search}" } } ] @@ -487,10 +443,7 @@ } ], "question": { - "en": "Made by contributor {search}", - "de": "Erstellt vom Mitwirkenden {search}", - "fr": "Fait par le contributeur {search}", - "nl": "Gemaakt door {search}" + "en": "Made by contributor {search}" } } ] @@ -506,10 +459,7 @@ } ], "question": { - "en": "Not made by contributor {search}", - "de": "Nicht von Mitwirkendem {search}", - "fr": "Non réalisé par le contributeur{search}", - "nl": "Niet gemaakt door {search}" + "en": "Not made by contributor {search}" } } ] @@ -526,10 +476,7 @@ } ], "question": { - "en": "Made before {search}", - "de": "Erstellt vor {search}", - "fr": "Fait avant {search}", - "nl": "Gemaakt voor {search}" + "en": "Made before {search}" } } ] @@ -546,10 +493,7 @@ } ], "question": { - "en": "Made after {search}", - "de": "Erstellt nach {search}", - "fr": "Fait après {search}", - "nl": "Gemaakt na {search}" + "en": "Made after {search}" } } ] @@ -565,10 +509,7 @@ } ], "question": { - "en": "User language (iso-code) {search}", - "de": "Benutzersprache (ISO-Code) {search}", - "fr": "Langage utilisateur (code-iso) {search}", - "nl": "Gebruikerstaal (iso-code) {search}" + "en": "User language (iso-code) {search}" } } ] @@ -584,10 +525,7 @@ } ], "question": { - "en": "Made with host {search}", - "de": "Erstellt mit host {search}", - "fr": "Fait par le serveur {search}", - "nl": "Gemaakt met host {search}" + "en": "Made with host {search}" } } ] @@ -613,9 +551,7 @@ { "id": "link_to_more", "render": { - "en": "More statistics can be found here", - "de": "Weitere Statistiken hier", - "nl": "Meer statistieken zijn hier te vinden" + "en": "More statistics can be found here" } }, { diff --git a/scripts/build.sh b/scripts/build.sh index 5b481ff05..dc594d2b2 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -22,6 +22,20 @@ if [ $? -ne 0 ]; then exit 1 fi + + +SRC_MAPS="" +BRANCH=`git rev-parse --abbrev-ref HEAD` +echo "The branch name is $BRANCH" +if [ $BRANCH = "develop" ] +then + SRC_MAPS="--sourcemap" + echo "Source maps are enabled" +fi + +vite build $SRC_MAPS + + # Copy the layer files, as these might contain assets (e.g. svgs) cp -r assets/layers/ dist/assets/layers/ cp -r assets/themes/ dist/assets/themes/ @@ -30,27 +44,3 @@ cp -r assets/templates/ dist/assets/templates/ cp -r assets/tagRenderings/ dist/assets/tagRenderings/ cp assets/*.png dist/assets/ cp assets/*.svg dist/assets/ - - -echo -e "\n\n Building non-theme pages" -echo -e " ==========================\n\n" -vite build "index.html" "404.html" "professional.html" "automaton.html" "import_helper.html" "import_viewer.html" "land.html" "customGenerator.html" "theme.html" vendor -if [ $? -ne 0 ]; then - echo "ERROR - stopping the build" - exit 1 -fi -echo -e "\n\n Building theme pages" -echo -e " ======================\n\n" - -for file in index_*.ts -do - theme=${file:6:-3} - echo -e "\n\n $theme" - echo -e " ------------ \n\n" - # Builds the necessary files for just one theme, e.g. 'bookcases.html' + 'index_bookcases.ts' + supporting file - vite build './' "$theme.html" - if [ $? -ne 0 ]; then - echo "ERROR - stopping the build" - exit 1 - fi -done diff --git a/vite.config.js b/vite.config.js index 2170eade8..8e0e27008 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,2 +1,17 @@ -/** @type {import('vite').UserConfig} */ -export default {} +const { defineConfig } = require("vite") +import fs from "fs" +const allHtmlFiles = fs.readdirSync(".").filter((f) => f.endsWith(".html")) +const input = {} + +for (const html of allHtmlFiles) { + const name = html.substring(0, html.length - 5) + input[name] = "./" + html +} + +module.exports = defineConfig({ + build: { + rollupOptions: { + input, + }, + }, +})