Skip to content

Commit a82a29d

Browse files
feat(): update to the latest version of angular
1 parent 8f19dc9 commit a82a29d

31 files changed

+13184
-7299
lines changed

README.md

+16-29
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,35 @@
11
# Nest + Angular Universal Starter
22

3-
A minimal [**Nest**](https://github.com/nestjs/nest) and Angular starter for Universal using the
4-
[Angular CLI](https://github.com/angular/angular-cli). If you're looking for the Angular Universal repo go to
3+
A minimal [**Nest**](https://github.com/nestjs/nest) and Angular starter for Universal using the
4+
[Angular CLI](https://github.com/angular/angular-cli). If you're looking for the Angular Universal repo go to
55
[angular/universal](https://github.com/angular/universal).
66

77
## Getting Started
88

9-
This demo is built following the [Angular-CLI Wiki guide](https://github.com/angular/angular-cli/wiki/stories-universal-rendering)
9+
This demo is built following the [Angular-CLI Wiki guide](https://github.com/angular/angular-cli/wiki/stories-universal-rendering).
1010

11-
We're utilizing packages from the [Angular Universal @nguniversal](https://github.com/angular/universal) repo,
12-
such as [ng-module-map-ngfactory-loader](https://github.com/angular/universal/modules/module-map-ngfactory-loader)
13-
to enable Lazy Loading.
11+
### Installation
1412

15-
---
13+
- `npm i`
1614

17-
### Build Time Prerendering Vs. Server Side Rendering(ssr)
18-
This repo demonstrates the use of 2 different forms of Server Side Rendering.
15+
### Development (Client-side only rendering)
1916

20-
**Prerender**
21-
* Happens at build time
22-
* Renders your application and replaces the dist index.html with a version rendered at the route `/`.
17+
- `npm start` which will run `ng serve`.
2318

24-
**Server-Side Rendering(ssr)**
25-
* Happens at runtime
26-
* Uses `ngExpressEngine` to render your application on the fly at the requested url.
19+
### Development (Server-side rendering)
2720

28-
---
21+
- `npm run dev:ssr`.
2922

30-
### Installation
31-
* `npm i`
23+
### Production
3224

33-
### Development (Client-side only rendering)
34-
* `npm start` which will run `ng serve`.
25+
\*`npm run build:ssr && npm run serve:ssr`
26+
27+
- Compiles your application and spins up a Nest server to serve your Universal application on `http://localhost:4000`.
3528

36-
### Production (also for testing SSR/Pre-rendering locally)
37-
*`npm run build:ssr && npm run serve:ssr`
38-
- Compiles your application and spins up a Nest server to serve
39-
your Universal application on `http://localhost:4000`.
29+
\*`npm run prerender`
4030

41-
*`npm run build:prerender && npm run serve:prerender`
42-
- Compiles your application and prerenders your
43-
applications files, spinning up a demo http-server so you can view it on `http://localhost:8080`
44-
- **Note**: To deploy your static site to a static hosting platform you will have to deploy the `dist/browser`
45-
folder, rather than the usual `dist`
31+
- Compiles your application and prerenders your applications files
4632

4733
# License
34+
4835
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](/LICENSE)

angular.json

+60-15
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,26 @@
33
"version": 1,
44
"newProjectRoot": "projects",
55
"projects": {
6-
"nest-nguniversal-demo": {
6+
"universal-starter-v9": {
77
"projectType": "application",
8-
"schematics": {},
8+
"schematics": {
9+
"@schematics/angular:component": {
10+
"style": "scss"
11+
}
12+
},
913
"root": "",
1014
"sourceRoot": "src",
1115
"prefix": "app",
1216
"architect": {
1317
"build": {
1418
"builder": "@angular-devkit/build-angular:browser",
1519
"options": {
16-
"outputPath": "dist/browser",
20+
"outputPath": "dist/universal-starter-v9/browser",
1721
"index": "src/index.html",
1822
"main": "src/main.ts",
1923
"polyfills": "src/polyfills.ts",
2024
"tsConfig": "tsconfig.app.json",
21-
"aot": false,
25+
"aot": true,
2226
"assets": ["src/favicon.ico", "src/assets"],
2327
"styles": ["src/styles.css"],
2428
"scripts": []
@@ -36,7 +40,6 @@
3640
"sourceMap": false,
3741
"extractCss": true,
3842
"namedChunks": false,
39-
"aot": true,
4043
"extractLicenses": true,
4144
"vendorChunk": false,
4245
"buildOptimizer": true,
@@ -45,6 +48,11 @@
4548
"type": "initial",
4649
"maximumWarning": "2mb",
4750
"maximumError": "5mb"
51+
},
52+
{
53+
"type": "anyComponentStyle",
54+
"maximumWarning": "6kb",
55+
"maximumError": "10kb"
4856
}
4957
]
5058
}
@@ -53,18 +61,18 @@
5361
"serve": {
5462
"builder": "@angular-devkit/build-angular:dev-server",
5563
"options": {
56-
"browserTarget": "nest-nguniversal-demo:build"
64+
"browserTarget": "universal-starter-v9:build"
5765
},
5866
"configurations": {
5967
"production": {
60-
"browserTarget": "nest-nguniversal-demo:build:production"
68+
"browserTarget": "universal-starter-v9:build:production"
6169
}
6270
}
6371
},
6472
"extract-i18n": {
6573
"builder": "@angular-devkit/build-angular:extract-i18n",
6674
"options": {
67-
"browserTarget": "nest-nguniversal-demo:build"
75+
"browserTarget": "universal-starter-v9:build"
6876
}
6977
},
7078
"test": {
@@ -94,34 +102,71 @@
94102
"builder": "@angular-devkit/build-angular:protractor",
95103
"options": {
96104
"protractorConfig": "e2e/protractor.conf.js",
97-
"devServerTarget": "nest-nguniversal-demo:serve"
105+
"devServerTarget": "universal-starter-v9:serve"
98106
},
99107
"configurations": {
100108
"production": {
101-
"devServerTarget": "nest-nguniversal-demo:serve:production"
109+
"devServerTarget": "universal-starter-v9:serve:production"
102110
}
103111
}
104112
},
105113
"server": {
106114
"builder": "@angular-devkit/build-angular:server",
107115
"options": {
108-
"outputPath": "dist/server",
109-
"main": "src/main.server.ts",
110-
"tsConfig": "tsconfig.server.json"
116+
"outputPath": "dist/universal-starter-v9/server",
117+
"main": "server.ts",
118+
"tsConfig": "tsconfig.server.json",
119+
"externalDependencies": [
120+
"@nestjs/microservices",
121+
"@nestjs/microservices/microservices-module",
122+
"@nestjs/websockets",
123+
"@nestjs/websockets/socket-module",
124+
"cache-manager"
125+
]
111126
},
112127
"configurations": {
113128
"production": {
129+
"outputHashing": "media",
114130
"fileReplacements": [
115131
{
116132
"replace": "src/environments/environment.ts",
117133
"with": "src/environments/environment.prod.ts"
118134
}
119-
]
135+
],
136+
"sourceMap": false,
137+
"optimization": false
120138
}
121139
}
140+
},
141+
"serve-ssr": {
142+
"builder": "@nguniversal/builders:ssr-dev-server",
143+
"options": {
144+
"browserTarget": "universal-starter-v9:build",
145+
"serverTarget": "universal-starter-v9:server"
146+
},
147+
"configurations": {
148+
"production": {
149+
"browserTarget": "universal-starter-v9:build:production",
150+
"serverTarget": "universal-starter-v9:server:production"
151+
}
152+
}
153+
},
154+
"prerender": {
155+
"builder": "@nguniversal/builders:prerender",
156+
"options": {
157+
"browserTarget": "universal-starter-v9:build:production",
158+
"serverTarget": "universal-starter-v9:server:production",
159+
"routes": ["/"]
160+
},
161+
"configurations": {
162+
"production": {}
163+
}
122164
}
123165
}
124166
}
125167
},
126-
"defaultProject": "nest-nguniversal-demo"
168+
"defaultProject": "universal-starter-v9",
169+
"cli": {
170+
"analytics": false
171+
}
127172
}

karma.conf.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage-istanbul-reporter'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
clearContext: false // leave Jasmine Spec Runner output visible in browser
17+
},
18+
coverageIstanbulReporter: {
19+
dir: require('path').join(__dirname, './coverage/universal-starter-v9'),
20+
reports: ['html', 'lcovonly', 'text-summary'],
21+
fixWebpackSourcePaths: true
22+
},
23+
reporters: ['progress', 'kjhtml'],
24+
port: 9876,
25+
colors: true,
26+
logLevel: config.LOG_INFO,
27+
autoWatch: true,
28+
browsers: ['Chrome'],
29+
singleRun: false,
30+
restartOnFileChange: true
31+
});
32+
};

0 commit comments

Comments
 (0)