2018-06-28 08:56:46 -04:00
|
|
|
#!/bin/bash
|
2016-06-03 16:47:55 -04:00
|
|
|
|
2018-03-27 04:35:12 -04:00
|
|
|
set -eu
|
|
|
|
|
2020-02-07 09:51:19 -05:00
|
|
|
declare -A languages
|
2020-08-12 04:40:04 -04:00
|
|
|
defaultLanguage="en-US"
|
2020-02-07 09:51:19 -05:00
|
|
|
|
2020-08-12 04:40:04 -04:00
|
|
|
# Supported languages
|
|
|
|
languages=(
|
|
|
|
["ar"]="ar"
|
|
|
|
["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 05:45:12 -05:00
|
|
|
["gl"]="gl-ES"
|
2020-08-12 04:40:04 -04:00
|
|
|
["cs"]="cs-CZ"
|
|
|
|
["eo"]="eo"
|
|
|
|
["de"]="de-DE"
|
|
|
|
["it"]="it-IT"
|
|
|
|
["kab"]="kab"
|
|
|
|
)
|
2018-08-16 05:11:20 -04:00
|
|
|
|
2018-03-27 04:35:12 -04:00
|
|
|
cd client
|
2016-06-03 16:47:55 -04:00
|
|
|
|
2017-12-13 11:51:32 -05:00
|
|
|
rm -rf ./dist ./compiled
|
2017-04-26 15:46:56 -04:00
|
|
|
|
2018-07-18 03:52:46 -04:00
|
|
|
# Don't build other languages if --light arg is provided
|
2020-11-26 02:52:43 -05:00
|
|
|
if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); then
|
2020-08-12 04:40:04 -04:00
|
|
|
npm run ng build -- --prod --output-path "dist/build"
|
2018-07-18 03:52:46 -04:00
|
|
|
|
2020-02-07 09:51:19 -05:00
|
|
|
for key in "${!languages[@]}"; do
|
|
|
|
lang=${languages[$key]}
|
|
|
|
|
2020-08-12 04:40:04 -04:00
|
|
|
mv "dist/build/$key" "dist/$lang"
|
2018-07-25 03:57:52 -04:00
|
|
|
|
2020-08-12 04:40:04 -04:00
|
|
|
if [ "$lang" != "en-US" ]; then
|
|
|
|
# Do not duplicate assets
|
|
|
|
rm -r "./dist/$lang/assets"
|
|
|
|
fi
|
|
|
|
done
|
2020-02-07 09:51:19 -05:00
|
|
|
|
2020-08-12 04:40:04 -04:00
|
|
|
mv "./dist/$defaultLanguage/assets" "./dist"
|
2020-02-12 08:09:24 -05:00
|
|
|
|
2020-08-12 04:40:04 -04:00
|
|
|
rmdir "dist/build"
|
|
|
|
else
|
|
|
|
additionalParams=""
|
|
|
|
if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
|
|
|
|
additionalParams="--namedChunks=true --outputHashing=none"
|
|
|
|
export ANALYZE_BUNDLE=true
|
|
|
|
fi
|
2018-07-18 03:52:46 -04:00
|
|
|
|
2020-08-12 04:40:04 -04:00
|
|
|
npm run ng build -- --localize=false --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json $additionalParams
|
2018-07-18 03:52:46 -04:00
|
|
|
fi
|
2018-05-31 12:12:15 -04:00
|
|
|
|
2021-01-18 05:16:37 -05:00
|
|
|
cp "./dist/$defaultLanguage/manifest.webmanifest" "./dist/manifest.webmanifest"
|
2020-12-12 22:15:27 -05:00
|
|
|
|
2020-08-06 04:26:39 -04:00
|
|
|
cd ../ && npm run build:embed && cd client/
|
2018-05-31 12:12:15 -04:00
|
|
|
|
2018-06-06 12:17:24 -04:00
|
|
|
# Copy runtime locales
|
2019-11-07 09:33:23 -05:00
|
|
|
cp -r "./src/locale" "./dist/locale"
|