Skip to content

Commit

Permalink
Initial pass at implementing @angular/platform-server
Browse files Browse the repository at this point in the history
  • Loading branch information
intellix committed Mar 25, 2017
1 parent 9a3b67e commit c2ea1eb
Show file tree
Hide file tree
Showing 9 changed files with 5,373 additions and 6 deletions.
27 changes: 26 additions & 1 deletion .angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,32 @@
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"main": "main.browser.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
},
{
"name": "server",
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.server.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"angulardoc.repoId": "48f7bd6f-686f-4e08-80e0-5c4982da611d",
"angulardoc.lastSync": 0
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/platform-server": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
Expand All @@ -35,9 +37,9 @@
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
Expand Down
6 changes: 4 additions & 2 deletions src/app/app.module.ts → src/app/app.browser.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import { AppComponent } from './app.component';
AppComponent
],
imports: [
BrowserModule,
BrowserModule.withServerTransition({
appId: 'app-root-server',
}),
FormsModule,
HttpModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
export class AppBrowserModule { }
17 changes: 17 additions & 0 deletions src/app/app.server.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ServerModule } from '@angular/platform-server';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './app.component';
import { AppBrowserModule } from './app.browser.module';

@NgModule({
imports: [
ServerModule,
AppBrowserModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppServerModule { }
4 changes: 2 additions & 2 deletions src/main.ts → src/main.browser.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { AppBrowserModule } from './app/app.browser.module';
import { environment } from './environments/environment';

if (environment.production) {
enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule);
platformBrowserDynamic().bootstrapModule(AppBrowserModule);
11 changes: 11 additions & 0 deletions src/main.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { platformDynamicServer } from '@angular/platform-server';
import { enableProdMode } from '@angular/core';

import { AppServerModule } from './app/app.server.module';
import { environment } from './environments/environment';

if (environment.production) {
enableProdMode();
}

platformDynamicServer().bootstrapModule(AppServerModule);
82 changes: 82 additions & 0 deletions yarn-error.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Arguments:
/Users/dominicwatson/.nvm/versions/node/v7.1.0/bin/node /Users/dominicwatson/.nvm/versions/node/v7.1.0/bin/yarn add @angular/server

PATH:
/Users/dominicwatson/.nvm/versions/node/v7.1.0/bin:/Users/dominicwatson/Downloads/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/local/opt/ruby/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/go/bin

Yarn version:
0.20.0

Node version:
7.1.0

Platform:
darwin x64

npm manifest:
{
"name": "angular-cli-server",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}

yarn manifest:
No manifest

Lockfile:
No lockfile

Trace:
Error: https://registry.yarnpkg.com/@angular%2fserver: Not found
at Request.params.callback [as _callback] (/Users/dominicwatson/.nvm/versions/node/v7.1.0/lib/node_modules/yarn/lib/util/request-manager.js:313:18)
at Request.self.callback (/Users/dominicwatson/.nvm/versions/node/v7.1.0/lib/node_modules/yarn/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/Users/dominicwatson/.nvm/versions/node/v7.1.0/lib/node_modules/yarn/node_modules/request/request.js:1081:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/Users/dominicwatson/.nvm/versions/node/v7.1.0/lib/node_modules/yarn/node_modules/request/request.js:1001:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)

0 comments on commit c2ea1eb

Please sign in to comment.