Skip to content

Commit 803cd81

Browse files
author
James Salas
authored
Upgrade angular 7 packages and example app (#65)
- update all package dependencies - update versions of internal packages - update example-app to resemble angular-cli 7 app - get app and tests working
1 parent ea380e9 commit 803cd81

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4358
-3508
lines changed

.circleci/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
steps:
5757
- restore_cache: *repo_cache
5858
- restore_cache: *deps_cache
59+
- run: yarn install
5960
- run: yarn test:ci
6061
- store_test_results:
6162
path: ./coverage

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ lerna-debug.log
55
yarn-debug.log
66
yarn-error.log
77
.vscode
8+
.node-version

jest.config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ process.env.JEST_JUNIT_OUTPUT = './coverage/junit.xml';
55

66
module.exports = {
77
globals: {
8-
__TRANSFORM_HTML__: true,
8+
'ts-jest': {
9+
stringifyContentPathRegex: '\\.html$',
10+
},
911
},
1012
transform: {
1113
'^.+\\.(ts|js|html)$':

package.json

+18-14
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,45 @@
3333
"git add"
3434
]
3535
},
36+
"engines": {
37+
"node": ">=8"
38+
},
3639
"devDependencies": {
37-
"@angular/animations": "6.0.7",
38-
"@angular/common": "6.0.7",
39-
"@angular/compiler": "6.0.7",
40-
"@angular/compiler-cli": "6.0.7",
41-
"@angular/core": "6.0.7",
42-
"@angular/forms": "6.0.7",
43-
"@angular/platform-browser": "6.0.7",
44-
"@angular/platform-browser-dynamic": "6.0.7",
45-
"@angular/router": "6.0.7",
40+
"@angular/animations": "7.2.0",
41+
"@angular/cli": "7.2.1",
42+
"@angular/common": "7.2.0",
43+
"@angular/compiler": "7.2.0",
44+
"@angular/compiler-cli": "7.2.0",
45+
"@angular/core": "7.2.0",
46+
"@angular/forms": "7.2.0",
47+
"@angular/platform-browser": "7.2.0",
48+
"@angular/platform-browser-dynamic": "7.2.0",
49+
"@angular/router": "7.2.0",
4650
"@commitlint/cli": "7.0.0",
4751
"@commitlint/config-conventional": "7.0.1",
4852
"@commitlint/prompt-cli": "7.0.0",
4953
"@types/jest": "23.1.6",
5054
"babel-core": "6.26.3",
5155
"babel-jest": "23.4.2",
52-
"codelyzer": "4.4.2",
56+
"codelyzer": "4.5.0",
5357
"husky": "1.1.3",
5458
"jest": "23.4.1",
5559
"jest-junit": "5.1.0",
5660
"jest-preset-angular": "6.0.0",
5761
"jest-zone-patch": "0.0.8",
5862
"lerna": "3.4.3",
5963
"lint-staged": "7.2.0",
60-
"ng-packagr": "3.0.6",
64+
"ng-packagr": "4.5.0",
6165
"npm-run-all": "4.1.3",
6266
"prettier": "1.13.7",
6367
"redux": "4.0.0",
6468
"redux-logger": "2.10.2",
6569
"rimraf": "2.6.2",
66-
"rxjs": "6.2.1",
67-
"tsickle": "0.32.1",
70+
"rxjs": "6.3.3",
71+
"tsickle": "0.34.0",
6872
"tslib": "1.9.3",
6973
"tslint": "5.11.0",
70-
"typescript": "2.7.2",
74+
"typescript": "3.2.2",
7175
"zone.js": "0.8.26"
7276
}
7377
}

