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

Commit 6afe21c

Browse files
committed
docs(cookbook/graphql): add a post-rollup script to copy statis assets
1 parent c497e63 commit 6afe21c

38 files changed

+236
-187
lines changed

public/docs/_examples/heroes-graphql/ts/aot/bs-config.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

public/docs/_examples/heroes-graphql/ts/aot/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
<my-app>Loading...</my-app>
2020
</body>
2121
<script src="dist/build.js"></script>
22-
</html>
22+
</html>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/* #docregion , quickstart, toh */
2+
/* Master Styles */
3+
h1 {
4+
color: #369;
5+
font-family: Arial, Helvetica, sans-serif;
6+
font-size: 250%;
7+
}
8+
h2, h3 {
9+
color: #444;
10+
font-family: Arial, Helvetica, sans-serif;
11+
font-weight: lighter;
12+
}
13+
body {
14+
margin: 2em;
15+
}
16+
/* #enddocregion quickstart */
17+
body, input[text], button {
18+
color: #888;
19+
font-family: Cambria, Georgia;
20+
}
21+
/* #enddocregion toh */
22+
a {
23+
cursor: pointer;
24+
cursor: hand;
25+
}
26+
button {
27+
font-family: Arial;
28+
background-color: #eee;
29+
border: none;
30+
padding: 5px 10px;
31+
border-radius: 4px;
32+
cursor: pointer;
33+
cursor: hand;
34+
}
35+
button:hover {
36+
background-color: #cfd8dc;
37+
}
38+
button:disabled {
39+
background-color: #eee;
40+
color: #aaa;
41+
cursor: auto;
42+
}
43+
44+
/* Navigation link styles */
45+
nav a {
46+
padding: 5px 10px;
47+
text-decoration: none;
48+
margin-right: 10px;
49+
margin-top: 10px;
50+
display: inline-block;
51+
background-color: #eee;
52+
border-radius: 4px;
53+
}
54+
nav a:visited, a:link {
55+
color: #607D8B;
56+
}
57+
nav a:hover {
58+
color: #039be5;
59+
background-color: #CFD8DC;
60+
}
61+
nav a.active {
62+
color: #039be5;
63+
}
64+
65+
/* items class */
66+
.items {
67+
margin: 0 0 2em 0;
68+
list-style-type: none;
69+
padding: 0;
70+
width: 24em;
71+
}
72+
.items li {
73+
cursor: pointer;
74+
position: relative;
75+
left: 0;
76+
background-color: #EEE;
77+
margin: .5em;
78+
padding: .3em 0;
79+
height: 1.6em;
80+
border-radius: 4px;
81+
}
82+
.items li:hover {
83+
color: #607D8B;
84+
background-color: #DDD;
85+
left: .1em;
86+
}
87+
.items li.selected {
88+
background-color: #CFD8DC;
89+
color: white;
90+
}
91+
.items li.selected:hover {
92+
background-color: #BBD8DC;
93+
}
94+
.items .text {
95+
position: relative;
96+
top: -3px;
97+
}
98+
.items .badge {
99+
display: inline-block;
100+
font-size: small;
101+
color: white;
102+
padding: 0.8em 0.7em 0 0.7em;
103+
background-color: #607D8B;
104+
line-height: 1em;
105+
position: relative;
106+
left: -1px;
107+
top: -4px;
108+
height: 1.8em;
109+
margin-right: .8em;
110+
border-radius: 4px 0 0 4px;
111+
}
112+
/* #docregion toh */
113+
/* everywhere else */
114+
* {
115+
font-family: Arial, Helvetica, sans-serif;
116+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"open": false,
3+
"logLevel": "silent",
4+
"port": 8080,
5+
"server": {
6+
"baseDir": "aot",
7+
"routes": {
8+
"/node_modules": "node_modules"
9+
},
10+
"middleware": {
11+
"0": null
12+
}
13+
}
14+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"description": "Tour of Heroes: GraphQL",
3+
"basePath": "src/",
34
"files":[
45
"!**/*.d.ts",
56
"!**/*.js",
67
"!**/*.[1,2].*",
78
"systemjs.config.extras.js"
89
],
910
"tags": ["tutorial", "tour", "heroes", "http", "GraphQL"]
10-
}
11+
}

public/docs/_examples/heroes-graphql/ts/rollup-config.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,24 @@ import uglify from 'rollup-plugin-uglify'
66

