mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: add ci task for server-side prerender (#4808)
This adds a new task for Travis CI to prerender an app using @angular/material. This change starts off by only adding buttons to the application; more components will be added in a subsequent PR so that this one stays focused on the set-up.
This commit is contained in:
committed by
tinayuangao
parent
7db2762d78
commit
97d69fb3f8
@@ -41,6 +41,8 @@ elif is_closure_compiler; then
|
||||
./scripts/closure-compiler/build-devapp-bundle.sh
|
||||
elif is_unit; then
|
||||
$(npm bin)/gulp ci:test
|
||||
elif is_prerender; then
|
||||
./scripts/ci/prerender.sh
|
||||
fi
|
||||
|
||||
# Upload coverage results if those are present.
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/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
|
||||
@@ -24,3 +24,7 @@ is_payload() {
|
||||
is_unit() {
|
||||
[[ "$MODE" = saucelabs_required || "$MODE" = browserstack_required ]]
|
||||
}
|
||||
|
||||
is_prerender() {
|
||||
[[ "$MODE" = prerender ]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user