Skip to content

Commit

Permalink
feat: upgrade to Angular 10 (#568)
Browse files Browse the repository at this point in the history
* Upgrade to Angular 10
* Remove CommonJs compile options workaround
* Migrate pwa file structures
* Correct compodoc version pwa reference in index.html
* More typo from Angular 10 migration
* Correct manifest.webmanifest into angular.json file
* Update @angularclass/hmr version
* Fix the CI for the mobile builds
* Restore condition for @angular/localize library now also include material UI

Co-authored-by: Fabio Martino <martino.fabio@libero.it>
  • Loading branch information
fabiomartino and Fabio Martino committed Sep 1, 2020
1 parent 4a4c435 commit ce64a85
Show file tree
Hide file tree
Showing 18 changed files with 203 additions and 174 deletions.
2 changes: 1 addition & 1 deletion generators/app/templates/.editorconfig
@@ -1,4 +1,4 @@
# Editor configuration, see http://editorconfig.org
# Editor configuration, see https://editorconfig.org
root = true

[*]
Expand Down
18 changes: 18 additions & 0 deletions generators/app/templates/_.browserslistrc
@@ -0,0 +1,18 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line.
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
2 changes: 1 addition & 1 deletion generators/app/templates/__cordova._config.xml
Expand Up @@ -30,7 +30,7 @@
<!-- Android specific -->
<platform name="android">
<allow-intent href="market:*"/>
<preference name="android-minSdkVersion" value="19"/>
<preference name="android-minSdkVersion" value="22"/>
<preference name="android-manifest/application/activity/@android:theme" value="@android:style/Theme.DeviceDefault"/>
<!-- Copy files in the resources/android/extra folder to Android native resources -->
<hook src="node_modules/@ngx-rocket/scripts/hooks/after_prepare/copy-android-resources.js" type="after_prepare"/>
Expand Down
10 changes: 4 additions & 6 deletions generators/app/templates/__pwa._ngsw-config.json
@@ -1,4 +1,5 @@
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [
{
Expand All @@ -8,7 +9,7 @@
"files": [
"/favicon.ico",
"/index.html",
"/manifest.json",
"/manifest.webmanifest",
"/*.css",
"/*.js"
]
Expand All @@ -21,12 +22,9 @@
"resources": {
"files": [
"/assets/**",
"/*.woff",
"/*.woff2",
"/*.ttf",
"/*.eot"
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
]
}
}
8 changes: 4 additions & 4 deletions generators/app/templates/_angular.json
Expand Up @@ -30,7 +30,7 @@
"src/robots.txt",
<% } -%>
<% if (props.pwa) { -%>
"src/manifest.json",
"src/manifest.webmanifest",
<% } -%>
<% if (props.ui === 'ionic') { -%>
{
Expand All @@ -53,7 +53,6 @@
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
Expand All @@ -65,7 +64,8 @@
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
"maximumWarning": "6kb",
"maximumError": "10kb"
}
],
<% if (props.pwa) { -%>
Expand Down Expand Up @@ -138,7 +138,7 @@
"src/robots.txt",
<% } -%>
<% if (props.pwa) { -%>
"src/manifest.json",
"src/manifest.webmanifest",
<% } -%>
<% if (props.ui === 'ionic') { -%>
{
Expand Down
158 changes: 80 additions & 78 deletions generators/app/templates/_package.json
Expand Up @@ -59,137 +59,139 @@
"generate": "ng generate"
},
"dependencies": {
"@angular/animations": "^9.1.9",
"@angular/common": "^9.1.9",
"@angular/compiler": "^9.1.9",
"@angular/core": "^9.1.9",
"@angular/forms": "^9.1.9",
"@angular/platform-browser": "^9.1.9",
"@angular/platform-browser-dynamic": "^9.1.9",
"@angular/router": "^9.1.9",
"@ngx-translate/core": "^12.0.0",
"@angular/animations": "^10.0.14",
"@angular/common": "^10.0.14",
"@angular/compiler": "^10.0.14",
"@angular/core": "^10.0.14",
"@angular/forms": "^10.0.14",
<% if (props.ui === 'bootstrap' || props.ui === 'material') { -%>
"@angular/localize": "^10.0.14",
<% } -%>
"@angular/platform-browser": "^10.0.14",
"@angular/platform-browser-dynamic": "^10.0.14",
"@angular/router": "^10.0.14",
"@ngx-translate/core": "^13.0.0",
<% if (props.target.includes('cordova')) { -%>
"@ionic-native/core": "^5.26.0",
"@ionic-native/keyboard": "^5.26.0",
"@ionic-native/splash-screen": "^5.26.0",
"@ionic-native/status-bar": "^5.26.0",
"cordova-android": "^8.0.0",
"cordova-custom-config": "^5.0.2",
"cordova-ios": "^5.0.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-webview": "^4.0.1",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.1",
"cordova-plugin-whitelist": "^1.3.3",
"@ionic-native/core": "^5.28.0",
"@ionic-native/keyboard": "^5.28.0",
"@ionic-native/splash-screen": "^5.28.0",
"@ionic-native/status-bar": "^5.28.0",
"cordova-android": "^9.0.0",
"cordova-custom-config": "^5.1.0",
"cordova-ios": "^6.1.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-splashscreen": "^6.0.0",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
<% } -%>
<% if (props.pwa) { -%>
"@angular/service-worker": "^9.1.9",
"@angular/service-worker": "^10.0.14",
<% } -%>
<% if (props.ui === 'ionic') { -%>
"@ionic/angular": "^5.1.1",
"@ionic/angular": "^5.3.2",
<% } else if (props.ui === 'bootstrap') { -%>
"@ng-bootstrap/ng-bootstrap": "^6.0.2",
"bootstrap": "^4.1.1",
"@fortawesome/fontawesome-free": "^5.1.0",
"@angular/localize": "^9.1.0",
"@ng-bootstrap/ng-bootstrap": "^7.0.0",
"bootstrap": "^4.5.2",
"@fortawesome/fontawesome-free": "^5.14.0",
<% } else if (props.ui === 'material') { -%>
"@angular/cdk": "^9.2.4",
"@angular/material": "^9.2.4",
"@angular/flex-layout": "^9.0.0-beta.31",
"material-design-icons-iconfont": "^5.0.1",
"@angular/cdk": "^10.1.3",
"@angular/material": "^10.1.3",
"@angular/flex-layout": "^10.0.0-beta.32",
"material-design-icons-iconfont": "^6.0.1",
<% } -%>
<% if (props.angulartics) { -%>
"angulartics2": "^8.3.0",
"angulartics2": "^10.0.0",
<% } -%>
<% if (props.utility.includes('lodash')) { -%>
"lodash": "^4.17.11",
"lodash": "^4.17.20",
<% } -%>
<% if (props.utility.includes('ramda')) { -%>
"ramda": "^0.27.0",
"ramda": "^0.27.1",
<% } -%>
<% if (props.utility.includes('moment')) { -%>
"moment": "^2.24.0",
"moment": "^2.27.0",
<% } -%>
<% if (props.utility.includes('datefns')) { -%>
"date-fns": "^2.9.0",
"date-fns": "^2.16.0",
<% } -%>
"rxjs": "^6.5.5",
"tslib": "^1.10.1",
"zone.js": "^0.10.3"
"rxjs": "^6.6.2",
"tslib": "^2.0.1",
"zone.js": "^0.11.1"
},
"devDependencies": {
<% if (props.target.includes('cordova')) { -%>
"cordova": "^9.0.0",
"cordova": "^10.0.0",
<% } -%>
<% if (props.tools.includes('jest')) { -%>
"@angular-builders/jest": "^8.3.2",
"@angular-builders/jest": "^10.0.0",
<% } -%>
"@angular/cli": "~9.1.7",
"@angular/compiler-cli": "^9.1.9",
"@angular/language-service": "^9.1.9",
"@angular-devkit/build-angular": "^0.901.7",
"@angularclass/hmr": "^2.1.3",
"@angular/cli": "~10.0.8",
"@angular/compiler-cli": "^10.0.14",
"@angular/language-service": "^10.0.14",
"@angular-devkit/build-angular": "^0.1000.8",
"@angularclass/hmr": "^3.0.0",
"@biesbjerg/ngx-translate-extract": "^4.2.0",
"@ngx-rocket/scripts": "^4.0.0",
"@types/jasmine": "^3.3.13",
"@types/jasminewd2": "^2.0.3",
"@types/jasmine": "^3.5.14",
"@types/jasminewd2": "^2.0.8",
<% if (props.tools.includes('jest')) { -%>
"@types/jest": "^25.1.2",
"@types/jest": "^26.0.10",
<% } -%>
"@types/node": "^12.11.1",
"@types/node": "^12.12.54",
<% if (props.utility.includes('lodash')) { -%>
"@types/lodash": "^4.14.112",
"@types/lodash": "^4.14.161",
<% } -%>
<% if (props.utility.includes('ramda')) { -%>
"@types/ramda": "^0.26.6",
"@types/ramda": "^0.27.14",
<% } -%>
"codelyzer": "^5.1.2",
"codelyzer": "^6.0.0",
<% if (props.target.includes('electron')) { -%>
"electron": "^8.0.0",
"electron-packager": "^14.2.1",
"electron-reload": "^1.4.0",
"electron": "^10.1.0",
"electron-packager": "^15.1.0",
"electron-reload": "^1.5.0",
<% } -%>
<% if (props.tools.includes('hads')) { -%>
"hads": "^2.0.1",
"hads": "^2.1.0",
<% } -%>
<% if (props.tools.includes('compodoc')) { -%>
"@compodoc/compodoc": "^1.1.9",
"@compodoc/compodoc": "^1.1.11",
<% } -%>
"htmlhint": "^0.11.0",
"htmlhint": "^0.14.1",
"https-proxy-agent": "^5.0.0",
"jasmine-core": "~3.5.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.1",
<% if (props.tools.includes('jest')) { -%>
"jest": "^25.1.0",
<% } else { -%>
"karma": "~4.4.1",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage-istanbul-reporter": "^2.0.2",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.5.3",
"karma": "~5.1.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.5.4",
"karma-junit-reporter": "^2.0.1",
<% } -%>
<% if (props.tools.includes('prettier')) { -%>
"prettier": "^2.0.2",
"tslint-config-prettier": "^1.14.0",
"stylelint-config-prettier": "^8.0.1",
"prettier": "^2.1.1",
"tslint-config-prettier": "^1.18.0",
"stylelint-config-prettier": "^8.0.2",
<% if (options.git) { -%>
"pretty-quick": "^2.0.1",
"husky": "^4.2.3",
"pretty-quick": "^3.0.0",
"husky": "^4.2.5",
<% } -%>
<% } -%>
"protractor": "~5.4.3",
"protractor": "~7.0.0",
<% if (props.tools.includes('puppeteer')) { -%>
"puppeteer": "^2.1.1",
"puppeteer": "^5.2.1",
<% } -%>
"stylelint": "~13.2.1",
"stylelint": "~13.6.1",
"stylelint-config-recommended-scss": "~4.2.0",
"stylelint-config-standard": "~20.0.0",
"stylelint-scss": "~3.16.0",
"ts-node": "^8.8.1",
"tslint": "~5.20.1",
"typescript": "~3.8.3"
"stylelint-scss": "~3.18.0",
"ts-node": "^9.0.0",
"tslint": "~6.1.0",
"typescript": "~3.9.5"
<% if (props.tools.includes('prettier')) { -%>
},
"prettier": {
Expand Down
@@ -1,5 +1,6 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
Expand Down
49 changes: 49 additions & 0 deletions generators/app/templates/_tsconfig.base.json
@@ -0,0 +1,49 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2020",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
<% if (props.strict) { -%>
"strict": true,
<% } else { -%>
"noImplicitAny": true,
<% } -%>
"suppressImplicitAnyIndexErrors": true,
<% if (props.target.includes('electron')) { -%>
"target": "es5",
<% } else { -%>
"target": "es2015",
<% } -%>
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"baseUrl": "./",
"paths": {
"@app/*": ["src/app/*"],
<% if (props.usePrefix) { -%>
"@core": ["src/app/@core"],
"@core/*": ["src/app/@core/*"],
"@shared": ["src/app/@shared"],
"@shared/*": ["src/app/@shared/*"],
<% } -%>
"@env/*": ["src/environments/*"]
}
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"preserveWhitespaces": true
}
}

0 comments on commit ce64a85

Please sign in to comment.