packages/example-app/angular.json

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"example-app": {
7+
"root": "",
8+
"sourceRoot": "src",
9+
"projectType": "application",
10+
"prefix": "zoo",
11+
"schematics": {},
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist/example-app",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": "src/polyfills.ts",
20+
"tsConfig": "src/tsconfig.app.json",
21+
"assets": ["src/favicon.ico", "src/assets"],
22+
"styles": ["src/styles.css"],
23+
"scripts": []
24+
},
25+
"configurations": {
26+
"production": {
27+
"fileReplacements": [
28+
{
29+
"replace": "src/environments/environment.ts",
30+
"with": "src/environments/environment.prod.ts"
31+
}
32+
],
33+
"optimization": true,
34+
"outputHashing": "all",
35+
"sourceMap": false,
36+
"extractCss": true,
37+
"namedChunks": false,
38+
"aot": true,
39+
"extractLicenses": true,
40+
"vendorChunk": false,
41+
"buildOptimizer": true,
42+
"budgets": [
43+
{
44+
"type": "initial",
45+
"maximumWarning": "2mb",
46+
"maximumError": "5mb"
47+
}
48+
]
49+
}
50+
}
51+
},
52+
"serve": {
53+
"builder": "@angular-devkit/build-angular:dev-server",
54+
"options": {
55+
"browserTarget": "example-app:build"
56+
},
57+
"configurations": {
58+
"production": {
59+
"browserTarget": "example-app:build:production"
60+
}
61+
}
62+
},
63+
"extract-i18n": {
64+
"builder": "@angular-devkit/build-angular:extract-i18n",
65+
"options": {
66+
"browserTarget": "example-app:build"
67+
}
68+
},
69+
"test": {
70+
"builder": "@angular-devkit/build-angular:karma",
71+
"options": {
72+
"main": "src/test.ts",
73+
"polyfills": "src/polyfills.ts",
74+
"tsConfig": "src/tsconfig.spec.json",
75+
"karmaConfig": "src/karma.conf.js",
76+
"styles": ["src/styles.css"],
77+
"scripts": [],
78+
"assets": ["src/favicon.ico", "src/assets"]
79+
}
80+
},
81+
"lint": {
82+
"builder": "@angular-devkit/build-angular:tslint",
83+
"options": {
84+
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
85+
"exclude": ["**/node_modules/**"]
86+
}
87+
}
88+
}
89+
},
90+
"example-app-e2e": {
91+
"root": "e2e/",
92+
"projectType": "application",
93+
"prefix": "",
94+
"architect": {
95+
"e2e": {
96+
"builder": "@angular-devkit/build-angular:protractor",
97+
"options": {
98+
"protractorConfig": "e2e/protractor.conf.js",
99+
"devServerTarget": "example-app:serve"
100+
},
101+
"configurations": {
102+
"production": {
103+
"devServerTarget": "example-app:serve:production"
104+
}
105+
}
106+
},
107+
"lint": {
108+
"builder": "@angular-devkit/build-angular:tslint",
109+
"options": {
110+
"tsConfig": "e2e/tsconfig.e2e.json",
111+
"exclude": ["**/node_modules/**"]
112+
}
113+
}
114+
}
115+
}
116+
},
117+
"defaultProject": "example-app"
118+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../out-tsc/app",
5+
"module": "commonjs",
6+
"target": "es5",
7+
"types": ["jasmine", "jasminewd2", "node"]
8+
}
9+
}

packages/example-app/package.json

+41-23
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,57 @@
66
"scripts": {
77
"ng": "ng",
88
"start": "ng serve",
9-
"build": "ng build"
9+
"build": "ng build",
10+
"test": "ng test",
11+
"lint": "ng lint",
12+
"e2e": "ng e2e"
1013
},
1114
"engines": {
12-
"node": ">=6.9.5"
15+
"node": ">=8"
1316
},
1417
"dependencies": {
1518
"@angular-redux/form": "latest",
1619
"@angular-redux/router": "latest",
1720
"@angular-redux/store": "latest",
18-
"@angular/common": "^4.1.0",
19-
"@angular/compiler": "^4.1.0",
20-
"@angular/core": "^4.1.0",
21-
"@angular/forms": "^4.1.0",
22-
"@angular/http": "^4.1.0",
23-
"@angular/platform-browser": "^4.1.0",
24-
"@angular/platform-browser-dynamic": "^4.1.0",
25-
"@angular/router": "^4.1.0",
26-
"core-js": "^2.4.1",
27-
"flux-standard-action": "^1.2.0",
21+
"@angular/common": "^7.2.0",
22+
"@angular/compiler": "^7.2.0",
23+
"@angular/core": "^7.2.0",
24+
"@angular/forms": "^7.2.0",
25+
"@angular/http": "^7.2.0",
26+
"@angular/platform-browser": "^7.2.0",
27+
"@angular/platform-browser-dynamic": "^7.2.0",
28+
"@angular/router": "^7.2.0",
29+
"core-js": "^2.6.2",
30+
"flux-standard-action": "^2.0.3",
2831
"ramda": "^0.23.0",
29-
"redux": "^3.6.0",
32+
"redux": "^4.0.1",
3033
"redux-logger": "^3.0.1",
31-
"redux-observable": "^0.14.1",
32-
"rxjs": "^5.3.0",
33-
"zone.js": "^0.8.9"
34+
"redux-observable": "^1.0.0",
35+
"rxjs": "^6.3.3",
36+
"tslib": "^1.9.3",
37+
"zone.js": "^0.8.27"
3438
},
3539
"devDependencies": {
36-
"@angular/cli": "1.7.3",
37-
"@angular/compiler-cli": "^4.1.0",
38-
"@types/node": "~6.0.71",
39-
"@types/redux-logger": "^3.0.0",
40-
"protractor": "~5.1.1",
41-
"ts-node": "~3.0.2",
42-
"typescript": "^2.4.1"
40+
"@angular-devkit/build-angular": "0.12.1",
41+
"@angular/cli": "^7.2.1",
42+
"@angular/compiler-cli": "^7.2.0",
43+
"@angular/language-service": "7.2.0",
44+
"@types/jasmine": "~2.8.8",
45+
"@types/jasminewd2": "~2.0.3",
46+
"@types/node": "10.12.18",
47+
"@types/ramda": "0.24.18",
48+
"@types/redux-logger": "3.0.6",
49+
"codelyzer": "~4.5.0",
50+
"jasmine-core": "~2.99.1",
51+
"jasmine-spec-reporter": "~4.2.1",
52+
"karma": "~3.1.1",
53+
"karma-chrome-launcher": "~2.2.0",
54+
"karma-coverage-istanbul-reporter": "~2.0.1",
55+
"karma-jasmine": "~1.1.2",
56+
"karma-jasmine-html-reporter": "^0.2.2",
57+
"protractor": "~5.4.0",
58+
"ts-node": "~7.0.0",
59+
"tslint": "~5.11.0",
60+
"typescript": "3.2.2"
4361
}
4462
}

