build: move server rendering to dist (#4822)

* build: move server rendering to dist

* Verifying that Material works with `platform-server` now happens in the `dist/` folder (instead of the src/ folder)
* Adds a gulp task to build the universal application. In the future serving the app will be also part of this

* Address comments
This commit is contained in:
Paul Gschwendtner
2017-05-30 18:22:18 +02:00
committed by mmalerba
parent 12d6e968c2
commit fb5520cebf
11 changed files with 106 additions and 59 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ elif is_closure_compiler; then
elif is_unit; then
$(npm bin)/gulp ci:test
elif is_prerender; then
./scripts/ci/prerender.sh
$(npm bin)/gulp ci:prerender
fi
# Upload coverage results if those are present.
-23
View File
@@ -1,23 +0,0 @@
#!/usr/bin/env bash
### Pre-renders the app under src/universal-app with platform-server and dumps the
### output to stdout.
# Go to the project root directory
cd $(dirname $0)/../..
# Build the @angular/material package and copy it into node_modules.
# This is a workaround for https://github.com/angular/angular/issues/12249
rm -rf ./node_modules/@angular/material
gulp material:build-release
cp -r ./dist/releases/material ./node_modules/@angular/
# Compile the kitchen sink app (the generated ngfactories are consumed by the prerender script)
$(npm bin)/ngc -p src/universal-app/tsconfig-ngc.json
# Run the prerender script.
# This does not use ts-node because some of the generated ngfactory.ts files are written into a
# directory called "node_modules"; ts-node intentionally will not treat any file inside of a
# "node_modules" directory as TypeScript (with the opinion that node_modules should only contain JS)
$(npm bin)/tsc -p src/universal-app/tsconfig-prerender.json
node ./src/universal-app/dist/prerender.js