Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 9404fbc

Browse files
committed
docs(toh-6-aot): add aot to toh-6
s s
1 parent 9671d99 commit 9404fbc

File tree

11 files changed

+103
-4
lines changed

11 files changed

+103
-4
lines changed

public/docs/_examples/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
"test:webpack": "karma start karma.webpack.conf.js",
2121
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail",
2222
"build:cli": "ng build",
23-
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup.js"
23+
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup.js",
24+
"build:toh-aot": "ngc -p ../../toh-6/ts/tsconfig-aot.json && rollup -c ../../toh-6/ts/rollup.js",
25+
"build:toh-jit": "tsc -p tsconfig-jit.json"
2426
},
2527
"keywords": [],
2628
"author": "",

public/docs/_examples/toh-6-aot/ts/example-config.json

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<base href="/">
5+
<title>Angular Tour of Heroes</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
8+
<link rel="stylesheet" href="styles.css">
9+
10+
<script src="node_modules/core-js/client/shim.min.js"></script>
11+
12+
<script src="node_modules/zone.js/dist/zone.js"></script>
13+
14+
<script>
15+
window.module = 'aot';
16+
</script>
17+
</head>
18+
19+
<body>
20+
<my-app>Loading...</my-app>
21+
</body>
22+
<script src="dist/build.js"></script>
23+
</html>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
**/*.js
2+
aot
3+
**/*.ngfactory.ts
4+
!rollup.js

public/docs/_examples/toh-6/ts/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import { Component } from '@angular/core';
44

55
@Component({
6+
moduleId: module.id,
67
selector: 'my-app',
7-
88
template: `
99
<h1>{{title}}</h1>
1010
<nav>
@@ -13,7 +13,7 @@ import { Component } from '@angular/core';
1313
</nav>
1414
<router-outlet></router-outlet>
1515
`,
16-
styleUrls: ['app/app.component.css']
16+
styleUrls: ['app.component.css']
1717
})
1818
export class AppComponent {
1919
title = 'Tour of Heroes';

public/docs/_examples/toh-6/ts/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { HttpModule } from '@angular/http';
1212

1313
// #enddocregion v1
1414
// Imports for loading & configuring the in-memory web api
15-
import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
15+
import { InMemoryWebApiModule } from 'angular-in-memory-web-api/in-memory-web-api/in-memory-web-api.module';
1616
import { InMemoryDataService } from './in-memory-data.service';
1717

1818
// #docregion v1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// #docregion
2+
import { platformBrowser } from '@angular/platform-browser';
3+
4+
import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory';
5+
6+
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"build": "build:toh-jit",
3+
"run": "http-server:e2e"
4+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// #docregion
2+
import rollup from 'rollup'
3+
import nodeResolve from 'rollup-plugin-node-resolve'
4+
import commonjs from 'rollup-plugin-commonjs';
5+
import uglify from 'rollup-plugin-uglify'
6+
7+
export default {
8+
entry: '../../toh-6/ts/app/main-aot.js',
9+
dest: 'dist/build.js', // output a single application bundle
10+
sourceMap: true,
11+
sourceMapFile: 'dist/build.js.map',
12+
format: 'iife',
13+
plugins: [
14+
nodeResolve({jsnext: true, module: true}),
15+
commonjs({
16+
include: ['../../toh-6/ts/node_modules/rxjs/**', '../../toh-6/ts/node_modules/angular-in-memory-web-api/**'],
17+
}),
18+
uglify()
19+
]
20+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "es2015",
5+
"moduleResolution": "node",
6+
"sourceMap": true,
7+
"emitDecoratorMetadata": true,
8+
"experimentalDecorators": true,
9+
"removeComments": false,
10+
"noImplicitAny": true,
11+
"suppressImplicitAnyIndexErrors": true
12+
},
13+
14+
"files": [
15+
"app/app.module.ts",
16+
"app/main-aot.ts",
17+
"typings/index.d.ts"
18+
],
19+
20+
"angularCompilerOptions": {
21+
"genDir": "aot",
22+
"skipMetadataEmit" : true
23+
}
24+
}

0 commit comments

Comments
 (0)