Skip to content

Commit e259e48

Browse files
wthoJames Salas
authored and
James Salas
committed
Update Example App to angular v7, angular-redux v9 (#55)
* Update angular 6 -> 7, angular-cli 1 -> 7 * Improve example app typings and specs * Remove circular dependency concerns around ticket-actions * Workaround ng-packagr stack size limit issue by renaming files * Move mocky.io links to https
1 parent 9c8d034 commit e259e48

Some content is hidden

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

46 files changed

+3500
-3339
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
dist
22
coverage
3+
angular.json

jest/tests-setup.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import 'zone.js/dist/sync-test';
1111
// tslint:disable-next-line:ordered-imports
1212
import 'jest-zone-patch';
1313

14-
import { TestBed } from '@angular/core/testing';
14+
import { getTestBed } from '@angular/core/testing';
1515
import {
1616
BrowserDynamicTestingModule,
1717
platformBrowserDynamicTesting,
1818
} from '@angular/platform-browser-dynamic/testing';
1919
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
2020

21-
TestBed.initTestEnvironment(
21+
getTestBed().initTestEnvironment(
2222
[BrowserDynamicTestingModule, NoopAnimationsModule],
2323
platformBrowserDynamicTesting(),
2424
);

package.json

+17-17
Original file line numberDiff line numberDiff line change
@@ -34,40 +34,40 @@
3434
]
3535
},
3636
"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",
37+
"@angular/animations": "7.1.4",
38+
"@angular/common": "7.1.4",
39+
"@angular/compiler": "7.1.4",
40+
"@angular/compiler-cli": "7.1.4",
41+
"@angular/core": "7.1.4",
42+
"@angular/forms": "7.1.4",
43+
"@angular/platform-browser": "7.1.4",
44+
"@angular/platform-browser-dynamic": "7.1.4",
45+
"@angular/router": "7.1.4",
4646
"@commitlint/cli": "7.0.0",
4747
"@commitlint/config-conventional": "7.0.1",
4848
"@commitlint/prompt-cli": "7.0.0",
4949
"@types/jest": "23.1.6",
5050
"babel-core": "6.26.3",
5151
"babel-jest": "23.4.2",
52-
"codelyzer": "4.4.2",
52+
"codelyzer": "4.5.0",
5353
"husky": "1.1.3",
54-
"jest": "23.4.1",
55-
"jest-junit": "5.1.0",
56-
"jest-preset-angular": "6.0.0",
54+
"jest": "23.6.0",
55+
"jest-junit": "5.2.0",
56+
"jest-preset-angular": "6.0.2",
5757
"jest-zone-patch": "0.0.8",
5858
"lerna": "3.4.3",
5959
"lint-staged": "7.2.0",
60-
"ng-packagr": "3.0.6",
60+
"ng-packagr": "4.4.5",
6161
"npm-run-all": "4.1.3",
6262
"prettier": "1.13.7",
63-
"redux": "4.0.0",
63+
"redux": "4.0.1",
6464
"redux-logger": "2.10.2",
6565
"rimraf": "2.6.2",
66-
"rxjs": "6.2.1",
66+
"rxjs": "6.3.3",
6767
"tsickle": "0.32.1",
6868
"tslib": "1.9.3",
6969
"tslint": "5.11.0",
70-
"typescript": "2.7.2",
70+
"typescript": "3.1.6",
7171
"zone.js": "0.8.26"
7272
}
7373
}

packages/example-app/.angular-cli.json

-55
This file was deleted.

packages/example-app/angular.json

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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": "app",
11+
"schematics": {
12+
"@schematics/angular:component": {
13+
"styleext": "css"
14+
}
15+
},
16+
"architect": {
17+
"build": {
18+
"builder": "@angular-devkit/build-angular:browser",
19+
"options": {
20+
"outputPath": "dist/example-app",
21+
"index": "src/index.html",
22+
"main": "src/main.ts",
23+
"polyfills": "src/polyfills.ts",
24+
"tsConfig": "src/tsconfig.app.json",
25+
"assets": [
26+
"src/favicon.ico",
27+
"src/assets"
28+
],
29+
"styles": [
30+
"src/styles.css"
31+
],
32+
"scripts": []
33+
},
34+
"configurations": {
35+
"production": {
36+
"fileReplacements": [
37+
{
38+
"replace": "src/environments/environment.ts",
39+
"with": "src/environments/environment.prod.ts"
40+
}
41+
],
42+
"optimization": true,
43+
"outputHashing": "all",
44+
"sourceMap": false,
45+
"extractCss": true,
46+
"namedChunks": false,
47+
"aot": true,
48+
"extractLicenses": true,
49+
"vendorChunk": false,
50+
"buildOptimizer": true,
51+
"budgets": [
52+
{
53+
"type": "initial",
54+
"maximumWarning": "2mb",
55+
"maximumError": "5mb"
56+
}
57+
]
58+
}
59+
}
60+
},
61+
"serve": {
62+
"builder": "@angular-devkit/build-angular:dev-server",
63+
"options": {
64+
"browserTarget": "example-app:build"
65+
},
66+
"configurations": {
67+
"production": {
68+
"browserTarget": "example-app:build:production"
69+
}
70+
}
71+
},
72+
"extract-i18n": {
73+
"builder": "@angular-devkit/build-angular:extract-i18n",
74+
"options": {
75+
"browserTarget": "example-app:build"
76+
}
77+
},
78+
"test": {
79+
"builder": "@angular-builders/jest:run",
80+
"options": {
81+
"configPath": "../jest.config.js"
82+
},
83+
"configurations": {
84+
"ci": {
85+
"runInBand": true
86+
}
87+
}
88+
},
89+
"lint": {
90+
"builder": "@angular-devkit/build-angular:tslint",
91+
"options": {
92+
"tsConfig": [
93+
"src/tsconfig.app.json",
94+
"src/tsconfig.spec.json"
95+
],
96+
"exclude": [
97+
"**/node_modules/**"
98+
]
99+
}
100+
}
101+
}
102+
},
103+
"example-app-e2e": {
104+
"root": "e2e/",
105+
"projectType": "application",
106+
"prefix": "",
107+
"architect": {
108+
"e2e": {
109+
"builder": "@angular-devkit/build-angular:protractor",
110+
"options": {
111+
"protractorConfig": "e2e/protractor.conf.js",
112+
"devServerTarget": "example-app:serve"
113+
},
114+
"configurations": {
115+
"production": {
116+
"devServerTarget": "example-app:serve:production"
117+
}
118+
}
119+
},
120+
"lint": {
121+
"builder": "@angular-devkit/build-angular:tslint",
122+
"options": {
123+
"tsConfig": "e2e/tsconfig.e2e.json",
124+
"exclude": [
125+
"**/node_modules/**"
126+
]
127+
}
128+
}
129+
}
130+
}
131+
},
132+
"defaultProject": "example-app",
133+
"cli": {
134+
"packageManager": "yarn"
135+
}
136+
}

