docs(aio): Upgrade server-side rendering example to Angular V6 (#23649)

PR Close #23649
This commit is contained in:
Brandon Roberts
2018-05-02 07:13:32 -05:00
committed by Igor Minar
parent b45fa5e263
commit 2cf6244b1d
13 changed files with 2000 additions and 226 deletions

View File

@ -6,13 +6,11 @@
"@angular/animations",
"@angular/common",
"@angular/compiler",
"@angular/compiler-cli",
"@angular/core",
"@angular/forms",
"@angular/http",
"@angular/platform-browser",
"@angular/platform-browser-dynamic",
"@angular/platform-server",
"@angular/router",
"@angular/upgrade",
"angular-in-memory-web-api",
@ -21,6 +19,8 @@
"zone.js"
],
"devDependencies": [
"@angular/compiler-cli",
"@angular/platform-server",
"@types/jasmine",
"@types/node",
"jasmine-core",

View File

@ -7,19 +7,20 @@
{ "name": "e2e", "command": "ng e2e" },
{ "name": "build:ssr", "command": "npm run build:client-and-server-bundles && npm run webpack:server" },
{ "name": "serve:ssr", "command": "node dist/server.js" },
{ "name": "build:client-and-server-bundles", "command": "ng build --prod && ng build --prod --app 1 --output-hashing=false" },
{ "name": "build:client-and-server-bundles", "command": "ng build --prod && ng run angular.io-example:server" },
{ "name": "webpack:server", "command": "webpack --config webpack.server.config.js --progress --colors" }
],
"dependencies": [
"@nguniversal/express-engine",
"@nguniversal/module-map-ngfactory-loader",
"ts-loader"
"@nguniversal/module-map-ngfactory-loader"
],
"devDependencies": [
"@angular/cli",
"@types/jasminewd2",
"jasmine-spec-reporter",
"karma-coverage-istanbul-reporter",
"ts-node"
"ts-loader",
"ts-node",
"webpack-cli"
]
}

View File

@ -55,8 +55,8 @@ class ExampleZipper {
}
// rename a custom main.ts or index.html file
_renameFile(file) {
if (/src\/main[-.]\w+\.ts$/.test(file)) {
_renameFile(file, exampleType) {
if (/src\/main[-.]\w+\.ts$/.test(file) && exampleType !== 'universal') {
return 'src/main.ts';
}
@ -158,7 +158,7 @@ class ExampleZipper {
let zip = this._createZipArchive(outputFileName);
fileNames.forEach((fileName) => {
let relativePath = path.relative(exampleDirName, fileName);
relativePath = this._renameFile(relativePath);
relativePath = this._renameFile(relativePath, exampleType);
let content = fs.readFileSync(fileName, 'utf8');
let extn = path.extname(fileName).substr(1);
// if we don't need to clean up the file then we can do the following.