]> git.openstreetmap.org Git - nominatim-ui.git/blob - build.sh
URL query parser can return zoom as null or empty string, check for both
[nominatim-ui.git] / build.sh
1 #!/bin/bash
2
3 mkdir -p dist/assets/
4 rsync --quiet --recursive src/assets/css/ dist/assets/css/
5 rsync --quiet --recursive src/assets/images/ dist/assets/images/
6
7 mkdir -p dist/assets/js/
8 cat src/assets/js/base.js src/assets/js/detailpage.js src/assets/js/searchpage.js > dist/assets/js/nominatim-ui.js
9
10 rsync --quiet node_modules/jquery/dist/jquery.min.js dist/assets/js/
11 rsync --quiet node_modules/leaflet/dist/leaflet.js dist/assets/js/
12 rsync --quiet node_modules/leaflet/dist/leaflet.js.map dist/assets/js/
13 rsync --quiet node_modules/leaflet/dist/leaflet.css dist/assets/css/
14 rsync --quiet node_modules/leaflet/dist/images/* dist/assets/css/images/
15
16 rsync --quiet node_modules/leaflet-minimap/dist/Control.MiniMap.min.js dist/assets/js/
17 rsync --quiet node_modules/leaflet-minimap/dist/Control.MiniMap.min.css dist/assets/css/
18 rsync --quiet node_modules/leaflet-minimap/dist/images/* dist/assets/css/images/
19
20 rsync --quiet node_modules/bootstrap/dist/js/bootstrap.min.js dist/assets/js/
21 rsync --quiet node_modules/bootstrap/dist/css/bootstrap.min.css* dist/assets/css/
22 rsync --quiet node_modules/bootstrap/dist/css/bootstrap-theme.min.css* dist/assets/css/
23
24 rsync --quiet node_modules/handlebars/dist/handlebars.min.js dist/assets/js/
25 rsync --quiet node_modules/@ungap/url-search-params/min.js dist/assets/js/url-search-params.js
26 rsync --quiet src/templates/*.hbs dist/
27
28 rsync --quiet src/*.js dist/
29
30
31 # replaced the Perl one-liner with shell logic to remove the dependency
32 # cat src/layout.html | perl -pe'use File::Slurper qw(read_text); s/\@include\((.+?)\)/read_text($1)/eg' > /tmp/included.html
33
34 cat src/layout.html | grep -v '</body>' | grep -v '</html>' | sed -e 's/BODYID/search-page/' > dist/search.html
35 echo '<script id="searchpage-template" type="text/x-handlebars-template">' >> dist/search.html
36 cat src/templates/searchpage.hbs >> dist/search.html
37 echo '</script>' >> dist/search.html
38 echo '</body>' >> dist/search.html
39 echo '</html>' >> dist/search.html
40
41 cat src/layout.html | grep -v '</body>' | grep -v '</html>' | sed -e 's/BODYID/reverse-page/' > dist/reverse.html
42 echo '<script id="reversepage-template" type="text/x-handlebars-template">' >> dist/reverse.html
43 cat src/templates/reversepage.hbs >> dist/reverse.html
44 echo '</script>' >> dist/reverse.html
45 echo '</body>' >> dist/reverse.html
46 echo '</html>' >> dist/reverse.html
47
48 cat src/layout.html | grep -v '</body>' | grep -v '</html>' | sed -e 's/BODYID/details-page/' > dist/details.html
49 echo '<script id="detailspage-template" type="text/x-handlebars-template">' >> dist/details.html
50 cat src/templates/detailspage.hbs >> dist/details.html
51 echo '</script>' >> dist/details.html
52 echo '<script id="detailspage-index-template" type="text/x-handlebars-template">' >> dist/details.html
53 cat src/templates/detailspage-index.hbs >> dist/details.html
54 echo '</script>' >> dist/details.html
55 echo '</body>' >> dist/details.html
56 echo '</html>' >> dist/details.html
57
58 cp src/index.html dist/