packages/example-app/jest.config.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
'use strict';
2+
3+
// Jest JUnit Reporter config
4+
process.env.JEST_JUNIT_OUTPUT = './coverage/junit.xml';
5+
6+
module.exports = {
7+
globals: {
8+
__TRANSFORM_HTML__: true,
9+
},
10+
transform: {
11+
'^.+\\.(ts|js|html)$':
12+
'<rootDir>/node_modules/jest-preset-angular/preprocessor.js',
13+
},
14+
testMatch: ['**/*.spec.{ts,js}'],
15+
moduleFileExtensions: ['ts', 'js', 'html', 'json'],
16+
setupTestFrameworkScriptFile: '<rootDir>/src/test.ts',
17+
snapshotSerializers: [
18+
'<rootDir>/node_modules/jest-preset-angular/AngularSnapshotSerializer.js',
19+
'<rootDir>/node_modules/jest-preset-angular/HTMLCommentSerializer.js',
20+
],
21+
moduleNameMapper: {
22+
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
23+
'<rootDir>/src/testing/file.mock.ts',
24+
},
25+
modulePathIgnorePatterns: ['dist'],
26+
reporters: ['default', 'jest-junit'],
27+
collectCoverageFrom: [
28+
'**/packages/**/*.{ts,js}',
29+
'!**/node_modules/**',
30+
'!**/dist/**',
31+
],
32+
coverageReporters: ['lcov', 'text-summary'],
33+
};

packages/example-app/package.json

+31-20
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"scripts": {
77
"ng": "ng",
88
"start": "ng serve",
9-
"build": "ng build"
9+
"build": "ng build",
10+
"test": "ng test",
11+
"test:watch": "node --inspect node_modules/jest/bin/jest.js --watch --no-cache",
12+
"test:ci": "ng test --runInBand"
1013
},
1114
"engines": {
1215
"node": ">=6.9.5"
@@ -15,30 +18,38 @@
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",
21+
"@angular/animations": "7.1.4",
22+
"@angular/common": "^7.1.4",
23+
"@angular/compiler": "^7.1.4",
24+
"@angular/core": "^7.1.4",
25+
"@angular/forms": "^7.1.4",
26+
"@angular/http": "^7.1.4",
27+
"@angular/platform-browser": "^7.1.4",
28+
"@angular/platform-browser-dynamic": "^7.1.4",
29+
"@angular/router": "^7.1.4",
2630
"core-js": "^2.4.1",
27-
"flux-standard-action": "^1.2.0",
28-
"ramda": "^0.23.0",
29-
"redux": "^3.6.0",
31+
"flux-standard-action": "^2.0.3",
32+
"ramda": "^0.26.0",
33+
"redux": "^4.0.1",
3034
"redux-logger": "^3.0.1",
31-
"redux-observable": "^0.14.1",
32-
"rxjs": "^5.3.0",
35+
"redux-observable": "^1.0.0",
36+
"rxjs": "^6.3.3",
3337
"zone.js": "^0.8.9"
3438
},
3539
"devDependencies": {
36-
"@angular/cli": "1.7.3",
37-
"@angular/compiler-cli": "^4.1.0",
38-
"@types/node": "~6.0.71",
40+
"@angular-builders/jest": "^7.1.1",
41+
"@angular-devkit/build-angular": "^0.10.6",
42+
"@angular/cli": "^7.0.6",
43+
"@angular/compiler-cli": "^7.1.0",
44+
"@types/jest": "^23.3.9",
45+
"@types/node": "^10.12.10",
46+
"@types/ramda": "^0.24.18",
3947
"@types/redux-logger": "^3.0.0",
40-
"protractor": "~5.1.1",
41-
"ts-node": "~3.0.2",
42-
"typescript": "^2.4.1"
48+
"jest": "^23.6.0",
49+
"jest-junit": "5.2.0",
50+
"jest-preset-angular": "6.0.2",
51+
"protractor": "^5.4.1",
52+
"ts-node": "^7.0.1",
53+
"typescript": ">=3.1.1 < 3.2"
4354
}
4455
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class MockAnimalComponent {
1111
@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';

0 commit comments

Comments
 (0)