packages/example-app/src/app/animals/animal-list/component.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import { AnimalListComponent } from './component';
77

88
@Component({ selector: 'zoo-animal', template: '' })
99
class MockAnimalComponent {
10-
@Input() key: string;
11-
@Input() animalType: AnimalType;
10+
@Input() key!: string;
11+
@Input() animalType!: AnimalType;
1212
}
1313

14-
xdescribe('AnimalListComponent', () => {
14+
describe('AnimalListComponent', () => {
1515
beforeEach(async(() => {
1616
TestBed.configureTestingModule({
1717
declarations: [AnimalListComponent, MockAnimalComponent],
@@ -21,7 +21,7 @@ xdescribe('AnimalListComponent', () => {
2121

2222
it("should have as title 'Welcome to the Zoo'", async(() => {
2323
const fixture = TestBed.createComponent(AnimalListComponent);
24-
const animalList = fixture.debugElement.componentInstance;
24+
const animalList = fixture.componentInstance;
2525

2626
animalList.animalsName = 'Wallabies';
2727
animalList.animalType = 'WALLABIES';
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
2-
import { Observable } from 'rxjs/Observable';
2+
import { Observable } from 'rxjs';
33
import { Animal } from '../model';
44

55
@Component({
@@ -9,16 +9,16 @@ import { Animal } from '../model';
99
changeDetection: ChangeDetectionStrategy.OnPush,
1010
})
1111
export class AnimalListComponent {
12-
@Input() animalsName: string;
13-
@Input() animalType: string;
14-
@Input() animals: Observable<Animal[]>;
15-
@Input() loading: Observable<boolean>;
16-
@Input() error: Observable<any>;
12+
@Input() animalsName!: string;
13+
@Input() animalType!: string;
14+
@Input() animals!: Observable<Animal[]>;
15+
@Input() loading!: Observable<boolean>;
16+
@Input() error!: Observable<any>;
1717

1818
// Since we're observing an array of items, we need to set up a 'trackBy'
1919
// parameter so Angular doesn't tear down and rebuild the list's DOM every
2020
// time there's an update.
21-
getKey(_, animal: Animal) {
21+
getKey(_: any, animal: Animal) {
2222
return animal.id;
2323
}
2424
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const ADD_TICKET = 'ADD_TICKET';
2+
export const REMOVE_TICKET = 'REMOVE_TICKET';
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<div>{{ name$ | async }}</div>
2-
<div>{{ ticketPrice$ | async }}</div>
1+
<div>{{ name | async }}</div>
2+
<div>{{ ticketPrice | async }}</div>
33
<div>
44
<zoo-counter
5-
[count]="numTickets$ | async"
5+
[count]="numTickets | async"
66
(increment)=addTicket()
77
(decrement)=removeTicket()>
88
</zoo-counter>
99
</div>
10-
<div>${{ subTotal$ | async }}
10+
<div>${{ subTotal | async }}

0 commit comments

Comments
 (0)