diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build/client.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/build/client.sh b/scripts/build/client.sh index e4d053e82..567a6e5e0 100755 --- a/scripts/build/client.sh +++ b/scripts/build/client.sh | |||
@@ -2,25 +2,49 @@ | |||
2 | 2 | ||
3 | set -eu | 3 | set -eu |
4 | 4 | ||
5 | pre_build_hook () { | ||
6 | mkdir "./src/locale/pending_target/" > /dev/null || true | ||
7 | mv ./src/locale/target/angular_*.xml "./src/locale/pending_target" | ||
8 | |||
9 | if [ ! -z ${1+x} ]; then | ||
10 | mv "./src/locale/pending_target/angular_$1.xml" "./src/locale/target" | ||
11 | fi | ||
12 | } | ||
13 | |||
14 | post_build_hook () { | ||
15 | mv ./src/locale/pending_target/* "./src/locale/target/" | ||
16 | rmdir "./src/locale/pending_target/" | ||
17 | } | ||
18 | |||
5 | cd client | 19 | cd client |
6 | 20 | ||
7 | rm -rf ./dist ./compiled | 21 | rm -rf ./dist ./compiled |
8 | 22 | ||
23 | pre_build_hook | ||
24 | |||
9 | defaultLanguage="en_US" | 25 | defaultLanguage="en_US" |
10 | npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json | 26 | npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json |
11 | mv "./dist/$defaultLanguage/assets" "./dist" | 27 | mv "./dist/$defaultLanguage/assets" "./dist" |
12 | 28 | ||
29 | post_build_hook | ||
30 | |||
13 | # Don't build other languages if --light arg is provided | 31 | # Don't build other languages if --light arg is provided |
14 | if [ -z ${1+x} ] || [ "$1" != "--light" ]; then | 32 | if [ -z ${1+x} ] || [ "$1" != "--light" ]; then |
15 | # Supported languages | 33 | # Supported languages |
16 | languages=("fr_FR" "eu_ES" "ca_ES" "cs_CZ" "eo") | 34 | languages=("fr_FR" "eu_ES" "ca_ES" "cs_CZ" "eo") |
17 | 35 | ||
18 | for lang in "${languages[@]}"; do | 36 | for lang in "${languages[@]}"; do |
37 | # TODO: remove when the project will use runtime translations | ||
38 | pre_build_hook "$lang" | ||
39 | |||
19 | npm run ng build -- --prod --i18n-file "./src/locale/target/angular_$lang.xml" --i18n-format xlf --i18n-locale "$lang" \ | 40 | npm run ng build -- --prod --i18n-file "./src/locale/target/angular_$lang.xml" --i18n-format xlf --i18n-locale "$lang" \ |
20 | --output-path "dist/$lang/" --deploy-url "/client/$lang/" | 41 | --output-path "dist/$lang/" --deploy-url "/client/$lang/" |
21 | 42 | ||
22 | # Do no duplicate assets | 43 | # Do no duplicate assets |
23 | rm -r "./dist/$lang/assets" | 44 | rm -r "./dist/$lang/assets" |
45 | |||
46 | # TODO: remove when the project will use runtime translations | ||
47 | post_build_hook | ||
24 | done | 48 | done |
25 | fi | 49 | fi |
26 | 50 | ||