Skip to content

Commit ce64a85

Browse files
fabiomartinoFabio Martino
andauthored
feat: upgrade to Angular 10 (#568)
* 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>
1 parent 4a4c435 commit ce64a85

18 files changed

Lines changed: 203 additions & 174 deletions

generators/app/templates/.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Editor configuration, see http://editorconfig.org
1+
# Editor configuration, see https://editorconfig.org
22
root = true
33

44
[*]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
17+
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.
18+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

generators/app/templates/__cordova._config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<!-- Android specific -->
3131
<platform name="android">
3232
<allow-intent href="market:*"/>
33-
<preference name="android-minSdkVersion" value="19"/>
33+
<preference name="android-minSdkVersion" value="22"/>
3434
<preference name="android-manifest/application/activity/@android:theme" value="@android:style/Theme.DeviceDefault"/>
3535
<!-- Copy files in the resources/android/extra folder to Android native resources -->
3636
<hook src="node_modules/@ngx-rocket/scripts/hooks/after_prepare/copy-android-resources.js" type="after_prepare"/>

generators/app/templates/__pwa._ngsw-config.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
23
"index": "/index.html",
34
"assetGroups": [
45
{
@@ -8,7 +9,7 @@
89
"files": [
910
"/favicon.ico",
1011
"/index.html",
11-
"/manifest.json",
12+
"/manifest.webmanifest",
1213
"/*.css",
1314
"/*.js"
1415
]
@@ -21,12 +22,9 @@
2122
"resources": {
2223
"files": [
2324
"/assets/**",
24-
"/*.woff",
25-
"/*.woff2",
26-
"/*.ttf",
27-
"/*.eot"
25+
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
2826
]
2927
}
3028
}
3129
]
32-
}
30+
}

