Skip to content

Commit 59acc7c

Browse files
committed
project init
1 parent c0fde31 commit 59acc7c

8 files changed

+115
-0
lines changed

index.html

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset=UTF-8>
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>Angular 2 Hello World</title>
7+
<base href="/">
8+
</head>
9+
<body>
10+
<hello-world>
11+
加载中...
12+
</hello-world>
13+
<script src="bundle.js"></script>
14+
</body>
15+
</html>

package.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "HelloWorld",
3+
"version": "1.0.0",
4+
"description": "A simple starter Angular project",
5+
"scripts": {
6+
"server": "webpack-dev-server --inline --colors --progress --port 3000",
7+
"start": "npm run server"
8+
},
9+
"license": "MIT",
10+
"devDependencies": {
11+
"@types/core-js": "^0.9.34",
12+
"ts-loader": "^1.2.0",
13+
"typescript": "^2.0.0",
14+
"webpack": "^1.12.9",
15+
"webpack-dev-server": "^1.14.0"
16+
},
17+
"dependencies": {
18+
"@angular/common": "2.0.0",
19+
"@angular/compiler": "^2.0.0",
20+
"@angular/core": "2.0.0",
21+
"@angular/platform-browser": "2.0.0",
22+
"@angular/platform-browser-dynamic": "2.0.0",
23+
"core-js": "^2.4.1",
24+
"reflect-metadata": "^0.1.8",
25+
"rxjs": "5.0.0-beta.12",
26+
"zone.js": "^0.6.26"
27+
}
28+
}

src/app.component.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h3>
2+
Hello World!
3+
</h3>

src/app.component.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {Component} from '@angular/core';
2+
3+
@Component({
4+
selector: 'hello-world',
5+
templateUrl: 'src/app.component.html'
6+
})
7+
export class AppComponent {
8+
}

src/app.module.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import {NgModule} from '@angular/core'
2+
import {BrowserModule} from "@angular/platform-browser";
3+
4+
import {AppComponent} from "./app.component";
5+
6+
@NgModule({
7+
declarations: [AppComponent],
8+
imports: [BrowserModule],
9+
bootstrap: [AppComponent]
10+
})
11+
export class AppModule {
12+
}

src/main.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import 'reflect-metadata';
2+
import 'zone.js';
3+
4+
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
5+
import {AppModule} from './app.module';
6+
7+
8+
platformBrowserDynamic().bootstrapModule(AppModule)
9+
.catch(err => console.error(err));

tsconfig.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "commonjs",
5+
"moduleResolution": "node",
6+
"sourceMap": true,
7+
"emitDecoratorMetadata": true,
8+
"experimentalDecorators": true,
9+
"removeComments": false,
10+
"noImplicitAny": true,
11+
"suppressImplicitAnyIndexErrors": true,
12+
"typeRoots": [
13+
"./node_modules/@types/"
14+
]
15+
},
16+
"compileOnSave": true,
17+
"exclude": [
18+
"node_modules"
19+
]
20+
}

webpack.config.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var webpack = require('webpack');
2+
var path = require('path');
3+
module.exports = {
4+
entry: './src/main.ts',
5+
6+
output: {
7+
filename: './bundle.js'
8+
},
9+
10+
resolve: {
11+
root: [ path.join(__dirname, 'src') ],
12+
extensions: ['', '.ts', '.js']
13+
},
14+
15+
module: {
16+
loaders: [
17+
{ test: /\.ts$/, loader: 'ts-loader' }
18+
]
19+
}
20+
};

0 commit comments

Comments
 (0)