Skip to content

Commit bf05bb3

Browse files
committed
upgrade to Angular 4
1 parent 504ffc3 commit bf05bb3

File tree

10 files changed

+5402
-110
lines changed

10 files changed

+5402
-110
lines changed
Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
23
"project": {
3-
"version": "1.0.0-beta.19-3",
4-
"name": "client"
4+
"name": "complete-typescript-course"
55
},
66
"apps": [
77
{
@@ -13,47 +13,45 @@
1313
],
1414
"index": "index.html",
1515
"main": "main.ts",
16+
"polyfills": "polyfills.ts",
1617
"test": "test.ts",
17-
"tsconfig": "tsconfig.json",
18+
"tsconfig": "tsconfig.app.json",
19+
"testTsconfig": "tsconfig.spec.json",
1820
"prefix": "app",
19-
"mobile": false,
2021
"styles": [
2122
"styles.css"
2223
],
2324
"scripts": [],
25+
"environmentSource": "environments/environment.ts",
2426
"environments": {
25-
"source": "environments/environment.ts",
2627
"dev": "environments/environment.ts",
2728
"prod": "environments/environment.prod.ts"
2829
}
2930
}
3031
],
31-
"addons": [],
32-
"packages": [],
3332
"e2e": {
3433
"protractor": {
3534
"config": "./protractor.conf.js"
3635
}
3736
},
37+
"lint": [
38+
{
39+
"project": "src/tsconfig.app.json"
40+
},
41+
{
42+
"project": "src/tsconfig.spec.json"
43+
},
44+
{
45+
"project": "e2e/tsconfig.e2e.json"
46+
}
47+
],
3848
"test": {
3949
"karma": {
4050
"config": "./karma.conf.js"
4151
}
4252
},
4353
"defaults": {
4454
"styleExt": "css",
45-
"prefixInterfaces": false,
46-
"inline": {
47-
"style": false,
48-
"template": false
49-
},
50-
"spec": {
51-
"class": false,
52-
"component": true,
53-
"directive": true,
54-
"module": false,
55-
"pipe": true,
56-
"service": true
57-
}
55+
"component": {}
5856
}
5957
}

client/package.json

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
{
2-
"name": "client",
2+
"name": "ng4-cli",
33
"version": "0.0.0",
44
"license": "MIT",
5-
"angular-cli": {},
65
"scripts": {
6+
"ng": "ng",
77
"start": "ng serve",
8-
"lint": "tslint \"src/**/*.ts\"",
8+
"build": "ng build",
99
"test": "ng test",
10-
"pree2e": "webdriver-manager update",
11-
"e2e": "protractor"
10+
"lint": "ng lint",
11+
"e2e": "ng e2e"
1212
},
1313
"private": true,
1414
"dependencies": {
15-
"@angular/common": "~2.1.0",
16-
"@angular/compiler": "~2.1.0",
17-
"@angular/core": "~2.1.0",
18-
"@angular/forms": "~2.1.0",
19-
"@angular/http": "~2.1.0",
20-
"@angular/platform-browser": "~2.1.0",
21-
"@angular/platform-browser-dynamic": "~2.1.0",
22-
"@angular/router": "~3.1.0",
15+
"@angular/common": "^4.0.0",
16+
"@angular/compiler": "^4.0.0",
17+
"@angular/core": "^4.0.0",
18+
"@angular/forms": "^4.0.0",
19+
"@angular/http": "^4.0.0",
20+
"@angular/platform-browser": "^4.0.0",
21+
"@angular/platform-browser-dynamic": "^4.0.0",
22+
"@angular/router": "^4.0.0",
2323
"core-js": "^2.4.1",
24-
"rxjs": "5.0.0-beta.12",
25-
"ts-helpers": "^1.1.1",
26-
"zone.js": "^0.6.23"
24+
"rxjs": "^5.1.0",
25+
"zone.js": "^0.8.4"
2726
},
2827
"devDependencies": {
29-
"@types/jasmine": "^2.2.30",
30-
"@types/node": "^6.0.42",
31-
"angular-cli": "1.0.0-beta.19-3",
32-
"codelyzer": "1.0.0-beta.1",
33-
"jasmine-core": "2.4.1",
34-
"jasmine-spec-reporter": "2.5.0",
35-
"karma": "1.2.0",
36-
"karma-chrome-launcher": "^2.0.0",
37-
"karma-cli": "^1.0.1",
38-
"karma-jasmine": "^1.0.2",
39-
"karma-remap-istanbul": "^0.2.1",
40-
"protractor": "4.0.9",
41-
"ts-node": "1.2.1",
42-
"tslint": "3.13.0",
43-
"typescript": "~2.0.3",
44-
"webdriver-manager": "10.2.5"
28+
"@angular/cli": "1.0.0",
29+
"@angular/compiler-cli": "^4.0.0",
30+
"@types/jasmine": "2.5.38",
31+
"@types/node": "~6.0.60",
32+
"codelyzer": "~2.0.0",
33+
"jasmine-core": "~2.5.2",
34+
"jasmine-spec-reporter": "~3.2.0",
35+
"karma": "~1.4.1",
36+
"karma-chrome-launcher": "~2.0.0",
37+
"karma-cli": "~1.0.1",
38+
"karma-jasmine": "~1.1.0",
39+
"karma-jasmine-html-reporter": "^0.2.2",
40+
"karma-coverage-istanbul-reporter": "^0.2.0",
41+
"protractor": "~5.1.0",
42+
"ts-node": "~2.0.0",
43+
"tslint": "~4.5.0",
44+
"typescript": "~2.2.0"
4545
}
4646
}

