Skip to content

Commit 76d679a

Browse files
authored
feat: angular 12 migration #335 (#341)
* feat: angular 12 migration #335
1 parent 683bee7 commit 76d679a

20 files changed

+31031
-178
lines changed

.browserslistrc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
# For additional information regarding the format and rule options, please see:
33
# https://github.com/browserslist/browserslist#queries
44

5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
58
# You can see what browsers were selected by your queries by running:
69
# npx browserslist
710

8-
> 0.5%
9-
last 2 versions
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
1016
Firefox ESR
11-
not dead
12-
not IE 9-11 # For IE 9-11 support, remove 'not'.
17+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

.editorconfig

Lines changed: 4 additions & 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
[*]
@@ -8,6 +8,9 @@ indent_size = 2
88
insert_final_newline = true
99
trim_trailing_whitespace = true
1010

11+
[*.ts]
12+
quote_type = single
13+
1114
[*.md]
1215
max_line_length = off
1316
trim_trailing_whitespace = false

.github/workflows/nodejs.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
node-version: [10.x, 12.x]
18+
node-version: [14.x]
1919

2020
steps:
2121
- uses: actions/checkout@v2
@@ -25,8 +25,6 @@ jobs:
2525
node-version: ${{ matrix.node-version }}
2626
- name: Install dependencies
2727
run: npm install
28-
- name: Lint
29-
run: npm run lint
3028
- name: Build
3129
run: |
3230
npm run build:lib

.github/workflows/npm-publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: Node.js Package
5+
6+
on:
7+
push:
8+
branches:
9+
- 'release/**'
10+
release:
11+
types: [created]
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-node@v2
19+
with:
20+
node-version: 14
21+
- run: npm install
22+
23+
publish-npm:
24+
needs: build
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
working-directory: ./src
29+
steps:
30+
- uses: actions/checkout@v2
31+
- uses: actions/setup-node@v2
32+
with:
33+
node-version: 14
34+
registry-url: https://registry.npmjs.org/
35+
scope: '@ngu'
36+
- run: npm install
37+
- run: npm run build
38+
- run: npm publish
39+
env:
40+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
41+

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
/dist
55
/tmp
66
/out-tsc
7+
# Only exists if Bazel was run
8+
/bazel-out
79

810
# dependencies
911
/node_modules
1012

