2018-06-28 14:56:46 +02:00
|
|
|
#!/bin/bash
|
2016-06-03 22:47:55 +02:00
|
|
|
|
2018-03-27 10:35:12 +02:00
|
|
|
set -eu
|
|
|
|
|
2020-02-07 15:51:19 +01:00
|
|
|
declare -A languages
|
2020-08-12 10:40:04 +02:00
|
|
|
defaultLanguage="en-US"
|
2020-02-07 15:51:19 +01:00
|
|
|
|
2020-08-12 10:40:04 +02:00
|
|
|
# Supported languages
|
|
|
|
languages=(
|
|
|
|
["ar"]="ar"
|
2024-11-29 11:25:55 +01:00
|
|
|
["sk"]="sk-SK"
|
2023-02-13 10:17:53 +01:00
|
|
|
["is"]="is"
|
2024-03-26 14:25:12 +01:00
|
|
|
["tr"]="tr-TR"
|
2022-03-03 10:54:52 +01:00
|
|
|
["fa"]="fa-IR"
|
2020-08-12 10:40:04 +02:00
|
|
|
["en"]="en-US"
|
|
|
|
["vi"]="vi-VN"
|
|
|
|
["hu"]="hu-HU"
|
|
|
|
["th"]="th-TH"
|
|
|
|
["fi"]="fi-FI"
|
|
|
|
["nl"]="nl-NL"
|
|
|
|
["gd"]="gd"
|
|
|
|
["el"]="el-GR"
|
|
|
|
["es"]="es-ES"
|
|
|
|
["oc"]="oc"
|
|
|
|
["pt"]="pt-BR"
|
|
|
|
["pt-PT"]="pt-PT"
|
|
|
|
["sv"]="sv-SE"
|
|
|
|
["pl"]="pl-PL"
|
|
|
|
["ru"]="ru-RU"
|
|
|
|
["zh-Hans"]="zh-Hans-CN"
|
|
|
|
["zh-Hant"]="zh-Hant-TW"
|
|
|
|
["fr"]="fr-FR"
|
|
|
|
["ja"]="ja-JP"
|
|
|
|
["eu"]="eu-ES"
|
|
|
|
["ca"]="ca-ES"
|
2020-12-16 11:45:12 +01:00
|
|
|
["gl"]="gl-ES"
|
2020-08-12 10:40:04 +02:00
|
|
|
["cs"]="cs-CZ"
|
2022-07-11 16:25:43 +02:00
|
|
|
["hr"]="hr"
|
2020-08-12 10:40:04 +02:00
|
|
|
["eo"]="eo"
|
|
|
|
["de"]="de-DE"
|
|
|
|
["it"]="it-IT"
|
2023-02-13 16:25:53 +01:00
|
|
|
["uk"]="uk-UA"
|
2021-03-09 11:34:46 +01:00
|
|
|
["sq"]="sq"
|
2022-06-24 11:51:30 +02:00
|
|
|
["tok"]="tok"
|
2021-12-13 17:06:44 +01:00
|
|
|
["nn"]="nn"
|
|
|
|
["nb"]="nb-NO"
|
2020-08-12 10:40:04 +02:00
|
|
|
["kab"]="kab"
|
|
|
|
)
|
2018-08-16 11:11:20 +02:00
|
|
|
|
2018-03-27 10:35:12 +02:00
|
|
|
cd client
|
2016-06-03 22:47:55 +02:00
|
|
|
|
2021-06-17 10:43:34 +02:00
|
|
|
rm -rf ./dist
|
2017-04-26 21:46:56 +02:00
|
|
|
|
2018-07-18 09:52:46 +02:00
|
|
|
# Don't build other languages if --light arg is provided
|
2020-11-26 08:52:43 +01:00
|
|
|
if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); then
|
2021-02-02 15:33:58 +01:00
|
|
|
additionalParams=""
|
|
|
|
if [ ! -z ${1+x} ] && [ "$1" == "--source-map" ]; then
|
2022-06-14 08:26:35 +02:00
|
|
|
additionalParams="--source-map=true"
|
2021-02-02 15:33:58 +01:00
|
|
|
fi
|
|
|
|
|
2021-07-05 15:19:23 +02:00
|
|
|
node --max_old_space_size=8192 node_modules/.bin/ng build --configuration production --output-path "dist/build" $additionalParams
|
2018-07-18 09:52:46 +02:00
|
|
|
|
2020-02-07 15:51:19 +01:00
|
|
|
for key in "${!languages[@]}"; do
|
|
|
|
lang=${languages[$key]}
|
|
|
|
|
2024-06-24 10:15:25 +02:00
|
|
|
mv "dist/build/browser/$key" "dist/$lang"
|
2018-07-25 09:57:52 +02:00
|
|
|
|
2020-08-12 10:40:04 +02:00
|
|
|
if [ "$lang" != "en-US" ]; then
|
|
|
|
# Do not duplicate assets
|
|
|
|
rm -r "./dist/$lang/assets"
|
|
|
|
fi
|
|
|
|
done
|
2020-02-07 15:51:19 +01:00
|
|
|
|
2020-08-12 10:40:04 +02:00
|
|
|
mv "./dist/$defaultLanguage/assets" "./dist"
|
2020-02-12 14:09:24 +01:00
|
|
|
|
2024-06-24 10:15:25 +02:00
|
|
|
rm -r "dist/build"
|
|
|
|
cp "./dist/$defaultLanguage/manifest.webmanifest" "./dist/manifest.webmanifest"
|
2020-08-12 10:40:04 +02:00
|
|
|
else
|
|
|
|
additionalParams=""
|
|
|
|
if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
|
2022-06-13 15:15:20 +02:00
|
|
|
additionalParams="--named-chunks=true --output-hashing=none"
|
2021-08-18 10:32:40 +02:00
|
|
|
|
2024-06-24 10:15:25 +02:00
|
|
|
# For Vite
|
2020-08-12 10:40:04 +02:00
|
|
|
export ANALYZE_BUNDLE=true
|
|
|
|
fi
|
2018-07-18 09:52:46 +02:00
|
|
|
|
2021-07-05 15:19:23 +02:00
|
|
|
node --max_old_space_size=8192 node_modules/.bin/ng build --localize=false --output-path "dist/$defaultLanguage/" \
|
2022-06-13 15:15:20 +02:00
|
|
|
--configuration production --stats-json $additionalParams
|
2018-07-18 09:52:46 +02:00
|
|
|
fi
|
2018-05-31 18:12:15 +02:00
|
|
|
|
2020-08-06 10:26:39 +02:00
|
|
|
cd ../ && npm run build:embed && cd client/
|
2018-05-31 18:12:15 +02:00
|
|
|
|
2018-06-06 18:17:24 +02:00
|
|
|
# Copy runtime locales
|
2019-11-07 15:33:23 +01:00
|
|
|
cp -r "./src/locale" "./dist/locale"
|