client/src/polyfills.ts

Lines changed: 66 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,68 @@
1-
// This file includes polyfills needed by Angular 2 and is loaded before
2-
// the app. You can add your own extra polyfills to this file.
3-
import 'core-js/es6/symbol';
4-
import 'core-js/es6/object';
5-
import 'core-js/es6/function';
6-
import 'core-js/es6/parse-int';
7-
import 'core-js/es6/parse-float';
8-
import 'core-js/es6/number';
9-
import 'core-js/es6/math';
10-
import 'core-js/es6/string';
11-
import 'core-js/es6/date';
12-
import 'core-js/es6/array';
13-
import 'core-js/es6/regexp';
14-
import 'core-js/es6/map';
15-
import 'core-js/es6/set';
16-
import 'core-js/es6/reflect';
1+
/**
2+
* This file includes polyfills needed by Angular and is loaded before the app.
3+
* You can add your own extra polyfills to this file.
4+
*
5+
* This file is divided into 2 sections:
6+
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7+
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8+
* file.
9+
*
10+
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11+
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12+
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13+
*
14+
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15+
*/
16+
17+
/***************************************************************************************************
18+
* BROWSER POLYFILLS
19+
*/
20+
21+
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
22+
// import 'core-js/es6/symbol';
23+
// import 'core-js/es6/object';
24+
// import 'core-js/es6/function';
25+
// import 'core-js/es6/parse-int';
26+
// import 'core-js/es6/parse-float';
27+
// import 'core-js/es6/number';
28+
// import 'core-js/es6/math';
29+
// import 'core-js/es6/string';
30+
// import 'core-js/es6/date';
31+
// import 'core-js/es6/array';
32+
// import 'core-js/es6/regexp';
33+
// import 'core-js/es6/map';
34+
// import 'core-js/es6/set';
35+
36+
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
37+
// import 'classlist.js'; // Run `npm install --save classlist.js`.
1738

39+
/** IE10 and IE11 requires the following to support `@angular/animation`. */
40+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
41+
42+
43+
/** Evergreen browsers require these. **/
44+
import 'core-js/es6/reflect';
1845
import 'core-js/es7/reflect';
19-
import 'zone.js/dist/zone';
46+
47+
48+
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
49+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
50+
51+
52+
53+
/***************************************************************************************************
54+
* Zone JS is required by Angular itself.
55+
*/
56+
import 'zone.js/dist/zone'; // Included with Angular CLI.
57+
58+
59+
60+
/***************************************************************************************************
61+
* APPLICATION IMPORTS
62+
*/
63+
64+
/**
65+
* Date, currency, decimal and percent pipes.
66+
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
67+
*/
68+
// import 'intl'; // Run `npm install --save intl`.