13+
# profiling files
14+
chrome-profiler-events*.json
15+
1116
# IDEs and editors
1217
/.idea
1318
.project
@@ -23,6 +28,7 @@
2328
!.vscode/tasks.json
2429
!.vscode/launch.json
2530
!.vscode/extensions.json
31+
.history/*
2632

2733
# misc
2834
/.sass-cache
@@ -37,4 +43,3 @@ testem.log
3743
# System Files
3844
.DS_Store
3945
Thumbs.db
40-
package-lock.json

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Demo available [Here](https://ngu-carousel.netlify.app)
2222

2323
| Angular Version | ngu-carousel Version |
2424
| --------------- | ----------------------------------- |
25-
| Angular >= 10 | `npm i --save @ngu/carousel@latest` |
25+
| Angular >= 12 | `npm i --save @ngu/carousel@latest` |
26+
| Angular >= 10 | `npm i --save @ngu/[email protected]` |
2627
| Angular = 9 | `npm i --save @ngu/[email protected]` |
2728
| Angular < 9 | `npm i --save @ngu/[email protected]` |
2829

angular.json

Lines changed: 36 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"schematics": {
99
"@schematics/angular:component": {
1010
"style": "scss"
11+
},
12+
"@schematics/angular:application": {
13+
"strict": true
1114
}
1215
},
1316
"root": "",
@@ -22,7 +25,7 @@
2225
"main": "src/main.ts",
2326
"polyfills": "src/polyfills.ts",
2427
"tsConfig": "tsconfig.app.json",
25-
"aot": true,
28+
"inlineStyleLanguage": "scss",
2629
"assets": [
2730
"src/favicon.ico",
2831
"src/assets",
@@ -36,20 +39,6 @@
3639
},
3740
"configurations": {
3841
"production": {
39-
"fileReplacements": [
40-
{
41-
"replace": "src/environments/environment.ts",
42-
"with": "src/environments/environment.prod.ts"
43-
}
44-
],
45-
"optimization": true,
46-
"outputHashing": "all",
47-
"sourceMap": false,
48-
"extractCss": true,
49-
"namedChunks": false,
50-
"extractLicenses": true,
51-
"vendorChunk": false,
52-
"buildOptimizer": true,
5342
"budgets": [
5443
{
5544
"type": "initial",
@@ -61,20 +50,37 @@
6150
"maximumWarning": "6kb",
6251
"maximumError": "10kb"
6352
}
64-
]
53+
],
54+
"fileReplacements": [
55+
{
56+
"replace": "src/environments/environment.ts",
57+
"with": "src/environments/environment.prod.ts"
58+
}
59+
],
60+
"outputHashing": "all"
61+
},
62+
"development": {
63+
"buildOptimizer": false,
64+
"optimization": false,
65+
"vendorChunk": true,
66+
"extractLicenses": false,
67+
"sourceMap": true,
68+
"namedChunks": true
6569
}
66-
}
70+
},
71+
"defaultConfiguration": "production"
6772
},
6873
"serve": {
6974
"builder": "@angular-devkit/build-angular:dev-server",
70-
"options": {
71-
"browserTarget": "ngu-carousel-example:build"
72-
},
7375
"configurations": {
7476
"production": {
7577
"browserTarget": "ngu-carousel-example:build:production"
78+
},
79+
"development": {
80+
"browserTarget": "ngu-carousel-example:build:development"
7681
}
77-
}
82+
},
83+
"defaultConfiguration": "development"
7884
},
7985
"extract-i18n": {
8086
"builder": "@angular-devkit/build-angular:extract-i18n",
@@ -89,30 +95,17 @@
8995
"polyfills": "src/polyfills.ts",
9096
"tsConfig": "tsconfig.spec.json",
9197
"karmaConfig": "karma.conf.js",
98+
"inlineStyleLanguage": "scss",
9299
"assets": [
93100
"src/favicon.ico",
94101
"src/assets"
95102
],
96103
"styles": [
97-
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
98104
"src/styles.scss"
99105
],
100106
"scripts": []
101107
}
102108
},
103-
"lint": {
104-
"builder": "@angular-devkit/build-angular:tslint",
105-
"options": {
106-
"tsConfig": [
107-
"tsconfig.app.json",
108-
"tsconfig.spec.json",
109-
"e2e/tsconfig.json"
110-
],
111-
"exclude": [
112-
"**/node_modules/**"
113-
]
114-
}
115-
},
116109
"e2e": {
117110
"builder": "@angular-devkit/build-angular:protractor",
118111
"options": {
@@ -134,16 +127,19 @@
134127
"prefix": "ngu",
135128
"architect": {
136129
"build": {
137-
"builder": "@angular-devkit/build-ng-packagr:build",
130+
"builder": "@angular-devkit/build-angular:ng-packagr",
138131
"options": {
139-
"tsConfig": "projects/ngu-carousel/tsconfig.lib.json",
140132
"project": "projects/ngu-carousel/ng-package.json"
141133
},
142134
"configurations": {
143135
"production": {
144136
"tsConfig": "projects/ngu-carousel/tsconfig.lib.prod.json"
137+
},
138+
"development": {
139+
"tsConfig": "projects/ngu-carousel/tsconfig.lib.json"
145140
}
146-
}
141+
},
142+
"defaultConfiguration": "production"
147143
},
148144
"test": {
149145
"builder": "@angular-devkit/build-angular:karma",
@@ -152,24 +148,10 @@
152148
"tsConfig": "projects/ngu-carousel/tsconfig.spec.json",
153149
"karmaConfig": "projects/ngu-carousel/karma.conf.js"
154150
}
155-
},
156-
"lint": {
157-
"builder": "@angular-devkit/build-angular:tslint",
158-
"options": {
159-
"tsConfig": [
160-
"projects/ngu-carousel/tsconfig.lib.json",
161-
"projects/ngu-carousel/tsconfig.spec.json"
162-
],
163-
"exclude": [
164-
"**/node_modules/**"
165-
]
166-
}
167151
}
152+
168153
}
169154
}
170155
},
171-
"defaultProject": "ngu-carousel-example",
172-
"cli": {
173-
"analytics": false
174-
}
156+
"defaultProject": "ngu-carousel-example"
175157
}

karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = function (config) {
1515
client: {
1616
clearContext: false // leave Jasmine Spec Runner output visible in browser
1717
},
18-
coverageIstanbulReporter: {
18+
jcoverageIstanbulReporter: {
1919
dir: require('path').join(__dirname, './coverage/ngu-carousel-example'),
2020
reports: ['html', 'lcovonly', 'text-summary'],
2121
fixWebpackSourcePaths: true

0 commit comments

Comments
 (0)