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

Commit fb9f125

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

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
8585

8686
var _exampleBoilerplateFiles = [
8787
'a2docs.css',
88+
'copy-aot.js',
8889
'package.json',
8990
'styles.css',
9091
'systemjs.config.js',

public/docs/_examples/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ wallaby.js
1111

1212
_test-output
1313
**/ts/**/*.js
14+
**/js/copy-aot.js
1415
**/js-es6*/**/*.js
1516
**/ts-snippets/**/*.js
1617
*.d.ts
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const copy = require('copy');
2+
const path = require('path');
3+
const output = "./aot/";
4+
const copyConfig = {
5+
"styles.css": "styles.css",
6+
"zone.min.js": "node_modules/zone.js/dist/zone.min.js",
7+
"shim.min.js": "node_modules/core-js/client/shim.min.js",
8+
};
9+
10+
filePromises = Object.keys(copyConfig).map((destFile) => {
11+
const srcPath = path.resolve(copyConfig[destFile]);
12+
const destPath = path.resolve(output);
13+
return new Promise((resolve, reject) => {
14+
copy([srcPath], destPath, { flatten: true }, (err, files) => {
15+
if ( err ) return reject(err);
16+
resolve(files);
17+
});
18+
});
19+
});
20+
21+
Promise.all(filePromises)
22+
.then((allFiles) => [].concat(...allFiles))
23+
.then(() => console.log("done copy static assets"), (err) => console.error(err));

public/docs/_examples/_boilerplate/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail",
2020
"build:cli": "ng build --no-progress",
2121
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup-config.js",
22+
"postbuild:aot": "node copy-aot.js",
2223
"build:babel": "babel app -d app --extensions \".es6\" --source-maps",
2324
"copy-dist-files": "node ./copy-dist-files.js",
2425
"i18n": "ng-xi18n"

public/docs/_examples/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
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.9.0",
29-
"apollo-client": "^0.5.8",
28+
"apollo-angular": "^0.9.0-rc.5",
29+
"apollo-client": "^0.7.1",
3030
"core-js": "^2.4.1",
3131
"graphql": "^0.8.2",
3232
"graphql-tag": "^1.1.2",
@@ -56,6 +56,7 @@
5656
"babel-preset-es2015": "^6.16.0",
5757
"canonical-path": "0.0.2",
5858
"concurrently": "^3.0.0",
59+
"copy": "^0.3.0",
5960
"css-loader": "^0.26.1",
6061
"extract-text-webpack-plugin": "2.0.0-beta.5",
6162
"file-loader": "^0.9.0",

0 commit comments

Comments
 (0)