77
import builtins from 'rollup-plugin-node-builtins';
88
import globals from 'rollup-plugin-node-globals';
9-
109
//paths are relative to the execution path
1110
export default {
12-
entry: 'app/main-aot.js',
11+
entry: 'src/main-aot.js',
1312
dest: 'aot/dist/build.js', // output a single application bundle
1413
sourceMap: true,
1514
sourceMapFile: 'aot/dist/build.js.map',
1615
format: 'iife',
16+
onwarn: function(warning) {
17+
// Skip certain warnings
18+
19+
// should intercept ... but doesn't in some rollup versions
20+
if ( warning.code === 'THIS_IS_UNDEFINED' ) { return; }
21+
// intercepts in some rollup versions
22+
if ( warning.indexOf("The 'this' keyword is equivalent to 'undefined'") > -1 ) { return; }
23+
24+
// console.warn everything else
25+
console.warn( warning.message );
26+
},
1727
plugins: [
1828
nodeResolve({jsnext: true, module: true, browser: true}),
1929
commonjs({
@@ -41,4 +51,4 @@ export default {
4151
builtins(),
4252
uglify()
4353
]
44-
}
54+
}

public/docs/_examples/heroes-graphql/ts/app/dashboard.component.ts renamed to public/docs/_examples/heroes-graphql/ts/src/app/dashboard.component.ts

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

44
// #docregion import-apollo
5-
import { Angular2Apollo } from 'apollo-angular';
5+
import { Apollo } from 'apollo-angular';
66
// #enddocregion import-apollo
77
// #docregion import-graphql-tag
88
import gql from 'graphql-tag';
@@ -22,7 +22,7 @@ export class DashboardComponent implements OnInit {
2222
heroes: Hero[];
2323
// #enddocregion this-heroes
2424
// #docregion inject-apollo
25-
constructor(private apollo: Angular2Apollo) { }
25+
constructor(private apollo: Apollo) { }
2626
// #enddocregion inject-apollo
2727

2828
// #docregion query-heroes

public/docs/_examples/heroes-graphql/ts/app/hero-detail.component.1.ts renamed to public/docs/_examples/heroes-graphql/ts/src/app/hero-detail.component.1.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core';
33
import { ActivatedRoute } from '@angular/router';
44
import { Location } from '@angular/common';
55

6-
import { Angular2Apollo, ApolloQueryObservable } from 'apollo-angular';
6+
import { Apollo, ApolloQueryObservable } from 'apollo-angular';
77
import { Subscription } from 'rxjs/Subscription';
88
import gql from 'graphql-tag';
99

@@ -24,7 +24,7 @@ export class HeroDetailComponent implements OnInit {
2424
constructor(
2525
private route: ActivatedRoute,
2626
private location: Location,
27-
private apollo: Angular2Apollo
27+
private apollo: Apollo
2828
) {}
2929

3030
ngOnInit(): void {
@@ -47,7 +47,7 @@ export class HeroDetailComponent implements OnInit {
4747
// #enddocregion graphql-query-new-field
4848

4949
this.heroSubscription = this.heroObservable.subscribe(({data}) => {
50-
this.hero = data.hero;
50+
this.hero = Object.assign({}, data.hero);
5151
});
5252
});
5353
}

public/docs/_examples/heroes-graphql/ts/app/hero-detail.component.ts renamed to public/docs/_examples/heroes-graphql/ts/src/app/hero-detail.component.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core';
33
import { ActivatedRoute } from '@angular/router';
44
import { Location } from '@angular/common';
55

6-
import { Angular2Apollo, ApolloQueryObservable } from 'apollo-angular';
6+
import { Apollo, ApolloQueryObservable } from 'apollo-angular';
77
import { Subscription } from 'rxjs/Subscription';
88
import gql from 'graphql-tag';
99

@@ -25,7 +25,7 @@ export class HeroDetailComponent implements OnInit {
2525
constructor(
2626
private route: ActivatedRoute,
2727
private location: Location,
28-
private apollo: Angular2Apollo
28+
private apollo: Apollo
2929
) {}
3030

3131
// #docregion service-fetch-by-id
@@ -47,7 +47,7 @@ export class HeroDetailComponent implements OnInit {
4747
});
4848

4949
this.heroSubscription = this.heroObservable.subscribe(({data}) => {
50-
this.hero = data.hero;
50+
this.hero = Object.assign({}, data.hero);
5151
});
5252
// #enddocregion graphql-query
5353
});
@@ -56,7 +56,6 @@ export class HeroDetailComponent implements OnInit {
5656

5757
// #docregion save
5858
save(): void {
59-
6059
this.apollo.mutate({
6160
mutation: gql`
6261
mutation updateHero($id: Int!, $name: String!) {

public/docs/_examples/heroes-graphql/ts/app/hero-search.component.ts renamed to public/docs/_examples/heroes-graphql/ts/src/app/hero-search.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import 'rxjs/add/operator/distinctUntilChanged';
1717

1818
import { Hero } from './hero';
1919

20-
import { Angular2Apollo, ApolloQueryObservable } from 'apollo-angular';
20+
import { Apollo, ApolloQueryObservable } from 'apollo-angular';
2121
import gql from 'graphql-tag';
2222

2323
@Component({
@@ -35,7 +35,7 @@ export class HeroSearchComponent implements OnInit {
3535
// #enddocregion searchTerms
3636

3737
constructor(
38-
private apollo: Angular2Apollo,
38+
private apollo: Apollo,
3939
private router: Router) {}
4040
// #docregion searchTerms
4141

public/docs/_examples/heroes-graphql/ts/app/hero.ts renamed to public/docs/_examples/heroes-graphql/ts/src/app/hero.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// #docregion
21
export class Hero {
32
id: number;
43
name: string;

public/docs/_examples/heroes-graphql/ts/app/heroes.component.1.ts renamed to public/docs/_examples/heroes-graphql/ts/src/app/heroes.component.1.ts

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

55
// #docregion import-apollo
6-
import { Angular2Apollo } from 'apollo-angular';
6+
import { Apollo } from 'apollo-angular';
77
// #enddocregion import-apollo
88
// #docregion import-graphql-tag
99
import gql from 'graphql-tag';
@@ -25,7 +25,7 @@ export class HeroesComponent implements OnInit {
2525

2626
// #docregion inject-apollo
2727
constructor(
28-
private apollo: Angular2Apollo,
28+
private apollo: Apollo,
2929
private router: Router) { }
3030
// #enddocregion inject-apollo
3131

public/docs/_examples/heroes-graphql/ts/app/heroes.component.ts renamed to public/docs/_examples/heroes-graphql/ts/src/app/heroes.component.ts

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

55
// #docregion import-apollo
6-
import { Angular2Apollo } from 'apollo-angular';
6+
import { Apollo } from 'apollo-angular';
77
// #enddocregion import-apollo
88
// #docregion import-graphql-tag
99
import gql from 'graphql-tag';
@@ -25,7 +25,7 @@ export class HeroesComponent implements OnInit {
2525

2626
// #docregion inject-apollo
2727
constructor(
28-
private apollo: Angular2Apollo,
28+
private apollo: Apollo,
2929
private router: Router) { }
3030
// #enddocregion inject-apollo
3131

public/docs/_examples/heroes-graphql/ts/index.html renamed to public/docs/_examples/heroes-graphql/ts/src/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,20 @@
88

99
<link rel="stylesheet" href="styles.css">
1010

11-
<!-- Polyfills for older browsers -->
11+
<!-- Polyfills -->
1212
<script src="node_modules/core-js/client/shim.min.js"></script>
1313

1414
<script src="node_modules/zone.js/dist/zone.js"></script>
1515
<script src="node_modules/systemjs/dist/system.src.js"></script>
1616

1717
<script src="systemjs.config.js"></script>
1818
<script src="systemjs.config.extras.js"></script>
19-
2019
<script>
21-
System.import('app').catch(function(err){ console.error(err); });
20+
System.import('main.js').catch(function(err){ console.error(err); });
2221
</script>
2322
</head>
2423

2524
<body>
2625
<my-app>Loading...</my-app>
2726
</body>
28-
</html>
27+
</html>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docregion
22
import { platformBrowser } from '@angular/platform-browser';
33

4-
import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory';
4+
import { AppModuleNgFactory } from '../aot/src/app/app.module.ngfactory';
55

66
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docregion
22
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
33

4-
import { AppModule } from './app.module';
4+
import { AppModule } from './app/app.module';
55

66
platformBrowserDynamic().bootstrapModule(AppModule);

0 commit comments

Comments
 (0)