Skip to content

Commit 9d2d5e0

Browse files
committed
Update to v7
1 parent d5e26af commit 9d2d5e0

14 files changed

+2533
-2604
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
A working version of the application can be found at [https://alisaduncan.github.io/tutorial-angular-httpclient/](https://alisaduncan.github.io/tutorial-angular-httpclient/)
44

5+
I wrote a post about [Http interceptors and writing unit tests on The Practical Dev](https://dev.to/alisaduncan/intercepting-http-requests---using-and-testing-angulars-httpclient).
6+
57

68
This project was an opportunity for me to play with Angular, RxJS, and Material. The app calls [JSONPlaceholder](https://jsonplaceholder.typicode.com/) API to retrieve users and POST a new user. The code contains examples on utilizing Angular's HttpClient and corresponding unit tests. Unit tests for the view have been disabled for now.
79

8-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.
10+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.2.
911

1012
## Prerequisites
1113

@@ -17,6 +19,6 @@ Run `npm start` to start the application. It will automatically open a browser w
1719

1820
## Running Tests
1921

20-
Run `npm run tests` to run the unit tests in watch mode. Run `npm run tests -- --single-run` to run the test just once.
22+
Run `npm run tests` to run the unit tests in watch mode. Run `npm run tests -- --watch false` or `ng test --watch false` to run the test just once.
2123

2224
e2e tests are not supported yet.

angular.json

+31-21
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,39 @@
77
"root": "",
88
"sourceRoot": "src",
99
"projectType": "application",
10+
"prefix": "app",
11+
"schematics": {
12+
"@schematics/angular:component": {
13+
"styleext": "scss"
14+
}
15+
},
1016
"architect": {
1117
"build": {
1218
"builder": "@angular-devkit/build-angular:browser",
1319
"options": {
1420
"outputPath": "dist",
1521
"index": "src/index.html",
1622
"main": "src/main.ts",
17-
"tsConfig": "src/tsconfig.app.json",
1823
"polyfills": "src/polyfills.ts",
24+
"tsConfig": "src/tsconfig.app.json",
1925
"assets": [
2026
"src/assets",
2127
"src/favicon.ico"
2228
],
2329
"styles": [
30+
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
2431
"src/styles.scss"
2532
],
2633
"scripts": []
2734
},
2835
"configurations": {
2936
"production": {
37+
"fileReplacements": [
38+
{
39+
"replace": "src/environments/environment.ts",
40+
"with": "src/environments/environment.prod.ts"
41+
}
42+
],
3043
"optimization": true,
3144
"outputHashing": "all",
3245
"sourceMap": false,
@@ -36,10 +49,11 @@
3649
"extractLicenses": true,
3750
"vendorChunk": false,
3851
"buildOptimizer": true,
39-
"fileReplacements": [
52+
"budgets": [
4053
{
41-
"replace": "src/environments/environment.ts",
42-
"with": "src/environments/environment.prod.ts"
54+
"type": "initial",
55+
"maximumWarning": "2mb",
56+
"maximumError": "5mb"
4357
}
4458
]
4559
}
@@ -66,13 +80,14 @@
6680
"builder": "@angular-devkit/build-angular:karma",
6781
"options": {
6882
"main": "src/test.ts",
69-
"karmaConfig": "src/karma.conf.js",
7083
"polyfills": "src/polyfills.ts",
7184
"tsConfig": "src/tsconfig.spec.json",
72-
"scripts": [],
85+
"karmaConfig": "src/karma.conf.js",
7386
"styles": [
74-
"src/styles.css"
87+
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
88+
"src/styles.scss"
7589
],
90+
"scripts": [],
7691
"assets": [
7792
"src/assets",
7893
"src/favicon.ico"
@@ -96,20 +111,24 @@
96111
"tutorial-angular-httpclient-e2e": {
97112
"root": "e2e/",
98113
"projectType": "application",
114+
"prefix": "",
99115
"architect": {
100116
"e2e": {
101117
"builder": "@angular-devkit/build-angular:protractor",
102118
"options": {
103-
"protractorConfig": "./protractor.conf.js",
119+
"protractorConfig": "e2e/protractor.conf.js",
104120
"devServerTarget": "tutorial-angular-httpclient:serve"
121+
},
122+
"configurations": {
123+
"production": {
124+
"devServerTarget": "tutorial-angular-httpclient:serve:production"
125+
}
105126
}
106127
},
107128
"lint": {
108129
"builder": "@angular-devkit/build-angular:tslint",
109130
"options": {
110-
"tsConfig": [
111-
"e2e/tsconfig.e2e.json"
112-
],
131+
"tsConfig": "e2e/tsconfig.e2e.json",
113132
"exclude": [
114133
"**/node_modules/**"
115134
]
@@ -118,14 +137,5 @@
118137
}
119138
}
120139
},
121-
"defaultProject": "tutorial-angular-httpclient",
122-
"schematics": {
123-
"@schematics/angular:component": {
124-
"prefix": "app",
125-
"styleext": "scss"
126-
},
127-
"@schematics/angular:directive": {
128-
"prefix": "app"
129-
}
130-
}
140+
"defaultProject": "tutorial-angular-httpclient"
131141
}

e2e/tsconfig.e2e.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "../out-tsc/e2e",
5-
"baseUrl": "./",
4+
"outDir": "../out-tsc/app",
65
"module": "commonjs",
76
"target": "es5",
87
"types": [

0 commit comments

Comments
 (0)