Skip to content

Commit

Permalink
Migrate angular to v9 (kubernetes#4930)
Browse files Browse the repository at this point in the history
* Bump required node version

* Migrate angular from v8 to v9

* Bump rest of dependencies

* Bump angular material

* Update tsconfig

* Fix ace editor

* Cleanup

* Fix i18n
  • Loading branch information
Sebastian Florek authored Feb 28, 2020
1 parent 01d4cd8 commit 4cab78c
Show file tree
Hide file tree
Showing 70 changed files with 17,034 additions and 6,123 deletions.
32 changes: 7 additions & 25 deletions aio/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,13 @@ function clean {
}

function build::frontend {
say "\nBuilding frontend for default locale: en"
mkdir -p ${FRONTEND_DIR}/en
${NG_BIN} build --aot --prod --outputPath=${TMP_DIR}/frontend/en

languages=($(find i18n/* -type d|cut -d"/" -f2))
ignores=()
if [[ -f "i18n/locale_not_for_build_local" ]]; then
# Add locales to ignore on local setting file.
ignores=($(cat i18n/locale_not_for_build_local))
fi
for language in "${languages[@]}"; do
if [[ " ${ignores[@]} " =~ " ${language} " ]]; then
say "Skip building locale: ${language}"
continue
fi

mkdir -p ${FRONTEND_DIR}/${language}

say "Building frontend for locale: ${language}"
${NG_BIN} build --aot \
--prod \
--i18nFile=${I18N_DIR}/${language}/messages.${language}.xlf \
--i18nFormat=xlf \
--i18nLocale=${language} --outputPath=${TMP_DIR}/frontend/${language}
done
say "\nBuilding localized frontend"
mkdir -p ${FRONTEND_DIR}
${NG_BIN} build \
--aot \
--prod \
--localize \
--outputPath=${FRONTEND_DIR}
}

function build::backend {
Expand Down
7 changes: 3 additions & 4 deletions aio/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "../src/app/frontend",
"module": "es6",
"target": "es5",
"types": ["node"]
},
"exclude": [
"../src/app/frontend/**/*.spec.ts"
],
"include": [
"../src/app/frontend/**/*"
],
"exclude": [
"../src/app/frontend/**/*.spec.ts"
],
"lib": ["es2017", "dom"]
}
2 changes: 0 additions & 2 deletions aio/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "../src/app/frontend",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"node"
]
},
"files": [
"../src/app/frontend/index.spec.ts",
"../src/app/frontend/polyfills.ts"
],
"include": [
Expand Down
51 changes: 50 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,53 @@
"root": "",
"sourceRoot": "src",
"projectType": "application",
"i18n": {
"sourceLocale": {
"code": "en",
"baseHref": "/"
},
"locales": {
"de": {
"translation": "i18n/de/messages.de.xlf",
"baseHref": "/"
},
"fr": {
"translation": "i18n/fr/messages.fr.xlf",
"baseHref": "/"
},
"ja": {
"translation": "i18n/ja/messages.ja.xlf",
"baseHref": "/"
},
"ko": {
"translation": "i18n/ko/messages.ko.xlf",
"baseHref": "/"
},
"zh": {
"translation": "i18n/zh/messages.zh.xlf",
"baseHref": "/"
},
"zh-Hans": {
"translation": "i18n/zh-Hans/messages.zh-Hans.xlf",
"baseHref": "/"
},
"zh-Hant": {
"translation": "i18n/zh-Hant/messages.zh-Hant.xlf",
"baseHref": "/"
}
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"aot": true,
"outputPath": ".tmp/frontend",
"index": "src/app/frontend/index.html",
"main": "src/app/frontend/index.ts",
"tsConfig": "src/app/frontend/../../../aio/tsconfig.app.json",
"polyfills": "src/app/frontend/polyfills.ts",
"i18nMissingTranslation": "error",
"assets": [
{
"glob": "**/*",
Expand All @@ -26,6 +64,11 @@
"glob": "robots.txt",
"input": "src/app/frontend/assets",
"output": "/"
},
{
"glob": "**/*",
"input": "node_modules/ace-builds/src-noconflict",
"output": "/ace"
}
],
"styles": [
Expand All @@ -45,6 +88,12 @@
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
Expand Down Expand Up @@ -116,7 +165,7 @@
"schematics": {
"@schematics/angular:component": {
"prefix": "kd",
"styleext": "scss"
"style": "scss"
},
"@schematics/angular:directive": {
"prefix": "kd"
Expand Down
2 changes: 1 addition & 1 deletion i18n/locale_conf.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"translations": [ "de", "en", "fr", "ja", "ko", "zh", "zh-cn", "zh-hk", "zh-sg", "zh-tw" ]}
{"translations": [ "de", "en", "fr", "ja", "ko", "zh", "zh-Hans", "zh-Hant-HK", "zh-Hans-SG", "zh-Hant" ]}
Loading

0 comments on commit 4cab78c

Please sign in to comment.