Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 59beccc

Browse files
committed
refactor: upgrade to Angular 5.0
1 parent 5b88ded commit 59beccc

15 files changed

+1129
-885
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
- 运行 `npm start` 构建并启动本地Server
77
- 浏览器打开 http://localhost:4200 即可访问
88

9-
> 服务端渲染版本请运行 `git checkout ssr` 切换至 `ssr` 分支
9+
> 服务端渲染版本请运行 `git checkout ssr` 切换至 `ssr` 分支

‎e2e/app.po.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { browser, element,by } from 'protractor';
1+
import { browser, by,element } from 'protractor';
22

33
export class AngularContactsDemoPage {
44
navigateTo() {

‎e2e/tsconfig.e2e.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/e2e",
5+
"baseUrl": "./",
56
"module": "commonjs",
67
"target": "es5",
7-
"types":[
8+
"types":[
89
"jasmine",
10+
"jasminewd2",
911
"node"
1012
]
1113
}

‎karma.conf.js‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Karma configuration file, see link for more information
2-
// https://karma-runner.github.io/0.13/config/configuration-file.html
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
33

44
module.exports = function (config) {
55
config.set({
@@ -15,25 +15,14 @@ module.exports = function (config) {
1515
client:{
1616
clearContext: false // leave Jasmine Spec Runner output visible in browser
1717
},
18-
files: [
19-
{ pattern: './src/test.ts', watched: false }
20-
],
21-
preprocessors: {
22-
'./src/test.ts': ['@angular/cli']
23-
},
24-
mime: {
25-
'text/x-typescript': ['ts','tsx']
26-
},
2718
coverageIstanbulReporter: {
2819
reports: [ 'html', 'lcovonly' ],
2920
fixWebpackSourcePaths: true
3021
},
3122
angularCli: {
3223
environment: 'dev'
3324
},
34-
reporters: config.angularCli && config.angularCli.codeCoverage
35-
? ['progress', 'coverage-istanbul']
36-
: ['progress', 'kjhtml'],
25+
reporters: ['progress', 'kjhtml'],
3726
port: 9876,
3827
colors: true,
3928
logLevel: config.LOG_INFO,

‎package.json‎

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,38 @@
1212
},
1313
"private": true,
1414
"dependencies": {
15-
"@angular/common": "4.3.1",
16-
"@angular/compiler": "4.3.1",
17-
"@angular/core": "4.3.1",
18-
"@angular/forms": "4.3.1",
19-
"@angular/http": "4.3.1",
20-
"@angular/platform-browser": "4.3.1",
21-
"@angular/platform-browser-dynamic": "4.3.1",
22-
"@angular/router": "4.3.1",
15+
"@angular/animations": "5.0.0",
16+
"@angular/common": "5.0.0",
17+
"@angular/compiler": "5.0.0",
18+
"@angular/core": "5.0.0",
19+
"@angular/forms": "5.0.0",
20+
"@angular/http": "5.0.0",
21+
"@angular/platform-browser": "5.0.0",
22+
"@angular/platform-browser-dynamic": "5.0.0",
23+
"@angular/router": "5.0.0",
2324
"core-js": "2.4.1",
24-
"rxjs": "5.1.0",
25-
"zone.js": "0.8.4"
25+
"rxjs": "5.5.2",
26+
"zone.js": "0.8.14"
2627
},
2728
"devDependencies": {
28-
"@angular/cli": "1.3.0",
29-
"@angular/compiler-cli": "4.3.1",
30-
"@types/jasmine": "2.5.38",
29+
"@angular/cli": "1.5.0",
30+
"@angular/compiler-cli": "5.0.0",
31+
"@angular/language-service": "5.0.0",
32+
"@types/jasmine": "~2.5.53",
33+
"@types/jasminewd2": "~2.0.2",
3134
"@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",
35+
"codelyzer": "~3.2.0",
36+
"jasmine-core": "~2.6.2",
37+
"jasmine-spec-reporter": "~4.1.0",
38+
"karma": "~1.7.0",
39+
"karma-chrome-launcher": "~2.1.1",
3740
"karma-cli": "~1.0.1",
38-
"karma-coverage-istanbul-reporter": "^0.2.0",
41+
"karma-coverage-istanbul-reporter": "1.2.1",
3942
"karma-jasmine": "~1.1.0",
40-
"karma-jasmine-html-reporter": "^0.2.2",
41-
"protractor": "~5.1.0",
42-
"ts-node": "~2.0.0",
43-
"tslint": "~4.5.0",
44-
"typescript": "~2.2.0"
43+
"karma-jasmine-html-reporter": "0.2.2",
44+
"protractor": "~5.1.2",
45+
"ts-node": "~3.2.0",
46+
"tslint": "~5.7.0",
47+
"typescript": "~2.4.2"
4548
}
4649
}

‎protractor.conf.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ exports.config = {
1919
defaultTimeoutInterval: 30000,
2020
print: function() {}
2121
},
22-
beforeLaunch: function() {
22+
onPrepare() {
2323
require('ts-node').register({
2424
project: 'e2e/tsconfig.e2e.json'
2525
});
26-
},
27-
onPrepare() {
2826
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
2927
}
3028
};

‎src/index.html‎

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
<!DOCTYPE html>
2-
<html>
3-
<head>
4-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5-
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
6-
<title>通讯录</title>
7-
<base href="/">
8-
<style>
9-
html,body{width: 100%;height: 100%;}
10-
*{padding: 0;margin: 0;box-sizing: border-box;
11-
font: 14px/1.5 'Microsoft Yahei','Helvetica Neue',Tahoma,'Simsun',Arial,Helvetica,STHeiti;
12-
}
13-
li{list-style-type:none;}
14-
</style>
15-
</head>
16-
<body>
17-
18-
<app-root>
19-
Loading...
20-
</app-root>
21-
22-
</body>
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
6+
<title>通讯录</title>
7+
<base href="/">
8+
<style>
9+
html,body{width: 100%;height: 100%;}
10+
*{padding: 0;margin: 0;box-sizing: border-box;
11+
font: 14px/1.5 'Microsoft Yahei','Helvetica Neue',Tahoma,'Simsun',Arial,Helvetica,STHeiti;
12+
}
13+
li{list-style-type:none;}
14+
</style>
15+
<link rel="icon" type="image/x-icon" href="favicon.ico">
16+
</head>
17+
<body>
18+
<app-root>加载中...</app-root>
19+
</body>
2320
</html>

‎src/main.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
2-
import {AppModule} from './app/app.module';
1+
import { enableProdMode } from '@angular/core';
2+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3+
4+
import { AppModule } from './app/app.module';
5+
import { environment } from './environments/environment';
6+
7+
if (environment.production) {
8+
enableProdMode();
9+
}
310

411
platformBrowserDynamic().bootstrapModule(AppModule)
5-
.catch(err => console.error(err));
12+
.catch(err => console.log(err));

‎src/polyfills.ts‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,25 @@ import 'core-js/es6/date';
3131
import 'core-js/es6/array';
3232
import 'core-js/es6/regexp';
3333
import 'core-js/es6/map';
34+
import 'core-js/es6/weak-map';
3435
import 'core-js/es6/set';
3536

3637
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
3738
// import 'classlist.js'; // Run `npm install --save classlist.js`.
3839

39-
/** IE10 and IE11 requires the following to support `@angular/animation`. */
40-
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
40+
/** IE10 and IE11 requires the following for the Reflect API. */
41+
// import 'core-js/es6/reflect';
4142

4243

4344
/** Evergreen browsers require these. **/
44-
import'core-js/es6/reflect';
45+
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
4546
import 'core-js/es7/reflect';
4647

4748

48-
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
49+
/**
50+
* Required to support Web Animations `@angular/platform-browser/animations`.
51+
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
52+
**/
4953
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
5054

5155

@@ -66,4 +70,7 @@ import 'zone.js/dist/zone'; // Included with Angular CLI.
6670
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
6771
*/
6872
// import 'intl'; // Run `npm install --save intl`.
69-
73+
/**
74+
* Need to import at least one locale-data with intl.
75+
*/
76+
// import 'intl/locale-data/jsonp/en';

‎src/test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import {
1313
} from '@angular/platform-browser-dynamic/testing';
1414

1515
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
16-
declare var __karma__: any;
17-
declare var require: any;
16+
declare const __karma__: any;
17+
declare const require: any;
1818

1919
// Prevent Karma from running prematurely.
2020
__karma__.loaded = function () {};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /