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

Commit d6bc1d1

Browse files
committed
docs(cookbook/graphql): Fix Rollup config
1 parent ef50a3c commit d6bc1d1

File tree

4 files changed

+48
-9
lines changed

4 files changed

+48
-9
lines changed

public/docs/_examples/heroes-graphql/ts/app/in-memory-graphql.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docregion
22
// #docregion import-lodash
3-
import { find } from 'lodash';
3+
import * as _ from 'lodash';
44
// #enddocregion import-lodash
55
// #docregion import-graphql-tools
66
import { makeExecutableSchema } from 'graphql-tools';
@@ -74,12 +74,12 @@ const resolveFunctions = {
7474
}
7575
},
7676
hero(obj: any, args: any, context: any) {
77-
return find(heroes, { id: args.heroId });
77+
return _.find(heroes, { id: args.heroId });
7878
}
7979
},
8080
Mutation: {
8181
updateHero(root: any, args: any) {
82-
let hero = find(heroes, { id: args.id });
82+
let hero = _.find(heroes, { id: args.id });
8383
if (!hero) {
8484
throw new Error(`Couldn't find post with id ${args.id}`);
8585
}
@@ -96,7 +96,7 @@ const resolveFunctions = {
9696
return newHero;
9797
},
9898
deleteHero(root: any, args: any) {
99-
let hero = find(heroes, { id: args.id });
99+
let hero = _.find(heroes, { id: args.id });
100100
if (!hero) {
101101
throw new Error(`Couldn't find post with id ${args.id}`);
102102
}

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

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import nodeResolve from 'rollup-plugin-node-resolve'
44
import commonjs from 'rollup-plugin-commonjs';
55
import uglify from 'rollup-plugin-uglify'
66

7+
import builtins from 'rollup-plugin-node-builtins';
8+
import globals from 'rollup-plugin-node-globals';
9+
710
//paths are relative to the execution path
811
export default {
912
entry: 'app/main-aot.js',
@@ -12,10 +15,28 @@ export default {
1215
sourceMapFile: 'aot/dist/build.js.map',
1316
format: 'iife',
1417
plugins: [
15-
nodeResolve({jsnext: true, module: true}),
18+
nodeResolve({jsnext: true, module: true, browser: true}),
1619
commonjs({
17-
include: ['node_modules/rxjs/**']
20+
include: [
21+
'node_modules/rxjs/**',
22+
'node_modules/apollo-client-rxjs/**',
23+
'node_modules/graphql-tag/**',
24+
'node_modules/apollo-client/**',
25+
'node_modules/lodash/**',
26+
'node_modules/graphql-tools/dist/**',
27+
'node_modules/graphql/**',
28+
'node_modules/graphql-anywhere/**',
29+
'node_modules/iterall/**',
30+
'node_modules/deprecated-decorator/**',
31+
'node_modules/uuid/**'
32+
],
33+
namedExports: {
34+
'node_modules/graphql-tools/dist/index.js': ['makeExecutableSchema' ],
35+
'node_modules/graphql/index.js': ['execute' ]
36+
}
1837
}),
38+
globals(),
39+
builtins(),
1940
uglify()
2041
]
2142
}

public/docs/_examples/heroes-graphql/ts/systemjs.config.extras.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ System.config({
1717

1818
'deprecated-decorator': 'npm:deprecated-decorator',
1919
'node-uuid': 'npm:node-uuid',
20+
'uuid': 'npm:uuid',
2021
'iterall': 'npm:iterall',
2122

2223
'lodash': 'npm:lodash',
@@ -84,12 +85,26 @@ System.config({
8485
'graphql-tools': {
8586
main: '/dist/index.js',
8687
defaultExtension: 'js',
87-
map: { uuid: '@empty' }
88+
//map: { uuid: '@empty' }
8889
},
89-
'graphql-anywhere': { main: '/lib/src/index.js', defaultExtension: 'js' },
90+
'graphql-anywhere': {
91+
//format: 'cjs',
92+
main: '/lib/src/index.js',
93+
defaultExtension: 'js',
94+
/*
95+
map: {
96+
'./getFromAST': './getFromAST',
97+
'./directives': './directives',
98+
'./storeUtils': './storeUtils',
99+
'./utilities': './utilities'
100+
}
101+
*/
102+
},
103+
90104

91105
'deprecated-decorator': { main: '/bld/index.js', defaultExtension: 'js' },
92106
'node-uuid': { main: './uuid.js', defaultExtension: 'js' },
107+
'uuid': { main: './lib/rng-browser.js', defaultExtension: 'js' },
93108
'iterall': { main: './index.js', defaultExtension: 'js' },
94109
'symbol-observable': { main: './index.js', defaultExtension: 'js' },
95110

public/docs/_examples/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"@angular/tsc-wrapped": "^0.5.0",
2626
"@angular/upgrade": "~2.4.0",
2727
"angular-in-memory-web-api": "~0.2.4",
28-
"apollo-angular": "^0.1.0",
28+
"apollo-angular": "^0.9.0",
2929
"apollo-client": "^0.5.8",
3030
"core-js": "^2.4.1",
3131
"graphql": "^0.8.2",
@@ -45,6 +45,7 @@
4545
"@types/angular-sanitize": "^1.3.3",
4646
"@types/chai": "^3.4.34",
4747
"@types/jasmine": "~2.5.36",
48+
"@types/lodash": "^4.14.43",
4849
"@types/node": "^6.0.45",
4950
"angular-cli": "^1.0.0-beta.26",
5051
"angular2-template-loader": "^0.6.0",
@@ -80,6 +81,8 @@
8081
"rimraf": "^2.5.4",
8182
"rollup": "^0.36.0",
8283
"rollup-plugin-commonjs": "^4.1.0",
84+
"rollup-plugin-node-builtins": "^2.0.0",
85+
"rollup-plugin-node-globals": "^1.1.0",
8386
"rollup-plugin-node-resolve": "^2.0.0",
8487
"rollup-plugin-uglify": "^1.0.1",
8588
"source-map-explorer": "^1.3.2",

0 commit comments

Comments
 (0)