client/src/test.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
import './polyfills.ts';
1+
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
22

33
import 'zone.js/dist/long-stack-trace-zone';
44
import 'zone.js/dist/proxy.js';
55
import 'zone.js/dist/sync-test';
66
import 'zone.js/dist/jasmine-patch';
77
import 'zone.js/dist/async-test';
88
import 'zone.js/dist/fake-async-test';
9+
import { getTestBed } from '@angular/core/testing';
10+
import {
11+
BrowserDynamicTestingModule,
12+
platformBrowserDynamicTesting
13+
} from '@angular/platform-browser-dynamic/testing';
914

1015
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
1116
declare var __karma__: any;
@@ -14,21 +19,14 @@ declare var require: any;
1419
// Prevent Karma from running prematurely.
1520
__karma__.loaded = function () {};
1621

17-
18-
Promise.all([
19-
System.import('@angular/core/testing'),
20-
System.import('@angular/platform-browser-dynamic/testing')
21-
])
22-
// First, initialize the Angular testing environment.
23-
.then(([testing, testingBrowser]) => {
24-
testing.getTestBed().initTestEnvironment(
25-
testingBrowser.BrowserDynamicTestingModule,
26-
testingBrowser.platformBrowserDynamicTesting()
27-
);
28-
})
29-
// Then we find all the tests.
30-
.then(() => require.context('./', true, /\.spec\.ts/))
31-
// And load the modules.
32-
.then(context => context.keys().map(context))
33-
// Finally, start Karma to run the tests.
34-
.then(__karma__.start, __karma__.error);
22+
// First, initialize the Angular testing environment.
23+
getTestBed().initTestEnvironment(
24+
BrowserDynamicTestingModule,
25+
platformBrowserDynamicTesting()
26+
);
27+
// Then we find all the tests.
28+
const context = require.context('./', true, /\.spec\.ts$/);
29+
// And load the modules.
30+
context.keys().map(context);
31+
// Finally, start Karma to run the tests.
32+
__karma__.start();

client/src/tsconfig.app.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../out-tsc/app",
5+
"module": "es2015",
6+
"baseUrl": "",
7+
"types": []
8+
},
9+
"exclude": [
10+
"test.ts",
11+
"**/*.spec.ts"
12+
]
13+
}

client/src/tsconfig.spec.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../out-tsc/spec",
5+
"module": "commonjs",
6+
"target": "es5",
7+
"baseUrl": "",
8+
"types": [
9+
"jasmine",
10+
"node"
11+
]
12+
},
13+
"files": [
14+
"test.ts"
15+
],
16+
"include": [
17+
"**/*.spec.ts",
18+
"**/*.d.ts"
19+
]
20+
}

client/src/typings.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Typings reference file, you can add your own global typings here
2-
// https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html
3-
4-
declare var System: any;
1+
/* SystemJS module definition */
2+
declare var module: NodeModule;
3+
interface NodeModule {
4+
id: string;
5+
}
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
{
2+
"compileOnSave": false,
23
"compilerOptions": {
4+
"outDir": "./dist/out-tsc",
5+
"baseUrl": "src",
6+
"sourceMap": true,
37
"declaration": false,
8+
"moduleResolution": "node",
49
"emitDecoratorMetadata": true,
510
"experimentalDecorators": true,
6-
"lib": ["es6", "dom"],
7-
"mapRoot": "./",
8-
"module": "es6",
9-
"moduleResolution": "node",
10-
"outDir": "../dist/out-tsc",
11-
"sourceMap": true,
1211
"target": "es5",
1312
"typeRoots": [
14-
"../node_modules/@types"
13+
"node_modules/@types"
14+
],
15+
"lib": [
16+
"es2016",
17+
"dom"
1518
]
1619
}
1720
}

0 commit comments

Comments
 (0)