Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use UMD and ES6 modules and support tree-shaking #151

Merged
merged 6 commits into from
Nov 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .bithoundrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"ignore": [
"**/typings/**",
"**/node_modules/**"
]
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### vNEXT

- Support `es6` modules and `tree-shaking` ([PR #151](https://github.com/apollostack/angular2-apollo/pull/151))

### v0.8.0

- Made `mutate()` and `query()` methods to return `Observable` instead of `Promise` ([PR #140](https://github.com/apollostack/angular2-apollo/pull/140))
Expand Down
13 changes: 9 additions & 4 deletions examples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"start": "concurrently \"npm run server\" \"npm run client\"",
"client": "ng serve --proxy-conf proxy.conf.json",
"server": "nodemon api/index.js --watch api --exec babel-node",
"build": "./node_modules/.bin/ngc -p src/tsconfig.aot.json"
"build": "./node_modules/.bin/ngc -p src/tsconfig.aot.json",
"postbuild": "npm run tree-shaking",
"tree-shaking": "node_modules/.bin/rollup -c rollup.config.js"
},
"private": true,
"dependencies": {
Expand All @@ -23,17 +25,16 @@
"@angular/platform-server": "~2.1.2",
"@angular/router": "~3.1.2",
"angular2-apollo": "file:../../",
"apollo-client": "~0.5.0",
"apollo-client": "~0.5.1",
"core-js": "~2.4.0",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "~1.1.1",
"zone.js": "~0.6.26"
},
"devDependencies": {
"@types/es6-shim": "^0.31.32",
"@types/isomorphic-fetch": "0.0.30",
"@types/node": "^6.0.38",
"angular-cli": "1.0.0-beta.11-webpack.8",
"angular-cli": "1.0.0-beta.19-3",
"apollo-server": "^0.2.6",
"babel-cli": "^6.14.0",
"babel-core": "^6.14.0",
Expand All @@ -49,6 +50,10 @@
"graphql": "~0.7.0",
"graphql-tools": "~0.8.0",
"nodemon": "^1.10.2",
"rollup": "^0.36.3",
"rollup-plugin-commonjs": "^5.0.5",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-uglify": "^1.0.1",
"ts-node": "1.2.1",
"tslint": "~3.15.0",
"typescript": "~2.0.6"
Expand Down
23 changes: 23 additions & 0 deletions examples/hello-world/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import rollup from 'rollup';
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';

export default {
entry: 'dist/out-tsc/main.js',
dest: 'dist/build.js', // output a single application bundle
sourceMap: false,
format: 'iife',
plugins: [
nodeResolve({jsnext: true, module: true}),
commonjs({
include: [
'node_modules/rxjs/**',
'node_modules/apollo-client-rxjs/**',
'node_modules/graphql-tag/**',
'node_modules/apollo-client/**'
]
}),
uglify()
]
};
2 changes: 1 addition & 1 deletion examples/hello-world/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './polyfills.ts';
import './polyfills';

import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from './aot/app/app.module.ngfactory';
Expand Down
1 change: 1 addition & 0 deletions examples/hello-world/src/tsconfig.aot.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es5", "dom"],
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
Expand Down