]>
Commit | Line | Data |
---|---|---|
10e63b68 | 1 | #!/bin/bash |
b20b5fed | 2 | |
0e4ffb4b LA |
3 | set -eu |
4 | ||
361dcebc | 5 | declare -A languages |
66357162 | 6 | defaultLanguage="en-US" |
361dcebc | 7 | |
66357162 C |
8 | # Supported languages |
9 | languages=( | |
10 | ["ar"]="ar" | |
11 | ["en"]="en-US" | |
12 | ["vi"]="vi-VN" | |
13 | ["hu"]="hu-HU" | |
14 | ["th"]="th-TH" | |
15 | ["fi"]="fi-FI" | |
16 | ["nl"]="nl-NL" | |
17 | ["gd"]="gd" | |
18 | ["el"]="el-GR" | |
19 | ["es"]="es-ES" | |
20 | ["oc"]="oc" | |
21 | ["pt"]="pt-BR" | |
22 | ["pt-PT"]="pt-PT" | |
23 | ["sv"]="sv-SE" | |
24 | ["pl"]="pl-PL" | |
25 | ["ru"]="ru-RU" | |
26 | ["zh-Hans"]="zh-Hans-CN" | |
27 | ["zh-Hant"]="zh-Hant-TW" | |
28 | ["fr"]="fr-FR" | |
29 | ["ja"]="ja-JP" | |
30 | ["eu"]="eu-ES" | |
31 | ["ca"]="ca-ES" | |
c7444546 | 32 | ["gl"]="gl-ES" |
66357162 C |
33 | ["cs"]="cs-CZ" |
34 | ["eo"]="eo" | |
35 | ["de"]="de-DE" | |
36 | ["it"]="it-IT" | |
f45aa01a | 37 | ["sq"]="sq" |
66175ae8 C |
38 | ["nn"]="nn" |
39 | ["nb"]="nb-NO" | |
66357162 C |
40 | ["kab"]="kab" |
41 | ) | |
95d51135 | 42 | |
0e4ffb4b | 43 | cd client |
b20b5fed | 44 | |
29b7426c | 45 | rm -rf ./dist |
d61e8153 | 46 | |
e032aec9 | 47 | # Don't build other languages if --light arg is provided |
ae48a71d | 48 | if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); then |
29f148a6 C |
49 | additionalParams="" |
50 | if [ ! -z ${1+x} ] && [ "$1" == "--source-map" ]; then | |
51 | additionalParams="--sourceMap=true" | |
52 | fi | |
53 | ||
13c749c1 | 54 | node --max_old_space_size=8192 node_modules/.bin/ng build --configuration production --output-path "dist/build" $additionalParams |
e032aec9 | 55 | |
361dcebc C |
56 | for key in "${!languages[@]}"; do |
57 | lang=${languages[$key]} | |
58 | ||
66357162 | 59 | mv "dist/build/$key" "dist/$lang" |
d73c9888 | 60 | |
66357162 C |
61 | if [ "$lang" != "en-US" ]; then |
62 | # Do not duplicate assets | |
63 | rm -r "./dist/$lang/assets" | |
64 | fi | |
65 | done | |
361dcebc | 66 | |
66357162 | 67 | mv "./dist/$defaultLanguage/assets" "./dist" |
2779f29a | 68 | |
66357162 C |
69 | rmdir "dist/build" |
70 | else | |
71 | additionalParams="" | |
72 | if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then | |
73 | additionalParams="--namedChunks=true --outputHashing=none" | |
33a53638 C |
74 | |
75 | # For webpack | |
66357162 C |
76 | export ANALYZE_BUNDLE=true |
77 | fi | |
e032aec9 | 78 | |
13c749c1 | 79 | node --max_old_space_size=8192 node_modules/.bin/ng build --localize=false --output-path "dist/$defaultLanguage/" \ |
662351e6 | 80 | --deploy-url "/client/$defaultLanguage/" --configuration production --stats-json $additionalParams |
e032aec9 | 81 | fi |
989e526a | 82 | |
1d22d251 | 83 | cp "./dist/$defaultLanguage/manifest.webmanifest" "./dist/manifest.webmanifest" |
dfdd158a | 84 | |
a3b5e78a | 85 | cd ../ && npm run build:embed && cd client/ |
989e526a | 86 | |
96bb360d | 87 | # Copy runtime locales |
350131cb | 88 | cp -r "./src/locale" "./dist/locale" |