generators/app/templates/_angular.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"src/robots.txt",
3131
<% } -%>
3232
<% if (props.pwa) { -%>
33-
"src/manifest.json",
33+
"src/manifest.webmanifest",
3434
<% } -%>
3535
<% if (props.ui === 'ionic') { -%>
3636
{
@@ -53,7 +53,6 @@
5353
"sourceMap": false,
5454
"extractCss": true,
5555
"namedChunks": false,
56-
"aot": true,
5756
"extractLicenses": true,
5857
"vendorChunk": false,
5958
"buildOptimizer": true,
@@ -65,7 +64,8 @@
6564
},
6665
{
6766
"type": "anyComponentStyle",
68-
"maximumWarning": "6kb"
67+
"maximumWarning": "6kb",
68+
"maximumError": "10kb"
6969
}
7070
],
7171
<% if (props.pwa) { -%>
@@ -138,7 +138,7 @@
138138
"src/robots.txt",
139139
<% } -%>
140140
<% if (props.pwa) { -%>
141-
"src/manifest.json",
141+
"src/manifest.webmanifest",
142142
<% } -%>
143143
<% if (props.ui === 'ionic') { -%>
144144
{

generators/app/templates/_package.json

Lines changed: 80 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -59,137 +59,139 @@
5959
"generate": "ng generate"
6060
},
6161
"dependencies": {
62-
"@angular/animations": "^9.1.9",
63-
"@angular/common": "^9.1.9",
64-
"@angular/compiler": "^9.1.9",
65-
"@angular/core": "^9.1.9",
66-
"@angular/forms": "^9.1.9",
67-
"@angular/platform-browser": "^9.1.9",
68-
"@angular/platform-browser-dynamic": "^9.1.9",
69-
"@angular/router": "^9.1.9",
70-
"@ngx-translate/core": "^12.0.0",
62+
"@angular/animations": "^10.0.14",
63+
"@angular/common": "^10.0.14",
64+
"@angular/compiler": "^10.0.14",
65+
"@angular/core": "^10.0.14",
66+
"@angular/forms": "^10.0.14",
67+
<% if (props.ui === 'bootstrap' || props.ui === 'material') { -%>
68+
"@angular/localize": "^10.0.14",
69+
<% } -%>
70+
"@angular/platform-browser": "^10.0.14",
71+
"@angular/platform-browser-dynamic": "^10.0.14",
72+
"@angular/router": "^10.0.14",
73+
"@ngx-translate/core": "^13.0.0",
7174
<% if (props.target.includes('cordova')) { -%>
72-
"@ionic-native/core": "^5.26.0",
73-
"@ionic-native/keyboard": "^5.26.0",
74-
"@ionic-native/splash-screen": "^5.26.0",
75-
"@ionic-native/status-bar": "^5.26.0",
76-
"cordova-android": "^8.0.0",
77-
"cordova-custom-config": "^5.0.2",
78-
"cordova-ios": "^5.0.0",
79-
"cordova-plugin-device": "^2.0.2",
80-
"cordova-plugin-ionic-webview": "^4.0.1",
81-
"cordova-plugin-ionic-keyboard": "^2.1.3",
82-
"cordova-plugin-splashscreen": "^5.0.2",
83-
"cordova-plugin-statusbar": "^2.4.1",
84-
"cordova-plugin-whitelist": "^1.3.3",
75+
"@ionic-native/core": "^5.28.0",
76+
"@ionic-native/keyboard": "^5.28.0",
77+
"@ionic-native/splash-screen": "^5.28.0",
78+
"@ionic-native/status-bar": "^5.28.0",
79+
"cordova-android": "^9.0.0",
80+
"cordova-custom-config": "^5.1.0",
81+
"cordova-ios": "^6.1.0",
82+
"cordova-plugin-device": "^2.0.3",
83+
"cordova-plugin-ionic-webview": "^5.0.0",
84+
"cordova-plugin-ionic-keyboard": "^2.2.0",
85+
"cordova-plugin-splashscreen": "^6.0.0",
86+
"cordova-plugin-statusbar": "^2.4.3",
87+
"cordova-plugin-whitelist": "^1.3.4",
8588
<% } -%>
8689
<% if (props.pwa) { -%>
87-
"@angular/service-worker": "^9.1.9",
90+
"@angular/service-worker": "^10.0.14",
8891
<% } -%>
8992
<% if (props.ui === 'ionic') { -%>
90-
"@ionic/angular": "^5.1.1",
93+
"@ionic/angular": "^5.3.2",
9194
<% } else if (props.ui === 'bootstrap') { -%>
92-
"@ng-bootstrap/ng-bootstrap": "^6.0.2",
93-
"bootstrap": "^4.1.1",
94-
"@fortawesome/fontawesome-free": "^5.1.0",
95-
"@angular/localize": "^9.1.0",
95+
"@ng-bootstrap/ng-bootstrap": "^7.0.0",
96+
"bootstrap": "^4.5.2",
97+
"@fortawesome/fontawesome-free": "^5.14.0",
9698
<% } else if (props.ui === 'material') { -%>
97-
"@angular/cdk": "^9.2.4",
98-
"@angular/material": "^9.2.4",
99-
"@angular/flex-layout": "^9.0.0-beta.31",
100-
"material-design-icons-iconfont": "^5.0.1",
99+
"@angular/cdk": "^10.1.3",
100+
"@angular/material": "^10.1.3",
101+
"@angular/flex-layout": "^10.0.0-beta.32",
102+
"material-design-icons-iconfont": "^6.0.1",
101103
<% } -%>
102104
<% if (props.angulartics) { -%>
103-
"angulartics2": "^8.3.0",
105+
"angulartics2": "^10.0.0",
104106
<% } -%>
105107
<% if (props.utility.includes('lodash')) { -%>
106-
"lodash": "^4.17.11",
108+
"lodash": "^4.17.20",
107109
<% } -%>
108110
<% if (props.utility.includes('ramda')) { -%>
109-
"ramda": "^0.27.0",
111+
"ramda": "^0.27.1",
110112
<% } -%>
111113
<% if (props.utility.includes('moment')) { -%>
112-
"moment": "^2.24.0",
114+
"moment": "^2.27.0",
113115
<% } -%>
114116
<% if (props.utility.includes('datefns')) { -%>
115-
"date-fns": "^2.9.0",
117+
"date-fns": "^2.16.0",
116118
<% } -%>
117-
"rxjs": "^6.5.5",
118-
"tslib": "^1.10.1",
119-
"zone.js": "^0.10.3"
119+
"rxjs": "^6.6.2",
120+
"tslib": "^2.0.1",
121+
"zone.js": "^0.11.1"
120122
},
121123
"devDependencies": {
122124
<% if (props.target.includes('cordova')) { -%>
123-
"cordova": "^9.0.0",
125+
"cordova": "^10.0.0",
124126
<% } -%>
125127
<% if (props.tools.includes('jest')) { -%>
126-
"@angular-builders/jest": "^8.3.2",
128+
"@angular-builders/jest": "^10.0.0",
127129
<% } -%>
128-
"@angular/cli": "~9.1.7",
129-
"@angular/compiler-cli": "^9.1.9",
130-
"@angular/language-service": "^9.1.9",
131-
"@angular-devkit/build-angular": "^0.901.7",
132-
"@angularclass/hmr": "^2.1.3",
130+
"@angular/cli": "~10.0.8",
131+
"@angular/compiler-cli": "^10.0.14",
132+
"@angular/language-service": "^10.0.14",
133+
"@angular-devkit/build-angular": "^0.1000.8",
134+
"@angularclass/hmr": "^3.0.0",
133135
"@biesbjerg/ngx-translate-extract": "^4.2.0",
134136
"@ngx-rocket/scripts": "^4.0.0",
135-
"@types/jasmine": "^3.3.13",
136-
"@types/jasminewd2": "^2.0.3",
137+
"@types/jasmine": "^3.5.14",
138+
"@types/jasminewd2": "^2.0.8",
137139
<% if (props.tools.includes('jest')) { -%>
138-
"@types/jest": "^25.1.2",
140+
"@types/jest": "^26.0.10",
139141
<% } -%>
140-
"@types/node": "^12.11.1",
142+
"@types/node": "^12.12.54",
141143
<% if (props.utility.includes('lodash')) { -%>
142-
"@types/lodash": "^4.14.112",
144+
"@types/lodash": "^4.14.161",
143145
<% } -%>
144146
<% if (props.utility.includes('ramda')) { -%>
145-
"@types/ramda": "^0.26.6",
147+
"@types/ramda": "^0.27.14",
146148
<% } -%>
147-
"codelyzer": "^5.1.2",
149+
"codelyzer": "^6.0.0",
148150
<% if (props.target.includes('electron')) { -%>
149-
"electron": "^8.0.0",
150-
"electron-packager": "^14.2.1",
151-
"electron-reload": "^1.4.0",
151+
"electron": "^10.1.0",
152+
"electron-packager": "^15.1.0",
153+
"electron-reload": "^1.5.0",
152154
<% } -%>
153155
<% if (props.tools.includes('hads')) { -%>
154-
"hads": "^2.0.1",
156+
"hads": "^2.1.0",
155157
<% } -%>
156158
<% if (props.tools.includes('compodoc')) { -%>
157-
"@compodoc/compodoc": "^1.1.9",
159+
"@compodoc/compodoc": "^1.1.11",
158160
<% } -%>
159-
"htmlhint": "^0.11.0",
161+
"htmlhint": "^0.14.1",
160162
"https-proxy-agent": "^5.0.0",
161-
"jasmine-core": "~3.5.0",
163+
"jasmine-core": "~3.6.0",
162164
"jasmine-spec-reporter": "~5.0.1",
163165
<% if (props.tools.includes('jest')) { -%>
164166
"jest": "^25.1.0",
165167
<% } else { -%>
166-
"karma": "~4.4.1",
167-
"karma-chrome-launcher": "^3.1.0",
168-
"karma-coverage-istanbul-reporter": "^2.0.2",
169-
"karma-jasmine": "^2.0.1",
170-
"karma-jasmine-html-reporter": "^1.5.3",
168+
"karma": "~5.1.1",
169+
"karma-chrome-launcher": "~3.1.0",
170+
"karma-coverage-istanbul-reporter": "~3.0.3",
171+
"karma-jasmine": "~4.0.1",
172+
"karma-jasmine-html-reporter": "^1.5.4",
171173
"karma-junit-reporter": "^2.0.1",
172174
<% } -%>
173175
<% if (props.tools.includes('prettier')) { -%>
174-
"prettier": "^2.0.2",
175-
"tslint-config-prettier": "^1.14.0",
176-
"stylelint-config-prettier": "^8.0.1",
176+
"prettier": "^2.1.1",
177+
"tslint-config-prettier": "^1.18.0",
178+
"stylelint-config-prettier": "^8.0.2",
177179
<% if (options.git) { -%>
178-
"pretty-quick": "^2.0.1",
179-
"husky": "^4.2.3",
180+
"pretty-quick": "^3.0.0",
181+
"husky": "^4.2.5",
180182
<% } -%>
181183
<% } -%>
182-
"protractor": "~5.4.3",
184+
"protractor": "~7.0.0",
183185
<% if (props.tools.includes('puppeteer')) { -%>
184-
"puppeteer": "^2.1.1",
186+
"puppeteer": "^5.2.1",
185187
<% } -%>
186-
"stylelint": "~13.2.1",
188+
"stylelint": "~13.6.1",
187189
"stylelint-config-recommended-scss": "~4.2.0",
188190
"stylelint-config-standard": "~20.0.0",
189-
"stylelint-scss": "~3.16.0",
190-
"ts-node": "^8.8.1",
191-
"tslint": "~5.20.1",
192-
"typescript": "~3.8.3"
191+
"stylelint-scss": "~3.18.0",
192+
"ts-node": "^9.0.0",
193+
"tslint": "~6.1.0",
194+
"typescript": "~3.9.5"
193195
<% if (props.tools.includes('prettier')) { -%>
194196
},
195197
"prettier": {

generators/app/templates/tsconfig.app.json renamed to generators/app/templates/_tsconfig.app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
12
{
2-
"extends": "./tsconfig.json",
3+
"extends": "./tsconfig.base.json",
34
"compilerOptions": {
45
"outDir": "./out-tsc/app",
56
"types": []
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"compileOnSave": false,
4+
"compilerOptions": {
5+
"outDir": "./dist/out-tsc",
6+
"sourceMap": true,
7+
"declaration": false,
8+
"module": "es2020",
9+
"moduleResolution": "node",
10+
"emitDecoratorMetadata": true,
11+
"experimentalDecorators": true,
12+
"importHelpers": true,
13+
<% if (props.strict) { -%>
14+
"strict": true,
15+
<% } else { -%>
16+
"noImplicitAny": true,
17+
<% } -%>
18+
"suppressImplicitAnyIndexErrors": true,
19+
<% if (props.target.includes('electron')) { -%>
20+
"target": "es5",
21+
<% } else { -%>
22+
"target": "es2015",
23+
<% } -%>
24+
"typeRoots": [
25+
"node_modules/@types"
26+
],
27+
"lib": [
28+
"es2018",
29+
"dom"
30+
],
31+
"baseUrl": "./",
32+
"paths": {
33+
"@app/*": ["src/app/*"],
34+
<% if (props.usePrefix) { -%>
35+
"@core": ["src/app/@core"],
36+
"@core/*": ["src/app/@core/*"],
37+
"@shared": ["src/app/@shared"],
38+
"@shared/*": ["src/app/@shared/*"],
39+
<% } -%>
40+
"@env/*": ["src/environments/*"]
41+
}
42+
},
43+
"angularCompilerOptions": {
44+
"fullTemplateTypeCheck": true,
45+
"strictInjectionParameters": true,
46+
"preserveWhitespaces": true
47+
}
48+
}
49+

0 commit comments

Comments
 (0)