* angular updated from 5.2 to 8.0
This commit is contained in:
parent
0e9f2a448a
commit
0d0ed38966
@ -1,87 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
||||||
"project": {
|
|
||||||
"name": "frontend"
|
|
||||||
},
|
|
||||||
"apps": [
|
|
||||||
{
|
|
||||||
"root": "src",
|
|
||||||
"outDir": "dist/browser",
|
|
||||||
"assets": [
|
|
||||||
"assets",
|
|
||||||
"favicon.ico"
|
|
||||||
],
|
|
||||||
"index": "index.html",
|
|
||||||
"main": "main.ts",
|
|
||||||
"polyfills": "polyfills.ts",
|
|
||||||
"test": "test.ts",
|
|
||||||
"tsconfig": "tsconfig.app.json",
|
|
||||||
"testTsconfig": "tsconfig.spec.json",
|
|
||||||
"prefix": "app",
|
|
||||||
"styles": [
|
|
||||||
"../node_modules/normalize.css/normalize.css",
|
|
||||||
"assets/css/font-awesome.css",
|
|
||||||
"styles.css"
|
|
||||||
],
|
|
||||||
"scripts": [],
|
|
||||||
"environmentSource": "environments/environment.ts",
|
|
||||||
"environments": {
|
|
||||||
"dev": "environments/environment.ts",
|
|
||||||
"prod": "environments/environment.prod.ts"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ssr",
|
|
||||||
"platform": "server",
|
|
||||||
"root": "src",
|
|
||||||
"outDir": "dist/server",
|
|
||||||
"assets": [
|
|
||||||
"assets",
|
|
||||||
"favicon.ico"
|
|
||||||
],
|
|
||||||
"index": "index.html",
|
|
||||||
"main": "main-ssr.ts",
|
|
||||||
"tsconfig": "tsconfig.app-ssr.json",
|
|
||||||
"prefix": "app",
|
|
||||||
"styles": [
|
|
||||||
"../node_modules/normalize.css/normalize.css",
|
|
||||||
"assets/css/font-awesome.css",
|
|
||||||
"styles.css"
|
|
||||||
],
|
|
||||||
"scripts": [],
|
|
||||||
"environmentSource": "environments/environment.ts",
|
|
||||||
"environments": {
|
|
||||||
"dev": "environments/environment.ts",
|
|
||||||
"prod": "environments/environment.prod.ts"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"e2e": {
|
|
||||||
"protractor": {
|
|
||||||
"config": "./protractor.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": [
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.app.json",
|
|
||||||
"exclude": "**/node_modules/**"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "src/tsconfig.spec.json",
|
|
||||||
"exclude": "**/node_modules/**"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"project": "e2e/tsconfig.e2e.json",
|
|
||||||
"exclude": "**/node_modules/**"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"test": {
|
|
||||||
"karma": {
|
|
||||||
"config": "./karma.conf.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaults": {
|
|
||||||
"styleExt": "css",
|
|
||||||
"component": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
13
.gitignore
vendored
13
.gitignore
vendored
@ -5,10 +5,16 @@
|
|||||||
/dist
|
/dist
|
||||||
/tmp
|
/tmp
|
||||||
/out-tsc
|
/out-tsc
|
||||||
|
# Only exists if Bazel was run
|
||||||
|
/bazel-out
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
/node_modules
|
/node_modules
|
||||||
|
|
||||||
|
# profiling files
|
||||||
|
chrome-profiler-events*.json
|
||||||
|
speed-measure-plugin*.json
|
||||||
|
|
||||||
# IDEs and editors
|
# IDEs and editors
|
||||||
/.idea
|
/.idea
|
||||||
.project
|
.project
|
||||||
@ -24,6 +30,7 @@
|
|||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
.history/*
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
/.sass-cache
|
/.sass-cache
|
||||||
@ -31,13 +38,9 @@
|
|||||||
/coverage
|
/coverage
|
||||||
/libpeerconnection.log
|
/libpeerconnection.log
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
testem.log
|
testem.log
|
||||||
/typings
|
/typings
|
||||||
yarn-error.log
|
|
||||||
|
|
||||||
# e2e
|
|
||||||
/e2e/*.js
|
|
||||||
/e2e/*.map
|
|
||||||
|
|
||||||
# System Files
|
# System Files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# Frontend
|
# Manupgrade
|
||||||
|
|
||||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.3.0-rc.5.
|
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.13.
|
||||||
|
|
||||||
## Development server
|
## Development server
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ Run `ng generate component component-name` to generate a new component. You can
|
|||||||
|
|
||||||
## Build
|
## 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
|
## Running unit tests
|
||||||
|
|
||||||
@ -21,7 +21,6 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
|
|||||||
## Running end-to-end tests
|
## Running end-to-end tests
|
||||||
|
|
||||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||||
Before running the tests make sure you are serving the app via `ng serve`.
|
|
||||||
|
|
||||||
## Further help
|
## Further help
|
||||||
|
|
||||||
|
|||||||
149
angular.json
Normal file
149
angular.json
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"gallery-frontend": {
|
||||||
|
"projectType": "application",
|
||||||
|
"schematics": {},
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"prefix": "app",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist/browser",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"main": "src/main.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "src/tsconfig.app.json",
|
||||||
|
"aot": false,
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"node_modules/normalize.css/normalize.css",
|
||||||
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optimization": true,
|
||||||
|
"outputHashing": "all",
|
||||||
|
"sourceMap": false,
|
||||||
|
"extractCss": true,
|
||||||
|
"namedChunks": false,
|
||||||
|
"aot": true,
|
||||||
|
"extractLicenses": true,
|
||||||
|
"vendorChunk": false,
|
||||||
|
"buildOptimizer": true,
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "2mb",
|
||||||
|
"maximumError": "5mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "6kb",
|
||||||
|
"maximumError": "10kb"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "gallery-frontend:build"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "gallery-frontend:build:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "gallery-frontend:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
|
"options": {
|
||||||
|
"main": "src/test.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "tsconfig.spec.json",
|
||||||
|
"karmaConfig": "karma.conf.js",
|
||||||
|
"assets": [
|
||||||
|
"src/favicon.ico",
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.css"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"src/tsconfig.app.json",
|
||||||
|
"src/tsconfig.spec.json",
|
||||||
|
"e2e/tsconfig.json"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"**/node_modules/**"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"e2e": {
|
||||||
|
"builder": "@angular-devkit/build-angular:protractor",
|
||||||
|
"options": {
|
||||||
|
"protractorConfig": "e2e/protractor.conf.js",
|
||||||
|
"devServerTarget": "gallery-frontend:serve"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"devServerTarget": "gallery-frontend:serve:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"server": {
|
||||||
|
"builder": "@angular-devkit/build-angular:server",
|
||||||
|
"options": {
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sourceMap": false,
|
||||||
|
"optimization": {
|
||||||
|
"scripts": false,
|
||||||
|
"styles": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
"defaultProject": "gallery-frontend"
|
||||||
|
}
|
||||||
12
browserslist
Normal file
12
browserslist
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||||
|
# For additional information regarding the format and rule options, please see:
|
||||||
|
# https://github.com/browserslist/browserslist#queries
|
||||||
|
|
||||||
|
# You can see what browsers were selected by your queries by running:
|
||||||
|
# npx browserslist
|
||||||
|
|
||||||
|
> 0.5%
|
||||||
|
last 2 versions
|
||||||
|
Firefox ESR
|
||||||
|
not dead
|
||||||
|
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
||||||
@ -27,19 +27,20 @@ host('alfheim.ragnarok.yvan.hu')
|
|||||||
desc('Prepare release');
|
desc('Prepare release');
|
||||||
task('deploy:ng-prepare', function() {
|
task('deploy:ng-prepare', function() {
|
||||||
runLocally("npm run build:ssr");
|
runLocally("npm run build:ssr");
|
||||||
runLocally("tar -cJf dist.tar.xz dist server.js package.json pm2.json");
|
runLocally("tar -cJf dist.tar.xz dist package.json pm2.json");
|
||||||
});
|
});
|
||||||
|
|
||||||
desc('Upload release');
|
desc('Upload release');
|
||||||
task('deploy:ng-upload', function() {
|
task('deploy:ng-upload', function() {
|
||||||
upload("dist.tar.xz", "{{release_path}}/dist.tar.xz");
|
upload("dist.tar.xz", "{{release_path}}/dist.tar.xz");
|
||||||
run("tar -C {{release_path}} -xJf {{release_path}}/dist.tar.xz");
|
run("tar -C {{release_path}} -xJf {{release_path}}/dist.tar.xz");
|
||||||
|
upload("robots.txt", "{{release_path}}/dist/browser/robots.txt");
|
||||||
within("{{release_path}}", function () {
|
within("{{release_path}}", function () {
|
||||||
run("npm install --production");
|
run("npm install --production");
|
||||||
run("npm install express --production");
|
run("npm install express --production");
|
||||||
});
|
});
|
||||||
run("rm -f {{release_path}}/dist.tar.xz");
|
run("rm -f {{release_path}}/dist.tar.xz");
|
||||||
runLocally("rm -rf dist.tar.xz dist dist-ssr");
|
runLocally("rm -rf dist.tar.xz dist");
|
||||||
});
|
});
|
||||||
|
|
||||||
desc('Start app server');
|
desc('Start app server');
|
||||||
@ -47,7 +48,6 @@ task('deploy:pm2-restart', function() {
|
|||||||
within("{{release_path}}", function () {
|
within("{{release_path}}", function () {
|
||||||
run("pm2 stop --silent gallery-frontend");
|
run("pm2 stop --silent gallery-frontend");
|
||||||
run("pm2 delete --silent gallery-frontend");
|
run("pm2 delete --silent gallery-frontend");
|
||||||
|
|
||||||
run("pm2 start pm2.json");
|
run("pm2 start pm2.json");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -4,30 +4,29 @@
|
|||||||
module.exports = function (config) {
|
module.exports = function (config) {
|
||||||
config.set({
|
config.set({
|
||||||
basePath: '',
|
basePath: '',
|
||||||
frameworks: ['jasmine', '@angular/cli'],
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
plugins: [
|
plugins: [
|
||||||
require('karma-jasmine'),
|
require('karma-jasmine'),
|
||||||
require('karma-chrome-launcher'),
|
require('karma-chrome-launcher'),
|
||||||
require('karma-jasmine-html-reporter'),
|
require('karma-jasmine-html-reporter'),
|
||||||
require('karma-coverage-istanbul-reporter'),
|
require('karma-coverage-istanbul-reporter'),
|
||||||
require('@angular/cli/plugins/karma')
|
require('@angular-devkit/build-angular/plugins/karma')
|
||||||
],
|
],
|
||||||
client: {
|
client: {
|
||||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
},
|
},
|
||||||
coverageIstanbulReporter: {
|
coverageIstanbulReporter: {
|
||||||
reports: [ 'html', 'lcovonly' ],
|
dir: require('path').join(__dirname, './coverage/manupgrade'),
|
||||||
|
reports: ['html', 'lcovonly', 'text-summary'],
|
||||||
fixWebpackSourcePaths: true
|
fixWebpackSourcePaths: true
|
||||||
},
|
},
|
||||||
angularCli: {
|
|
||||||
environment: 'dev'
|
|
||||||
},
|
|
||||||
reporters: ['progress', 'kjhtml'],
|
reporters: ['progress', 'kjhtml'],
|
||||||
port: 9876,
|
port: 9876,
|
||||||
colors: true,
|
colors: true,
|
||||||
logLevel: config.LOG_INFO,
|
logLevel: config.LOG_INFO,
|
||||||
autoWatch: true,
|
autoWatch: true,
|
||||||
browsers: ['Chrome'],
|
browsers: ['Chrome'],
|
||||||
singleRun: false
|
singleRun: false,
|
||||||
|
restartOnFileChange: true
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
17790
package-lock.json
generated
17790
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
79
package.json
79
package.json
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend",
|
"name": "frontend",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"license": "MIT",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
@ -9,50 +8,52 @@
|
|||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e",
|
"e2e": "ng e2e",
|
||||||
"build:ssr": "npm run build:client-and-server-bundles",
|
"build:ssr": "npm run build:client-and-server-bundles && npm run compile:server",
|
||||||
"serve:ssr": "node dist/server.js",
|
"serve:ssr": "node dist/server",
|
||||||
"build:client-and-server-bundles": "ng build --prod && ng build --prod --app ssr --output-hashing=false"
|
"build:client-and-server-bundles": "ng build --prod && ng run gallery-frontend:server:production --bundleDependencies all",
|
||||||
|
"compile:server": "webpack --config webpack.server.config.js --progress --colors"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^5.2.0",
|
"@angular/animations": "~8.2.11",
|
||||||
"@angular/common": "^5.2.0",
|
"@angular/common": "~8.2.11",
|
||||||
"@angular/compiler": "^5.2.0",
|
"@angular/compiler": "~8.2.11",
|
||||||
"@angular/core": "^5.2.0",
|
"@angular/core": "~8.2.11",
|
||||||
"@angular/forms": "^5.2.0",
|
"@angular/forms": "~8.2.11",
|
||||||
"@angular/http": "^5.2.0",
|
"@angular/platform-browser": "~8.2.11",
|
||||||
"@angular/platform-browser": "^5.2.0",
|
"@angular/platform-browser-dynamic": "~8.2.11",
|
||||||
"@angular/platform-browser-dynamic": "^5.2.0",
|
"@angular/platform-server": "~8.2.11",
|
||||||
"@angular/platform-server": "^5.2.0",
|
"@angular/router": "~8.2.11",
|
||||||
"@angular/router": "^5.2.0",
|
"@nguniversal/express-engine": "~8.1.1",
|
||||||
"@nguniversal/express-engine": "5.0.0-beta.5",
|
"@nguniversal/module-map-ngfactory-loader": "~8.1.1",
|
||||||
"@nguniversal/module-map-ngfactory-loader": "5.0.0-beta.5",
|
"express": "^4.15.2",
|
||||||
"core-js": "^2.4.1",
|
"normalize.css": "^8.0.1",
|
||||||
"normalize.css": "^7.0.0",
|
"pm2": "~4.1.2",
|
||||||
"pm2": "^2.6.1",
|
"rxjs": "~6.4.0",
|
||||||
"reflect-metadata": "^0.1.12",
|
"tslib": "^1.10.0",
|
||||||
"rxjs": "^5.5.6",
|
"zone.js": "~0.9.1"
|
||||||
"zone.js": "^0.8.19"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/cli": "^1.7.1",
|
"@angular-devkit/build-angular": "~0.803.13",
|
||||||
"@angular/compiler-cli": "^5.2.0",
|
"@angular/cli": "~8.3.13",
|
||||||
"@angular/language-service": "^5.2.0",
|
"@angular/compiler-cli": "~8.2.11",
|
||||||
"@types/jasmine": "~2.8.3",
|
"@angular/language-service": "~8.2.11",
|
||||||
"@types/jasminewd2": "~2.0.2",
|
"@types/node": "~8.9.4",
|
||||||
"@types/node": "~6.0.60",
|
"@types/jasmine": "~3.3.8",
|
||||||
"codelyzer": "~4.0.1",
|
"@types/jasminewd2": "~2.0.3",
|
||||||
"jasmine-core": "~2.8.0",
|
"codelyzer": "^5.0.0",
|
||||||
|
"jasmine-core": "~3.4.0",
|
||||||
"jasmine-spec-reporter": "~4.2.1",
|
"jasmine-spec-reporter": "~4.2.1",
|
||||||
"karma": "~2.0.0",
|
"karma": "~4.1.0",
|
||||||
"karma-chrome-launcher": "~2.2.0",
|
"karma-chrome-launcher": "~2.2.0",
|
||||||
"karma-cli": "~1.0.1",
|
"karma-coverage-istanbul-reporter": "~2.0.1",
|
||||||
"karma-coverage-istanbul-reporter": "^1.2.1",
|
"karma-jasmine": "~2.0.1",
|
||||||
"karma-jasmine": "~1.1.0",
|
"karma-jasmine-html-reporter": "^1.4.0",
|
||||||
"karma-jasmine-html-reporter": "^0.2.2",
|
"protractor": "~5.4.0",
|
||||||
"protractor": "~5.1.2",
|
"ts-loader": "^5.2.0",
|
||||||
"ts-node": "~4.1.0",
|
"ts-node": "~7.0.0",
|
||||||
"tslint": "~5.9.1",
|
"tslint": "~5.15.0",
|
||||||
"typescript": "~2.5.3"
|
"typescript": "~3.5.3",
|
||||||
|
"webpack-cli": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
pm2.json
2
pm2.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"apps" : [{
|
"apps" : [{
|
||||||
"name" : "gallery-frontend",
|
"name" : "gallery-frontend",
|
||||||
"script" : "./server.js",
|
"script" : "dist/server.js",
|
||||||
"watch" : true,
|
"watch" : true,
|
||||||
"env": {
|
"env": {
|
||||||
"NODE_ENV": "development"
|
"NODE_ENV": "development"
|
||||||
|
|||||||
2
robots.txt
Normal file
2
robots.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow: /export-album/
|
||||||
43
server.js
43
server.js
@ -1,43 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
require("zone.js/dist/zone-node");
|
|
||||||
require("reflect-metadata");
|
|
||||||
|
|
||||||
const { enableProdMode } = require('@angular/core');
|
|
||||||
|
|
||||||
const express = require('express');
|
|
||||||
const { join } = require('path');
|
|
||||||
|
|
||||||
enableProdMode();
|
|
||||||
|
|
||||||
// Express server
|
|
||||||
const app = express();
|
|
||||||
|
|
||||||
const PORT = process.env.PORT || 4000;
|
|
||||||
const DIST_FOLDER = join(process.cwd(), 'dist');
|
|
||||||
|
|
||||||
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
|
|
||||||
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main.bundle');
|
|
||||||
|
|
||||||
// Express Engine
|
|
||||||
const { ngExpressEngine } = require("@nguniversal/express-engine");
|
|
||||||
// Import module map for lazy loading
|
|
||||||
const { provideModuleMap } = require("@nguniversal/module-map-ngfactory-loader");
|
|
||||||
|
|
||||||
app.engine('html', ngExpressEngine({
|
|
||||||
bootstrap: AppServerModuleNgFactory,
|
|
||||||
providers: [
|
|
||||||
provideModuleMap(LAZY_MODULE_MAP)
|
|
||||||
]
|
|
||||||
}));
|
|
||||||
app.set('view engine', 'html');
|
|
||||||
app.set('views', join(DIST_FOLDER, 'browser'));
|
|
||||||
// Server static files from /browser
|
|
||||||
app.get('*.*', express.static(join(DIST_FOLDER, 'browser')));
|
|
||||||
// All regular routes use the Universal engine
|
|
||||||
app.get('*', function (req, res) {
|
|
||||||
res.render(join(DIST_FOLDER, 'browser', 'index.html'), { req: req });
|
|
||||||
});
|
|
||||||
// Start up the Node server
|
|
||||||
app.listen(PORT, function () {
|
|
||||||
console.log("Node server listening on http://localhost:" + PORT);
|
|
||||||
});
|
|
||||||
58
server.ts
Normal file
58
server.ts
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* *** NOTE ON IMPORTING FROM ANGULAR AND NGUNIVERSAL IN THIS FILE ***
|
||||||
|
*
|
||||||
|
* If your application uses third-party dependencies, you'll need to
|
||||||
|
* either use Webpack or the Angular CLI's `bundleDependencies` feature
|
||||||
|
* in order to adequately package them for use on the server without a
|
||||||
|
* node_modules directory.
|
||||||
|
*
|
||||||
|
* However, due to the nature of the CLI's `bundleDependencies`, importing
|
||||||
|
* Angular in this file will create a different instance of Angular than
|
||||||
|
* the version in the compiled application code. This leads to unavoidable
|
||||||
|
* conflicts. Therefore, please do not explicitly import from @angular or
|
||||||
|
* @nguniversal in this file. You can export any needed resources
|
||||||
|
* from your application's main.server.ts file, as seen below with the
|
||||||
|
* import for `ngExpressEngine`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import 'zone.js/dist/zone-node';
|
||||||
|
|
||||||
|
import * as express from 'express';
|
||||||
|
import {join} from 'path';
|
||||||
|
|
||||||
|
// Express server
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
const PORT = process.env.PORT || 4000;
|
||||||
|
const DIST_FOLDER = join(process.cwd(), 'dist/browser');
|
||||||
|
|
||||||
|
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
|
||||||
|
const {AppServerModuleNgFactory, LAZY_MODULE_MAP, ngExpressEngine, provideModuleMap} = require('./dist/server/main');
|
||||||
|
|
||||||
|
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
|
||||||
|
app.engine('html', ngExpressEngine({
|
||||||
|
bootstrap: AppServerModuleNgFactory,
|
||||||
|
providers: [
|
||||||
|
provideModuleMap(LAZY_MODULE_MAP)
|
||||||
|
]
|
||||||
|
}));
|
||||||
|
|
||||||
|
app.set('view engine', 'html');
|
||||||
|
app.set('views', DIST_FOLDER);
|
||||||
|
|
||||||
|
// Example Express Rest API endpoints
|
||||||
|
// app.get('/api/**', (req, res) => { });
|
||||||
|
// Serve static files from /browser
|
||||||
|
app.get('*.*', express.static(DIST_FOLDER, {
|
||||||
|
maxAge: '1y'
|
||||||
|
}));
|
||||||
|
|
||||||
|
// All regular routes use the Universal engine
|
||||||
|
app.get('*', (req, res) => {
|
||||||
|
res.render('index', { req });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start up the Node server
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`Node Express server listening on http://localhost:${PORT}`);
|
||||||
|
});
|
||||||
@ -1,9 +1,9 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { ServerModule } from '@angular/platform-server';
|
import { ServerModule } from '@angular/platform-server';
|
||||||
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
|
|
||||||
|
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
|
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@ -11,8 +11,6 @@ import { AppComponent } from './app.component';
|
|||||||
ServerModule,
|
ServerModule,
|
||||||
ModuleMapLoaderModule,
|
ModuleMapLoaderModule,
|
||||||
],
|
],
|
||||||
bootstrap: [
|
bootstrap: [AppComponent],
|
||||||
AppComponent,
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
export class AppServerModule {}
|
export class AppServerModule {}
|
||||||
|
|||||||
@ -32,6 +32,14 @@ export class AlbumComponent implements OnInit {
|
|||||||
property: 'og:image',
|
property: 'og:image',
|
||||||
content: this.imageUrl(this.album.coverImage)
|
content: this.imageUrl(this.album.coverImage)
|
||||||
});
|
});
|
||||||
|
this.metaService.updateTag({
|
||||||
|
property: 'og:title',
|
||||||
|
content: this.album.name
|
||||||
|
});
|
||||||
|
this.metaService.updateTag({
|
||||||
|
property: 'og:description',
|
||||||
|
content: this.album.date
|
||||||
|
});
|
||||||
this.route.params.subscribe((params: {
|
this.route.params.subscribe((params: {
|
||||||
slug: string,
|
slug: string,
|
||||||
image: string
|
image: string
|
||||||
|
|||||||
@ -93,7 +93,7 @@ export class DisplayImageComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('document:keyup', ['$event.key'])
|
@HostListener('document:keyup', ['$event.key'])
|
||||||
private handleKeyPress(keyPressed: string) {
|
public handleKeyPress(keyPressed: string) {
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
switch (keyPressed) {
|
switch (keyPressed) {
|
||||||
case 'Escape':
|
case 'Escape':
|
||||||
@ -112,20 +112,20 @@ export class DisplayImageComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('click')
|
@HostListener('click')
|
||||||
private handleClick() {
|
public handleClick() {
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
this.nextImage();
|
this.nextImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('touchstart', ['$event'])
|
@HostListener('touchstart', ['$event'])
|
||||||
private touchStart(touchEvent: TouchEvent) {
|
public touchStart(touchEvent: TouchEvent) {
|
||||||
this.touchX = touchEvent.touches[0].clientX;
|
this.touchX = touchEvent.touches[0].clientX;
|
||||||
this.touchY = touchEvent.touches[0].clientY;
|
this.touchY = touchEvent.touches[0].clientY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('touchend', ['$event'])
|
@HostListener('touchend', ['$event'])
|
||||||
private touchEnd(touchEvent: TouchEvent) {
|
public touchEnd(touchEvent: TouchEvent) {
|
||||||
let xDiff: number = this.touchX - touchEvent.changedTouches[0].clientX;
|
let xDiff: number = this.touchX - touchEvent.changedTouches[0].clientX;
|
||||||
let yDiff: number = this.touchY - touchEvent.changedTouches[0].clientY;
|
let yDiff: number = this.touchY - touchEvent.changedTouches[0].clientY;
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ export class DisplayImageComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('touchcancel')
|
@HostListener('touchcancel')
|
||||||
private touchCancel() {
|
public touchCancel() {
|
||||||
this.touchX = 0;
|
this.touchX = 0;
|
||||||
this.touchY = 0;
|
this.touchY = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs";
|
||||||
import 'rxjs/Rx';
|
|
||||||
|
|
||||||
import { environment } from "../../../environments/environment";
|
import { environment } from "../../../environments/environment";
|
||||||
import { Album, Image } from ".";
|
import { Album } from "./album.model";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GalleryService implements Resolve<Array<Album>|false> {
|
export class GalleryService implements Resolve<Array<Album>|false> {
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
<meta name="og:description" content="A really simple photo album"/>
|
<meta name="og:description" content="A really simple photo album"/>
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
12
src/main.server.ts
Normal file
12
src/main.server.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { enableProdMode } from '@angular/core';
|
||||||
|
|
||||||
|
import { environment } from './environments/environment';
|
||||||
|
|
||||||
|
if (environment.production) {
|
||||||
|
enableProdMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
export { AppServerModule } from './app/app.server.module';
|
||||||
|
export { ngExpressEngine } from "@nguniversal/express-engine";
|
||||||
|
export { provideModuleMap } from "@nguniversal/module-map-ngfactory-loader";
|
||||||
|
|
||||||
@ -8,4 +8,6 @@ if (environment.production) {
|
|||||||
enableProdMode();
|
enableProdMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
});
|
||||||
|
|||||||
@ -38,8 +38,8 @@
|
|||||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||||
|
|
||||||
/** Evergreen browsers require these. **/
|
/** Evergreen browsers require these. **/
|
||||||
import 'core-js/es6/reflect';
|
//import 'core-js/es6/reflect';
|
||||||
import 'core-js/es7/reflect';
|
//import 'core-js/es7/reflect';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "../out-tsc/app",
|
|
||||||
"baseUrl": "./",
|
|
||||||
"module": "commonjs",
|
|
||||||
"types": []
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"test.ts",
|
|
||||||
"**/*.spec.ts"
|
|
||||||
],
|
|
||||||
"angularCompilerOptions": {
|
|
||||||
"entryModule": "app/app.server.module#AppServerModule"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -2,10 +2,15 @@
|
|||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../out-tsc/app",
|
"outDir": "../out-tsc/app",
|
||||||
"baseUrl": "./",
|
|
||||||
"module": "es2015",
|
|
||||||
"types": []
|
"types": []
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"main.ts",
|
||||||
|
"polyfills.ts"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"**/*.ts"
|
||||||
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"test.ts",
|
"test.ts",
|
||||||
"**/*.spec.ts"
|
"**/*.spec.ts"
|
||||||
|
|||||||
13
src/tsconfig.server.json
Normal file
13
src/tsconfig.server.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.app.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../out-tsc/app-server",
|
||||||
|
"module": "commonjs"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"main.server.ts"
|
||||||
|
],
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"entryModule": "./app/app.server.module#AppServerModule"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,16 +2,14 @@
|
|||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../out-tsc/spec",
|
"outDir": "../out-tsc/spec",
|
||||||
"baseUrl": "./",
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es5",
|
|
||||||
"types": [
|
"types": [
|
||||||
"jasmine",
|
"jasmine",
|
||||||
"node"
|
"node"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"test.ts"
|
"test.ts",
|
||||||
|
"polyfills.ts"
|
||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
"**/*.spec.ts",
|
"**/*.spec.ts",
|
||||||
|
|||||||
@ -1,19 +1,26 @@
|
|||||||
{
|
{
|
||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"baseUrl": "./",
|
||||||
"outDir": "./dist/out-tsc",
|
"outDir": "./dist/out-tsc",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"moduleResolution": "node",
|
"downlevelIteration": true,
|
||||||
"emitDecoratorMetadata": true,
|
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"target": "es5",
|
"module": "esnext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"importHelpers": true,
|
||||||
|
"target": "es2015",
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
],
|
||||||
"lib": [
|
"lib": [
|
||||||
"es2017",
|
"es2018",
|
||||||
"dom"
|
"dom"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"fullTemplateTypeCheck": true,
|
||||||
|
"strictInjectionParameters": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
51
webpack.server.config.js
Normal file
51
webpack.server.config.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// Work around for https://github.com/angular/angular-cli/issues/7200
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
mode: 'none',
|
||||||
|
entry: {
|
||||||
|
// This is our Express server for Dynamic universal
|
||||||
|
server: './server.ts'
|
||||||
|
},
|
||||||
|
externals: {
|
||||||
|
'./dist/server/main': 'require("./server/main")'
|
||||||
|
},
|
||||||
|
target: 'node',
|
||||||
|
resolve: { extensions: ['.ts', '.js'] },
|
||||||
|
optimization: {
|
||||||
|
minimize: true
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
// Puts the output at the root of the dist folder
|
||||||
|
path: path.join(__dirname, 'dist'),
|
||||||
|
filename: '[name].js'
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
noParse: /polyfills-.*\.js/,
|
||||||
|
rules: [
|
||||||
|
{ test: /\.ts$/, loader: 'ts-loader' },
|
||||||
|
{
|
||||||
|
// Mark files inside `@angular/core` as using SystemJS style dynamic imports.
|
||||||
|
// Removing this will cause deprecation warnings to appear.
|
||||||
|
test: /(\\|\/)@angular(\\|\/)core(\\|\/).+\.js$/,
|
||||||
|
parser: { system: true },
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.ContextReplacementPlugin(
|
||||||
|
// fixes WARNING Critical dependency: the request of a dependency is an expression
|
||||||
|
/(.+)?angular(\\|\/)core(.+)?/,
|
||||||
|
path.join(__dirname, 'src'), // location of your src
|
||||||
|
{} // a map of your routes
|
||||||
|
),
|
||||||
|
new webpack.ContextReplacementPlugin(
|
||||||
|
// fixes WARNING Critical dependency: the request of a dependency is an expression
|
||||||
|
/(.+)?express(\\|\/)(.+)?/,
|
||||||
|
path.join(__dirname, 'src'),
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
]
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user