Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(style): add SSR capabilities #962

Merged
merged 2 commits into from
Dec 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/apps/universal-app/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Editor configuration, see http://editorconfig.org
# Editor configuration, see https://editorconfig.org
root = true

[*]
Expand Down
43 changes: 43 additions & 0 deletions src/apps/universal-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
/node_modules

# profiling files
chrome-profiler-events.json
speed-measure-plugin.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db
4 changes: 2 additions & 2 deletions src/apps/universal-app/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# UniversalApp

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.6.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.1.2.

## Development server

Expand All @@ -12,7 +12,7 @@ Run `ng generate component component-name` to generate a new component. You can

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

## Running unit tests

Expand Down
71 changes: 44 additions & 27 deletions src/apps/universal-app/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/assets",
"src/favicon.ico"
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
Expand All @@ -27,6 +33,12 @@
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
Expand All @@ -36,10 +48,11 @@
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
"budgets": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
Expand All @@ -66,16 +79,16 @@
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/assets",
"src/favicon.ico"
"src/favicon.ico",
"src/assets"
]
}
},
Expand All @@ -97,28 +110,41 @@
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
}
}
},
"universal-app-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "universal-app:serve"
},
"configurations": {
"production": {
"devServerTarget": "universal-app:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
Expand All @@ -127,14 +153,5 @@
}
}
},
"defaultProject": "universal-app",
"schematics": {
"@schematics/angular:component": {
"prefix": "responsive",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "responsive"
}
}
}
"defaultProject": "universal-app"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
Expand All @@ -21,8 +21,8 @@ exports.config = {
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppPage } from './app.po';

describe('universal-app App', () => {
describe('workspace-project App', () => {
let page: AppPage;

beforeEach(() => {
Expand All @@ -9,6 +9,6 @@ describe('universal-app App', () => {

it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to responsive!');
expect(page.getTitleText()).toEqual('Welcome to universal-app!');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class AppPage {
return browser.get('/');
}

getParagraphText() {
return element(by.css('responsive-root h1')).getText();
getTitleText() {
return element(by.css('app-root h1')).getText();
}
}
5 changes: 2 additions & 3 deletions src/apps/universal-app/e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"baseUrl": "./",
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
Expand All @@ -11,4 +10,4 @@
"node"
]
}
}
}
47 changes: 24 additions & 23 deletions src/apps/universal-app/package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
{
"name": "universal-app",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"start:ssr": "npm run build:ssr && node dist/server.js",
"build": "ng build --prod",
"build:server": "webpack --config webpack.server.config.js --progress --colors",
"build:ssr": "npm run build:ssr:bundle && npm run build:server",
"build:ssr:bundle": "ng build --prod && ng run universal-app:server",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
"build:ssr:bundle": "ng build --prod && ng run universal-app:server:production"
},
"private": true,
"dependencies": {
"@angular/animations": "file:../../../node_modules/@angular/animations",
"@angular/cdk": "file:../../../node_modules/@angular/cdk",
"@angular/cli": "^7.0.0-rc.2",
"@angular/common": "file:../../../node_modules/@angular/common",
"@angular/compiler": "file:../../../node_modules/@angular/compiler",
"@angular/core": "file:../../../node_modules/@angular/core",
Expand All @@ -29,30 +27,33 @@
"@angular/platform-browser-dynamic": "file:../../../node_modules/@angular/platform-browser-dynamic",
"@angular/platform-server": "file:../../../node_modules/@angular/platform-server",
"@angular/router": "file:../../../node_modules/@angular/router",
"core-js": "file:../../../node_modules/core-js",
"@nguniversal/express-engine": "^7.0.2",
"core-js": "^2.5.4",
"express": "^4.16.2",
"rxjs": "file:../../../node_modules/rxjs",
"zone.js": "file:../../../node_modules/zone.js"
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.9.0-rc.1",
"@angular-devkit/build-angular": "~0.11.0",
"@angular/cli": "~7.1.2",
"@angular/compiler-cli": "file:../../../node_modules/@angular/compiler-cli",
"@angular/language-service": "^6.0.0",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"@angular/language-service": "~7.1.0",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"protractor": "~5.4.0",
"ts-loader": "^5.2.1",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "file:../../../node_modules/typescript",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2"
Expand Down
Loading