Create a build script which splits deployment

This commit is contained in:
pietervdvn 2021-12-22 01:53:58 +01:00
parent 70aa6eb003
commit 928d119816
5 changed files with 37 additions and 37 deletions

View file

@ -3,11 +3,16 @@
"description": "The default rendering for a locationInput which snaps onto another object",
"source": {
"osmTags": {
"and": []}
"and": []
}
},
"mapRendering": [{
"location": ["point","centroid"],
"icon": "./assets/svg/crosshair-empty.svg"
}]
"mapRendering": [
{
"location": [
"point",
"centroid"
],
"icon": "./assets/svg/crosshair-empty.svg"
}
]
}

View file

@ -486,7 +486,8 @@
"id": "Import-button",
"render": "{import_way_button(OSM-buildings,building=$building;man_made=$man_made; source:geometry:date=$_grb_date; source:geometry:ref=$_grb_ref; addr:street=$addr:street; addr:housenumber=$addr:housenumber; building:min_level=$_building:min_level, Upload this building to OpenStreetMap,,_is_part_of_building=true,1,_moveable=true)}",
"mappings": [
{"#": "Hide import button if intersection with other objects are detected",
{
"#": "Hide import button if intersection with other objects are detected",
"if": "_intersects_with_other_features~*",
"then": "This GRB building intersects with the following features: {_intersects_with_other_features}.<br/>Fix the overlap and try again"
},
@ -533,7 +534,6 @@
"if": "_osm_obj:addr:housenumber~*",
"then": "The overlapping building only has a housenumber known: {_osm_obj:addr:housenumber}"
},
{
"if": "_osm_obj:id=",
"then": "No overlapping OpenStreetMap-building found"

View file

@ -39,9 +39,9 @@
"optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'",
"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:charging-stations && npm run generate:translations && npm run generate:licenses && npm run validate:layeroverview",
"build": "rm -rf dist/ && npm run generate && node --max_old_space_size=12000 $(which parcel) build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
"build": "npm run generate && ./scripts/build.sh",
"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:layouts && npm run build && rm -rf .cache",
"prepare-deploy": "npm run generate && npm run test && npm run generate:editor-layer-index && npm run generate:layouts && npm run build",
"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",

22
scripts/build.sh Normal file
View file

@ -0,0 +1,22 @@
#! /bin/bash
# The build script; we build the application step by step as building everything at once takes too much RAM
# Should be run from the repository root
rm -rf dist/*
rm -rf .cache
mkdir dist 2> /dev/null
# 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/
cp -r assets/svg/ dist/assets/svg/
parcel build --no-source-maps --public-url ./ "index.html" "404.html" "professional.html" "automaton.html" "land.html" "customGenerator.html" "theme.html" vendor
for file in $(ls index_*.ts)
do
theme=${file:6:-3}
echo $theme
# Builds the necessary files for just one theme, e.g. 'bookcases.html' + 'index_bookcases.ts' + supporting file
# npm run generate && node --max_old_space_size=12000 $(which parcel) build
parcel build --no-source-maps --public-url ./ "$theme.html"
done

View file

@ -1,27 +0,0 @@
#! /bin/bash
# To run with crontab:
# */1 * * * * /home/pietervdvn/git/MapComplete/scripts/deployIfChanged.sh >> /home/pietervdvn/auto_deploy_caching.log 2>&1
PATH=/home/pietervdvn/.local/bin:/home/pietervdvn/.nvm/versions/node/v16.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/pietervdvn/.dotnet/tools
cd ~/git/MapComplete
git fetch
HEADHASH=$(git rev-parse HEAD)
UPSTREAMHASH=$(git rev-parse master@{upstream})
if [ "$HEADHASH" != "$UPSTREAMHASH" ]
then
echo Not up to date with origin. Deploying!
git pull
npm run generate:translations
git commit -am "Sync translations"
git push
npm run generate:docs
git commit -am "Autgenerate docs and taginfo files"
npm run deploy:production
fi