From ec7b57eb6adf59ecfdfff1de5ccf1ab2f6652ed3 Mon Sep 17 00:00:00 2001 From: CaerusKaru Date: Sat, 14 Dec 2019 22:37:20 -0600 Subject: [PATCH] build: upgrade to Angular and CDK v9 (#1143) --- package.json | 39 ++-- src/apps/demo-app/angular.json | 19 +- src/apps/demo-app/package.json | 11 +- src/apps/demo-app/src/app/routing.module.ts | 21 ++- src/apps/demo-app/src/main.server.ts | 2 + src/apps/demo-app/src/tsconfig.app.json | 13 -- src/apps/demo-app/src/tsconfig.server.json | 16 -- src/apps/demo-app/tsconfig.app.json | 14 ++ src/apps/demo-app/tsconfig.json | 2 +- src/apps/demo-app/tsconfig.server.json | 17 ++ .../demo-app/{src => }/tsconfig.spec.json | 5 +- src/apps/hello-world/angular.json | 9 +- src/apps/hello-world/package.json | 8 +- src/apps/hello-world/src/tsconfig.app.json | 6 +- src/apps/hello-world/tsconfig.json | 4 +- src/apps/universal-app/angular.json | 10 +- src/apps/universal-app/package.json | 28 ++- src/apps/universal-app/server.ts | 95 ++++++---- src/apps/universal-app/src/tsconfig.app.json | 6 +- .../universal-app/src/tsconfig.server.json | 5 +- src/apps/universal-app/tsconfig.json | 2 +- .../universal-app/webpack.server.config.js | 47 ----- src/lib/core/module.ts | 4 +- src/lib/extended/class/class.ts | 2 +- src/lib/extended/img-src/img-src.ts | 2 +- src/lib/extended/module.ts | 12 +- src/lib/extended/show-hide/show-hide.ts | 2 +- src/lib/extended/style/style.ts | 4 +- src/lib/flex/flex-align/flex-align.ts | 2 +- src/lib/flex/flex-offset/flex-offset.ts | 2 +- src/lib/flex/flex-order/flex-order.ts | 2 +- src/lib/flex/flex/flex.ts | 2 +- src/lib/flex/layout-align/layout-align.ts | 2 +- src/lib/flex/layout-gap/layout-gap.ts | 2 +- src/lib/flex/layout/layout.ts | 2 +- src/lib/flex/module.ts | 21 +-- src/lib/grid/align-columns/align-columns.ts | 2 +- src/lib/grid/align-rows/align-rows.ts | 2 +- src/lib/grid/area/area.ts | 2 +- src/lib/grid/areas/areas.ts | 2 +- src/lib/grid/auto/auto.ts | 2 +- src/lib/grid/column/column.ts | 2 +- src/lib/grid/columns/columns.ts | 2 +- src/lib/grid/gap/gap.ts | 2 +- src/lib/grid/grid-align/grid-align.ts | 2 +- src/lib/grid/module.ts | 36 ++-- src/lib/grid/row/row.ts | 2 +- src/lib/grid/rows/rows.ts | 2 +- src/lib/package.json | 2 +- src/lib/tsconfig-build.json | 2 + tools/gulp/tasks/universal.ts | 12 +- tools/gulp/util/task-helpers.ts | 3 +- yarn.lock | 176 ++++++++---------- 53 files changed, 319 insertions(+), 374 deletions(-) delete mode 100644 src/apps/demo-app/src/tsconfig.app.json delete mode 100644 src/apps/demo-app/src/tsconfig.server.json create mode 100644 src/apps/demo-app/tsconfig.app.json create mode 100644 src/apps/demo-app/tsconfig.server.json rename src/apps/demo-app/{src => }/tsconfig.spec.json (75%) delete mode 100644 src/apps/universal-app/webpack.server.config.js diff --git a/package.json b/package.json index a63d1e428..99f30cce2 100644 --- a/package.json +++ b/package.json @@ -24,32 +24,33 @@ "lib:test": "gulp test", "lib:test:ssr": "gulp test:ssr", "universal:build": "gulp ci:prerender", - "universal:serve": "gulp universal:serve" + "universal:serve": "gulp universal:serve", + "postinstall": "ngcc --properties es2015 browser module main --create-ivy-entry-points" }, "version": "8.0.0-beta.27", - "requiredAngularVersion": ">=8.0.0-rc.5", + "requiredAngularVersion": ">=9.0.0-rc.6", "dependencies": { - "@angular/cdk": "^8.0.0-rc.1", - "@angular/common": "^8.0.0-rc.5", - "@angular/compiler": "^8.0.0-rc.5", - "@angular/core": "^8.0.0-rc.5", - "@angular/platform-browser": "^8.0.0-rc.5", + "@angular/cdk": "^9.0.0-rc.5", + "@angular/common": "^9.0.0-rc.6", + "@angular/compiler": "^9.0.0-rc.6", + "@angular/core": "^9.0.0-rc.6", + "@angular/platform-browser": "^9.0.0-rc.6", "core-js": "^2.5.7", "karma-parallel": "^0.3.1", "rxjs": "^6.5.1", "systemjs": "0.19.43", - "tsickle": "^0.35.0", + "tsickle": "^0.37.1", "tslib": "^1.9.3", - "zone.js": "~0.9.1" + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular/animations": "^8.0.0-rc.5", - "@angular/compiler-cli": "^8.0.0-rc.5", - "@angular/forms": "^8.0.0-rc.5", - "@angular/material": "^8.0.0-rc.1", - "@angular/platform-browser-dynamic": "^8.0.0-rc.5", - "@angular/platform-server": "^8.0.0-rc.5", - "@angular/router": "^8.0.0-rc.5", + "@angular/animations": "^9.0.0-rc.6", + "@angular/compiler-cli": "^9.0.0-rc.6", + "@angular/forms": "^9.0.0-rc.6", + "@angular/material": "^9.0.0-rc.5", + "@angular/platform-browser-dynamic": "^9.0.0-rc.6", + "@angular/platform-server": "^9.0.0-rc.6", + "@angular/router": "^9.0.0-rc.6", "@firebase/app-types": "^0.3.2", "@types/chalk": "^0.4.31", "@types/fs-extra": "^4.0.5", @@ -59,7 +60,7 @@ "@types/jasmine": "^2.8.11", "@types/merge2": "^0.3.30", "@types/minimist": "^1.2.0", - "@types/node": "^7.10.1", + "@types/node": "^12.12.17", "@types/run-sequence": "^0.0.29", "@types/rx": "2.5.33", "axe-webdriverjs": "^1.1.5", @@ -119,10 +120,10 @@ "ts-node": "^3.0.4", "tsconfig-paths": "^2.3.0", "tslint": "^5.11.0", - "typescript": "~3.4.5", + "typescript": "~3.6.4", "uglify-js": "^2.8.14" }, - "// Gulp": "Overwrite graceful-fs to a version that does not rely on the 'natives' package. This fixes gulp for >= 10.13, more information: #28213", + "// Gulp": "Overwrite graceful-fs to a version that does not rely on the 'natives' package. This fixes gulp for >= 10.13, more information: angular/angular#28213", "resolutions": { "**/graceful-fs": "4.2.2" } diff --git a/src/apps/demo-app/angular.json b/src/apps/demo-app/angular.json index df879200a..4fc6b9605 100644 --- a/src/apps/demo-app/angular.json +++ b/src/apps/demo-app/angular.json @@ -11,10 +11,11 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { + "aot": true, "outputPath": "dist/browser", "index": "src/index.html", "main": "src/main.ts", - "tsConfig": "src/tsconfig.app.json", + "tsConfig": "tsconfig.app.json", "polyfills": "src/polyfills.ts", "assets": [ "src/assets", @@ -27,6 +28,12 @@ }, "configurations": { "production": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ], "optimization": true, "outputHashing": "all", "sourceMap": false, @@ -68,7 +75,7 @@ "main": "src/test.ts", "karmaConfig": "./karma.conf.js", "polyfills": "src/polyfills.ts", - "tsConfig": "src/tsconfig.spec.json", + "tsConfig": "tsconfig.spec.json", "scripts": [], "styles": [ "src/styles.scss" @@ -83,8 +90,8 @@ "builder": "@angular-devkit/build-angular:tslint", "options": { "tsConfig": [ - "src/tsconfig.app.json", - "src/tsconfig.spec.json" + "tsconfig.app.json", + "tsconfig.spec.json" ], "exclude": [ "**/node_modules/**" @@ -96,7 +103,7 @@ "options": { "outputPath": "dist/server", "main": "src/main.server.ts", - "tsConfig": "src/tsconfig.server.json" + "tsConfig": "tsconfig.server.json" } } } @@ -137,4 +144,4 @@ "prefix": "demo" } } -} \ No newline at end of file +} diff --git a/src/apps/demo-app/package.json b/src/apps/demo-app/package.json index 0faa1ecab..c9e181484 100644 --- a/src/apps/demo-app/package.json +++ b/src/apps/demo-app/package.json @@ -14,7 +14,6 @@ "dependencies": { "@angular/animations": "file:../../../node_modules/@angular/animations", "@angular/cdk": "file:../../../node_modules/@angular/cdk", - "@angular/cli": "^8.3.17", "@angular/common": "file:../../../node_modules/@angular/common", "@angular/compiler": "file:../../../node_modules/@angular/compiler", "@angular/core": "file:../../../node_modules/@angular/core", @@ -27,16 +26,18 @@ "@angular/router": "file:../../../node_modules/@angular/router", "core-js": "file:../../../node_modules/core-js", "rxjs": "file:../../../node_modules/rxjs", + "tslib": "file:../../../node_modules/tslib", "zone.js": "file:../../../node_modules/zone.js" }, "devDependencies": { - "@angular-devkit/build-angular": "~0.803.17", + "@angular-devkit/build-angular": "~0.900.0-rc.2", + "@angular/cli": "^9.0.0-rc.2", "@angular/compiler-cli": "file:../../../node_modules/@angular/compiler-cli", - "@angular/language-service": "^8.2.13", + "@angular/language-service": "^9.0.0-rc.2", "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", - "@types/node": "~6.0.60", - "codelyzer": "^5.0.1", + "@types/node": "^12.12.11", + "codelyzer": "^5.1.2", "jasmine-core": "~2.8.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~2.0.0", diff --git a/src/apps/demo-app/src/app/routing.module.ts b/src/apps/demo-app/src/app/routing.module.ts index a2aff8feb..37b95bef9 100644 --- a/src/apps/demo-app/src/app/routing.module.ts +++ b/src/apps/demo-app/src/app/routing.module.ts @@ -4,13 +4,24 @@ import {HashLocationStrategy, LocationStrategy} from '@angular/common'; const DEMO_APP_ROUTES: Routes = [ {path: '', redirectTo: 'docs', pathMatch: 'full'}, - {path: 'grid', loadChildren: './grid/grid.module#DocsGridModule'}, - {path: 'docs', loadChildren: './layout/layout.module#DocsLayoutModule'}, - {path: 'responsive', loadChildren: './responsive/responsive.module#DocsResponsiveModule'}, - {path: 'issues', loadChildren: './github-issues/github-issues.module#DocsGithubIssuesModule'}, + {path: 'grid', loadChildren: () => import('./grid/grid.module').then(m => m.DocsGridModule)}, + { + path: 'docs', loadChildren: () => import('./layout/layout.module') + .then(m => m.DocsLayoutModule) + }, + { + path: 'responsive', + loadChildren: () => import('./responsive/responsive.module').then(m => m.DocsResponsiveModule) + }, + { + path: 'issues', + loadChildren: () => import('./github-issues/github-issues.module') + .then(m => m.DocsGithubIssuesModule) + }, { path: 'stackoverflow', - loadChildren: './stack-overflow/stack-overflow.module#DocsStackOverflowModule' + loadChildren: () => import('./stack-overflow/stack-overflow.module') + .then(m => m.DocsStackOverflowModule) } ]; diff --git a/src/apps/demo-app/src/main.server.ts b/src/apps/demo-app/src/main.server.ts index b9ca5050c..30706cb96 100644 --- a/src/apps/demo-app/src/main.server.ts +++ b/src/apps/demo-app/src/main.server.ts @@ -7,3 +7,5 @@ if (environment.production) { } export { AppServerModule } from './app/app.server.module'; + +export { renderModule, renderModuleFactory } from '@angular/platform-server'; diff --git a/src/apps/demo-app/src/tsconfig.app.json b/src/apps/demo-app/src/tsconfig.app.json deleted file mode 100644 index 39ba8dbac..000000000 --- a/src/apps/demo-app/src/tsconfig.app.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/app", - "baseUrl": "./", - "module": "es2015", - "types": [] - }, - "exclude": [ - "test.ts", - "**/*.spec.ts" - ] -} diff --git a/src/apps/demo-app/src/tsconfig.server.json b/src/apps/demo-app/src/tsconfig.server.json deleted file mode 100644 index 36fa0af8d..000000000 --- a/src/apps/demo-app/src/tsconfig.server.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../dist-server", - "baseUrl": "./", - "module": "commonjs", - "types": [] - }, - "exclude": [ - "test.ts", - "**/*.spec.ts" - ], - "angularCompilerOptions": { - "entryModule": "app/app.server.module#AppServerModule" - } -} diff --git a/src/apps/demo-app/tsconfig.app.json b/src/apps/demo-app/tsconfig.app.json new file mode 100644 index 000000000..f758d9820 --- /dev/null +++ b/src/apps/demo-app/tsconfig.app.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/app", + "types": [] + }, + "files": [ + "src/main.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.d.ts" + ] +} diff --git a/src/apps/demo-app/tsconfig.json b/src/apps/demo-app/tsconfig.json index e773c0bef..ca54de5b9 100644 --- a/src/apps/demo-app/tsconfig.json +++ b/src/apps/demo-app/tsconfig.json @@ -16,7 +16,7 @@ "es2017", "dom" ], - "module": "es2015", + "module": "esnext", "baseUrl": "./" } } diff --git a/src/apps/demo-app/tsconfig.server.json b/src/apps/demo-app/tsconfig.server.json new file mode 100644 index 000000000..61aa6e883 --- /dev/null +++ b/src/apps/demo-app/tsconfig.server.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.app.json", + "compilerOptions": { + "outDir": "./out-tsc/app-server", + "module": "commonjs", + "types": [ + "node" + ] + }, + "files": [ + "src/main.server.ts", + "server.ts" + ], + "angularCompilerOptions": { + "entryModule": "./src/app/app.server.module#AppServerModule" + } +} diff --git a/src/apps/demo-app/src/tsconfig.spec.json b/src/apps/demo-app/tsconfig.spec.json similarity index 75% rename from src/apps/demo-app/src/tsconfig.spec.json rename to src/apps/demo-app/tsconfig.spec.json index 1a18e6d00..b3248f0da 100644 --- a/src/apps/demo-app/src/tsconfig.spec.json +++ b/src/apps/demo-app/tsconfig.spec.json @@ -1,16 +1,15 @@ { - "extends": "../tsconfig.json", + "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/spec", "baseUrl": "./", - "module": "commonjs", "types": [ "jasmine", "node" ] }, "files": [ - "test.ts", + "src/test.ts", "polyfills.ts" ], "include": [ diff --git a/src/apps/hello-world/angular.json b/src/apps/hello-world/angular.json index 0c8cfb1e8..712be6b97 100644 --- a/src/apps/hello-world/angular.json +++ b/src/apps/hello-world/angular.json @@ -11,6 +11,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { + "aot": true, "outputPath": "dist", "index": "src/index.html", "main": "src/main.ts", @@ -27,6 +28,12 @@ }, "configurations": { "production": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ], "optimization": true, "outputHashing": "all", "sourceMap": false, @@ -88,4 +95,4 @@ "spec": false } } -} \ No newline at end of file +} diff --git a/src/apps/hello-world/package.json b/src/apps/hello-world/package.json index b365779ad..9d765fc87 100644 --- a/src/apps/hello-world/package.json +++ b/src/apps/hello-world/package.json @@ -11,24 +11,24 @@ "dependencies": { "@angular/animations": "file:../../../node_modules/@angular/animations", "@angular/cdk": "file:../../../node_modules/@angular/cdk", - "@angular/cli": "^8.3.17", "@angular/common": "file:../../../node_modules/@angular/common", "@angular/compiler": "file:../../../node_modules/@angular/compiler", "@angular/core": "file:../../../node_modules/@angular/core", "@angular/flex-layout": "file:../../../dist/releases/flex-layout/angular-flex-layout.tgz", "@angular/forms": "file:../../../node_modules/@angular/forms", - "@angular/material": "file:../../../node_modules/@angular/material", "@angular/platform-browser": "file:../../../node_modules/@angular/platform-browser", "@angular/platform-browser-dynamic": "file:../../../node_modules/@angular/platform-browser-dynamic", "@angular/router": "file:../../../node_modules/@angular/router", "core-js": "file:../../../node_modules/core-js", "rxjs": "file:../../../node_modules/rxjs", + "tslib": "file:../../../node_modules/tslib", "zone.js": "file:../../../node_modules/zone.js" }, "devDependencies": { - "@angular-devkit/build-angular": "~0.803.17", + "@angular-devkit/build-angular": "~0.900.0-rc.2", + "@angular/cli": "^9.0.0-rc.2", "@angular/compiler-cli": "file:../../../node_modules/@angular/compiler-cli", - "@angular/language-service": "^8.2.13", + "@angular/language-service": "^9.0.0-rc.2", "typescript": "file:../../../node_modules/typescript" } } diff --git a/src/apps/hello-world/src/tsconfig.app.json b/src/apps/hello-world/src/tsconfig.app.json index 39ba8dbac..3e88621ab 100644 --- a/src/apps/hello-world/src/tsconfig.app.json +++ b/src/apps/hello-world/src/tsconfig.app.json @@ -6,8 +6,8 @@ "module": "es2015", "types": [] }, - "exclude": [ - "test.ts", - "**/*.spec.ts" + "files": [ + "main.ts", + "polyfills.ts" ] } diff --git a/src/apps/hello-world/tsconfig.json b/src/apps/hello-world/tsconfig.json index 7168743c0..f49d4d785 100644 --- a/src/apps/hello-world/tsconfig.json +++ b/src/apps/hello-world/tsconfig.json @@ -15,7 +15,7 @@ "es2017", "dom" ], - "module": "es2015", + "module": "esnext", "baseUrl": "./" } -} \ No newline at end of file +} diff --git a/src/apps/universal-app/angular.json b/src/apps/universal-app/angular.json index a3a46c46b..9d433a77f 100644 --- a/src/apps/universal-app/angular.json +++ b/src/apps/universal-app/angular.json @@ -17,6 +17,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { + "aot": true, "outputPath": "dist/browser", "index": "src/index.html", "main": "src/main.ts", @@ -53,6 +54,10 @@ "type": "initial", "maximumWarning": "2mb", "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" } ] } @@ -108,7 +113,7 @@ "builder": "@angular-devkit/build-angular:server", "options": { "outputPath": "dist/server", - "main": "src/main.server.ts", + "main": "server.ts", "tsConfig": "src/tsconfig.server.json" }, "configurations": { @@ -119,7 +124,8 @@ "with": "src/environments/environment.prod.ts" } ] - } + }, + "optimization": true } } } diff --git a/src/apps/universal-app/package.json b/src/apps/universal-app/package.json index 67f1eb910..feae137aa 100644 --- a/src/apps/universal-app/package.json +++ b/src/apps/universal-app/package.json @@ -9,9 +9,7 @@ "lint": "ng lint", "e2e": "ng e2e", "start:ssr": "npm run build:ssr && node dist/server.js", - "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:production" + "build:ssr": "ng build --prod && ng run universal-app:server:production" }, "private": true, "dependencies": { @@ -26,22 +24,22 @@ "@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", - "@nguniversal/express-engine": "^8.1.1", - "core-js": "^2.5.4", + "@nguniversal/express-engine": "^9.0.0-next.6", "express": "^4.16.2", - "rxjs": "~6.5.2", - "tslib": "^1.9.0", - "zone.js": "~0.9.1" + "rxjs": "file:../../../node_modules/rxjs", + "tslib": "file:../../../node_modules/tslib", + "zone.js": "file:../../../node_modules/zone.js" }, "devDependencies": { - "@angular-devkit/build-angular": "~0.803.17", - "@angular/cli": "~8.3.17", + "@angular-devkit/build-angular": "~0.900.0-rc.2", + "@angular/cli": "~9.0.0-rc.2", "@angular/compiler-cli": "file:../../../node_modules/@angular/compiler-cli", - "@angular/language-service": "~8.2.13", - "@types/node": "~8.9.4", + "@angular/language-service": "~9.0.0-rc.2", + "@types/express": "^4.17.0", + "@types/node": "file:../../../node_modules/@types/node", "@types/jasmine": "~2.8.8", "@types/jasminewd2": "~2.0.3", - "codelyzer": "~4.5.0", + "codelyzer": "~5.1.2", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~3.1.1", @@ -53,8 +51,6 @@ "ts-loader": "^5.2.1", "ts-node": "~7.0.0", "tslint": "~5.11.0", - "typescript": "file:../../../node_modules/typescript", - "webpack": "^4.20.2", - "webpack-cli": "^3.1.2" + "typescript": "file:../../../node_modules/typescript" } } diff --git a/src/apps/universal-app/server.ts b/src/apps/universal-app/server.ts index 8a5b85b09..c7952a90a 100644 --- a/src/apps/universal-app/server.ts +++ b/src/apps/universal-app/server.ts @@ -1,43 +1,58 @@ -// These are important and needed before anything else import 'zone.js/dist/zone-node'; -import 'reflect-metadata'; - -import {ngExpressEngine} from '@nguniversal/express-engine'; -import {enableProdMode} from '@angular/core'; +import { ngExpressEngine } from '@nguniversal/express-engine'; import * as express from 'express'; -import {join} from 'path'; - -// Faster server renders w/ Prod mode (dev mode never needed) -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} = require('./dist/server/main'); - -app.engine('html', - ngExpressEngine({ - bootstrap: AppServerModuleNgFactory, - }) -); - -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('*', (req, res) => { - res.render('index', { req }); -}); - -// Start up the Node server -app.listen(PORT, () => { - console.log(`Node server listening on http://localhost:${PORT}`); -}); +import { join } from 'path'; + +import { AppServerModule } from './src/main.server'; +import { APP_BASE_HREF } from '@angular/common'; + +// The Express app is exported so that it can be used by serverless Functions. +export function app() { + const server = express(); + const distFolder = join(process.cwd(), 'dist/browser'); + + // Our Universal express-engine + // (found @ https://github.com/angular/universal/tree/master/modules/express-engine) + server.engine('html', ngExpressEngine({ + bootstrap: AppServerModule, + })); + + server.set('view engine', 'html'); + server.set('views', distFolder); + + // Example Express Rest API endpoints + // app.get('/api/**', (req, res) => { }); + // Serve static files from /browser + server.get('*.*', express.static(distFolder, { + maxAge: '1y' + })); + + // All regular routes use the Universal engine + server.get('*', (req, res) => { + res.render('index', { req, providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }] }); + }); + + return server; +} + +function run() { + const port = process.env.PORT || 4000; + + // Start up the Node server + const server = app(); + server.listen(port, () => { + console.log(`Node Express server listening on http://localhost:${port}`); + }); +} + +// Webpack will replace 'require' with '__webpack_require__' +// '__non_webpack_require__' is a proxy to Node 'require' +// The below code is to ensure that the server is run only when not requiring the bundle. +declare const __non_webpack_require__: NodeRequire; +const mainModule = __non_webpack_require__.main; +if (mainModule && mainModule.filename === __filename) { + run(); +} + +export * from './src/main.server'; diff --git a/src/apps/universal-app/src/tsconfig.app.json b/src/apps/universal-app/src/tsconfig.app.json index 190fd300b..6af6e87a2 100644 --- a/src/apps/universal-app/src/tsconfig.app.json +++ b/src/apps/universal-app/src/tsconfig.app.json @@ -4,8 +4,8 @@ "outDir": "../out-tsc/app", "types": [] }, - "exclude": [ - "test.ts", - "**/*.spec.ts" + "files": [ + "main.ts", + "polyfills.ts" ] } diff --git a/src/apps/universal-app/src/tsconfig.server.json b/src/apps/universal-app/src/tsconfig.server.json index 5dbf48187..8440e93e9 100644 --- a/src/apps/universal-app/src/tsconfig.server.json +++ b/src/apps/universal-app/src/tsconfig.server.json @@ -6,5 +6,8 @@ }, "angularCompilerOptions": { "entryModule": "app/app.server.module#AppServerModule" - } + }, + "files": [ + "../server.ts" + ] } diff --git a/src/apps/universal-app/tsconfig.json b/src/apps/universal-app/tsconfig.json index b271fd9f3..9fcb8f7b9 100644 --- a/src/apps/universal-app/tsconfig.json +++ b/src/apps/universal-app/tsconfig.json @@ -5,7 +5,7 @@ "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, - "module": "es2015", + "module": "esnext", "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, diff --git a/src/apps/universal-app/webpack.server.config.js b/src/apps/universal-app/webpack.server.config.js deleted file mode 100644 index 6c98a99af..000000000 --- a/src/apps/universal-app/webpack.server.config.js +++ /dev/null @@ -1,47 +0,0 @@ -// 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' - }, - target: 'node', - resolve: { extensions: ['.ts', '.js'] }, - optimization: { - minimize: false - }, - output: { - // Puts the output at the root of the dist folder - path: path.join(__dirname, 'dist'), - filename: '[name].js' - }, - module: { - 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'), - {} - ) - ] -}; diff --git a/src/lib/core/module.ts b/src/lib/core/module.ts index 5f89388b3..1b8e21c9d 100644 --- a/src/lib/core/module.ts +++ b/src/lib/core/module.ts @@ -9,12 +9,12 @@ import {NgModule} from '@angular/core'; import {BROWSER_PROVIDER} from './browser-provider'; + /** * ***************************************************************** - * Define module for the MediaQuery API + * Define module for common Angular Layout utilities * ***************************************************************** */ - @NgModule({ providers: [BROWSER_PROVIDER] }) diff --git a/src/lib/extended/class/class.ts b/src/lib/extended/class/class.ts index d2f8a0595..030e2de2a 100644 --- a/src/lib/extended/class/class.ts +++ b/src/lib/extended/class/class.ts @@ -9,7 +9,7 @@ import {Directive, DoCheck, ElementRef, Input, Optional, Self} from '@angular/co import {NgClass, ɵNgClassImpl, ɵNgClassR2Impl} from '@angular/common'; import {BaseDirective2, StyleUtils, MediaMarshaller} from '@angular/flex-layout/core'; -@Directive({selector: 'class-directive'}) +@Directive() export class ClassDirective extends BaseDirective2 implements DoCheck { protected DIRECTIVE_KEY = 'ngClass'; diff --git a/src/lib/extended/img-src/img-src.ts b/src/lib/extended/img-src/img-src.ts index 8404336de..ea8fd16a1 100644 --- a/src/lib/extended/img-src/img-src.ts +++ b/src/lib/extended/img-src/img-src.ts @@ -23,7 +23,7 @@ export class ImgSrcStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'img-src-directive'}) +@Directive() export class ImgSrcDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'img-src'; protected defaultSrc = ''; diff --git a/src/lib/extended/module.ts b/src/lib/extended/module.ts index a10764e85..ecc46f6c2 100644 --- a/src/lib/extended/module.ts +++ b/src/lib/extended/module.ts @@ -8,10 +8,10 @@ import {NgModule} from '@angular/core'; import {CoreModule} from '@angular/flex-layout/core'; -import {DefaultImgSrcDirective, ImgSrcDirective} from './img-src/img-src'; -import {ClassDirective, DefaultClassDirective} from './class/class'; -import {DefaultShowHideDirective, ShowHideDirective} from './show-hide/show-hide'; -import {DefaultStyleDirective, StyleDirective} from './style/style'; +import {DefaultImgSrcDirective} from './img-src/img-src'; +import {DefaultClassDirective} from './class/class'; +import {DefaultShowHideDirective} from './show-hide/show-hide'; +import {DefaultStyleDirective} from './style/style'; const ALL_DIRECTIVES = [ @@ -19,10 +19,6 @@ const ALL_DIRECTIVES = [ DefaultClassDirective, DefaultStyleDirective, DefaultImgSrcDirective, - ClassDirective, - ImgSrcDirective, - ShowHideDirective, - StyleDirective, ]; /** diff --git a/src/lib/extended/show-hide/show-hide.ts b/src/lib/extended/show-hide/show-hide.ts index 336924501..b3882109c 100644 --- a/src/lib/extended/show-hide/show-hide.ts +++ b/src/lib/extended/show-hide/show-hide.ts @@ -41,7 +41,7 @@ export class ShowHideStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'show-hide-directive'}) +@Directive() export class ShowHideDirective extends BaseDirective2 implements AfterViewInit, OnChanges { protected DIRECTIVE_KEY = 'show-hide'; diff --git a/src/lib/extended/style/style.ts b/src/lib/extended/style/style.ts index a914dd4ac..4d8d6d4d6 100644 --- a/src/lib/extended/style/style.ts +++ b/src/lib/extended/style/style.ts @@ -37,7 +37,7 @@ import { keyValuesToMap, } from './style-transforms'; -@Directive({selector: 'style-directive'}) +@Directive() export class StyleDirective extends BaseDirective2 implements DoCheck { protected DIRECTIVE_KEY = 'ngStyle'; @@ -54,7 +54,7 @@ export class StyleDirective extends BaseDirective2 implements DoCheck { @Inject(PLATFORM_ID) platformId: Object) { super(elementRef, null!, styler, marshal); if (!this.ngStyleInstance) { - // Create an instance NgClass Directive instance only if `ngClass=""` has NOT been + // Create an instance NgStyle Directive instance only if `ngStyle=""` has NOT been // defined on the same host element; since the responsive variations may be defined... this.ngStyleInstance = new NgStyle(this.delegate); } diff --git a/src/lib/flex/flex-align/flex-align.ts b/src/lib/flex/flex-align/flex-align.ts index 387611d86..61828b1bd 100644 --- a/src/lib/flex/flex-align/flex-align.ts +++ b/src/lib/flex/flex-align/flex-align.ts @@ -55,7 +55,7 @@ const selector = ` * Allows element-specific overrides for cross-axis alignments in a layout container * @see https://css-tricks.com/almanac/properties/a/align-self/ */ -@Directive({selector: 'flex-align-directive'}) +@Directive() export class FlexAlignDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'flex-align'; diff --git a/src/lib/flex/flex-offset/flex-offset.ts b/src/lib/flex/flex-offset/flex-offset.ts index 68e77d853..ec1871364 100644 --- a/src/lib/flex/flex-offset/flex-offset.ts +++ b/src/lib/flex/flex-offset/flex-offset.ts @@ -65,7 +65,7 @@ const selector = ` * 'flex-offset' flexbox styling directive * Configures the 'margin-left' of the element in a layout container */ -@Directive({selector: 'flex-offset-directive'}) +@Directive() export class FlexOffsetDirective extends BaseDirective2 implements OnChanges { protected DIRECTIVE_KEY = 'flex-offset'; diff --git a/src/lib/flex/flex-order/flex-order.ts b/src/lib/flex/flex-order/flex-order.ts index 51cdb11f4..d92ea1a99 100644 --- a/src/lib/flex/flex-order/flex-order.ts +++ b/src/lib/flex/flex-order/flex-order.ts @@ -39,7 +39,7 @@ const selector = ` * Configures the positional ordering of the element in a sorted layout container * @see https://css-tricks.com/almanac/properties/o/order/ */ -@Directive({selector: 'flex-order-directive'}) +@Directive() export class FlexOrderDirective extends BaseDirective2 implements OnChanges { protected DIRECTIVE_KEY = 'flex-order'; diff --git a/src/lib/flex/flex/flex.ts b/src/lib/flex/flex/flex.ts index 066f44429..dbcbbea4f 100644 --- a/src/lib/flex/flex/flex.ts +++ b/src/lib/flex/flex/flex.ts @@ -199,7 +199,7 @@ const selector = ` * * @see https://css-tricks.com/snippets/css/a-guide-to-flexbox/ */ -@Directive({selector: 'flex-directive'}) +@Directive() export class FlexDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'flex'; diff --git a/src/lib/flex/layout-align/layout-align.ts b/src/lib/flex/layout-align/layout-align.ts index 43c9b5a13..c64cc6e8c 100644 --- a/src/lib/flex/layout-align/layout-align.ts +++ b/src/lib/flex/layout-align/layout-align.ts @@ -119,7 +119,7 @@ const selector = ` * @see https://css-tricks.com/almanac/properties/a/align-items/ * @see https://css-tricks.com/almanac/properties/a/align-content/ */ -@Directive({selector: 'layout-align-directive'}) +@Directive() export class LayoutAlignDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'layout-align'; protected layout = 'row'; // default flex-direction diff --git a/src/lib/flex/layout-gap/layout-gap.ts b/src/lib/flex/layout-gap/layout-gap.ts index c052dab97..c7b3f45b7 100644 --- a/src/lib/flex/layout-gap/layout-gap.ts +++ b/src/lib/flex/layout-gap/layout-gap.ts @@ -96,7 +96,7 @@ const selector = ` * 'layout-padding' styling directive * Defines padding of child elements in a layout container */ -@Directive({selector: 'layout-gap-directive'}) +@Directive() export class LayoutGapDirective extends BaseDirective2 implements AfterContentInit, OnDestroy { protected layout = 'row'; // default flex-direction protected DIRECTIVE_KEY = 'layout-gap'; diff --git a/src/lib/flex/layout/layout.ts b/src/lib/flex/layout/layout.ts index d700c68d0..36a280ba7 100644 --- a/src/lib/flex/layout/layout.ts +++ b/src/lib/flex/layout/layout.ts @@ -43,7 +43,7 @@ const selector = ` * @see https://css-tricks.com/almanac/properties/f/flex-direction/ * */ -@Directive({selector: 'layout-directive'}) +@Directive() export class LayoutDirective extends BaseDirective2 implements OnChanges { protected DIRECTIVE_KEY = 'layout'; diff --git a/src/lib/flex/module.ts b/src/lib/flex/module.ts index e9d154d7c..9df86b458 100644 --- a/src/lib/flex/module.ts +++ b/src/lib/flex/module.ts @@ -9,14 +9,14 @@ import {NgModule} from '@angular/core'; import {BidiModule} from '@angular/cdk/bidi'; import {CoreModule} from '@angular/flex-layout/core'; -import {DefaultLayoutDirective, LayoutDirective} from './layout/layout'; -import {DefaultLayoutGapDirective, LayoutGapDirective} from './layout-gap/layout-gap'; -import {DefaultFlexDirective, FlexDirective} from './flex/flex'; -import {DefaultFlexOrderDirective, FlexOrderDirective} from './flex-order/flex-order'; -import {DefaultFlexOffsetDirective, FlexOffsetDirective} from './flex-offset/flex-offset'; -import {DefaultFlexAlignDirective, FlexAlignDirective} from './flex-align/flex-align'; +import {DefaultLayoutDirective} from './layout/layout'; +import {DefaultLayoutGapDirective} from './layout-gap/layout-gap'; +import {DefaultFlexDirective} from './flex/flex'; +import {DefaultFlexOrderDirective} from './flex-order/flex-order'; +import {DefaultFlexOffsetDirective} from './flex-offset/flex-offset'; +import {DefaultFlexAlignDirective} from './flex-align/flex-align'; import {FlexFillDirective} from './flex-fill/flex-fill'; -import {DefaultLayoutAlignDirective, LayoutAlignDirective} from './layout-align/layout-align'; +import {DefaultLayoutAlignDirective} from './layout-align/layout-align'; const ALL_DIRECTIVES = [ @@ -28,13 +28,6 @@ const ALL_DIRECTIVES = [ FlexFillDirective, DefaultFlexAlignDirective, DefaultFlexDirective, - FlexDirective, - FlexAlignDirective, - FlexOffsetDirective, - FlexOrderDirective, - LayoutDirective, - LayoutAlignDirective, - LayoutGapDirective, ]; /** diff --git a/src/lib/grid/align-columns/align-columns.ts b/src/lib/grid/align-columns/align-columns.ts index 93cf32573..81cbf58bb 100644 --- a/src/lib/grid/align-columns/align-columns.ts +++ b/src/lib/grid/align-columns/align-columns.ts @@ -29,7 +29,7 @@ export class GridAlignColumnsStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'grid-align-columns-directive'}) +@Directive() export class GridAlignColumnsDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'grid-align-columns'; diff --git a/src/lib/grid/align-rows/align-rows.ts b/src/lib/grid/align-rows/align-rows.ts index 5e2b34a7d..be7673b16 100644 --- a/src/lib/grid/align-rows/align-rows.ts +++ b/src/lib/grid/align-rows/align-rows.ts @@ -29,7 +29,7 @@ export class GridAlignRowsStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'grid-align-rows-directive'}) +@Directive() export class GridAlignRowsDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'grid-align-rows'; diff --git a/src/lib/grid/area/area.ts b/src/lib/grid/area/area.ts index 982e046da..18ba0490a 100644 --- a/src/lib/grid/area/area.ts +++ b/src/lib/grid/area/area.ts @@ -23,7 +23,7 @@ export class GridAreaStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'grid-area-directive'}) +@Directive() export class GridAreaDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'grid-area'; diff --git a/src/lib/grid/areas/areas.ts b/src/lib/grid/areas/areas.ts index 38fac90a1..1c4de91f8 100644 --- a/src/lib/grid/areas/areas.ts +++ b/src/lib/grid/areas/areas.ts @@ -34,7 +34,7 @@ export class GridAreasStyleBuiler extends StyleBuilder { } } -@Directive({selector: 'grid-areas-directive'}) +@Directive() export class GridAreasDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'grid-areas'; diff --git a/src/lib/grid/auto/auto.ts b/src/lib/grid/auto/auto.ts index 4e18eb17a..fa058e177 100644 --- a/src/lib/grid/auto/auto.ts +++ b/src/lib/grid/auto/auto.ts @@ -38,7 +38,7 @@ export class GridAutoStyleBuilder extends StyleBuilder { } } -@Directive({selector: `grid-auto-directive`}) +@Directive() export class GridAutoDirective extends BaseDirective2 { @Input('gdInline') get inline(): boolean { return this._inline; } diff --git a/src/lib/grid/column/column.ts b/src/lib/grid/column/column.ts index c7152f72e..b09a76f05 100644 --- a/src/lib/grid/column/column.ts +++ b/src/lib/grid/column/column.ts @@ -23,7 +23,7 @@ export class GridColumnStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'grid-column-directive'}) +@Directive() export class GridColumnDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'grid-column'; diff --git a/src/lib/grid/columns/columns.ts b/src/lib/grid/columns/columns.ts index f069e357b..4d782450e 100644 --- a/src/lib/grid/columns/columns.ts +++ b/src/lib/grid/columns/columns.ts @@ -44,7 +44,7 @@ export class GridColumnsStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'grid-columns-directive'}) +@Directive() export class GridColumnsDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'grid-columns'; diff --git a/src/lib/grid/gap/gap.ts b/src/lib/grid/gap/gap.ts index 5216c8592..225f7ead6 100644 --- a/src/lib/grid/gap/gap.ts +++ b/src/lib/grid/gap/gap.ts @@ -31,7 +31,7 @@ export class GridGapStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'grid-gap-directive'}) +@Directive() export class GridGapDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'grid-gap'; diff --git a/src/lib/grid/grid-align/grid-align.ts b/src/lib/grid/grid-align/grid-align.ts index 8ffb5b505..ed695bfa6 100644 --- a/src/lib/grid/grid-align/grid-align.ts +++ b/src/lib/grid/grid-align/grid-align.ts @@ -24,7 +24,7 @@ export class GridAlignStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'grid-align-directive'}) +@Directive() export class GridAlignDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'grid-align'; diff --git a/src/lib/grid/module.ts b/src/lib/grid/module.ts index a49144cf8..ae40949b4 100644 --- a/src/lib/grid/module.ts +++ b/src/lib/grid/module.ts @@ -8,20 +8,17 @@ import {NgModule} from '@angular/core'; import {CoreModule} from '@angular/flex-layout/core'; -import {DefaultGridAlignDirective, GridAlignDirective} from './grid-align/grid-align'; -import { - DefaultGridAlignColumnsDirective, - GridAlignColumnsDirective, -} from './align-columns/align-columns'; -import {DefaultGridAlignRowsDirective, GridAlignRowsDirective} from './align-rows/align-rows'; -import {DefaultGridAreaDirective, GridAreaDirective} from './area/area'; -import {DefaultGridAreasDirective, GridAreasDirective} from './areas/areas'; -import {DefaultGridAutoDirective, GridAutoDirective} from './auto/auto'; -import {DefaultGridColumnDirective, GridColumnDirective} from './column/column'; -import {DefaultGridColumnsDirective, GridColumnsDirective} from './columns/columns'; -import {DefaultGridGapDirective, GridGapDirective} from './gap/gap'; -import {DefaultGridRowDirective, GridRowDirective} from './row/row'; -import {DefaultGridRowsDirective, GridRowsDirective} from './rows/rows'; +import {DefaultGridAlignDirective} from './grid-align/grid-align'; +import {DefaultGridAlignColumnsDirective} from './align-columns/align-columns'; +import {DefaultGridAlignRowsDirective} from './align-rows/align-rows'; +import {DefaultGridAreaDirective} from './area/area'; +import {DefaultGridAreasDirective} from './areas/areas'; +import {DefaultGridAutoDirective} from './auto/auto'; +import {DefaultGridColumnDirective} from './column/column'; +import {DefaultGridColumnsDirective} from './columns/columns'; +import {DefaultGridGapDirective} from './gap/gap'; +import {DefaultGridRowDirective} from './row/row'; +import {DefaultGridRowsDirective} from './rows/rows'; const ALL_DIRECTIVES = [ @@ -36,17 +33,6 @@ const ALL_DIRECTIVES = [ DefaultGridGapDirective, DefaultGridRowDirective, DefaultGridRowsDirective, - GridAlignColumnsDirective, - GridAlignRowsDirective, - GridAreaDirective, - GridAreasDirective, - GridAutoDirective, - GridColumnDirective, - GridColumnsDirective, - GridGapDirective, - GridAlignDirective, - GridRowDirective, - GridRowsDirective, ]; /** diff --git a/src/lib/grid/row/row.ts b/src/lib/grid/row/row.ts index ecb360c0f..a7de85404 100644 --- a/src/lib/grid/row/row.ts +++ b/src/lib/grid/row/row.ts @@ -23,7 +23,7 @@ export class GridRowStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'grid-row-directive'}) +@Directive() export class GridRowDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'grid-row'; diff --git a/src/lib/grid/rows/rows.ts b/src/lib/grid/rows/rows.ts index de857cae1..40fae9ee4 100644 --- a/src/lib/grid/rows/rows.ts +++ b/src/lib/grid/rows/rows.ts @@ -44,7 +44,7 @@ export class GridRowsStyleBuilder extends StyleBuilder { } } -@Directive({selector: 'grid-rows-directive'}) +@Directive() export class GridRowsDirective extends BaseDirective2 { protected DIRECTIVE_KEY = 'grid-rows'; diff --git a/src/lib/package.json b/src/lib/package.json index 2104f2856..90036af2c 100644 --- a/src/lib/package.json +++ b/src/lib/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/angular/flex-layout#readme", "peerDependencies": { - "@angular/cdk": "^8.0.0-rc.0", + "@angular/cdk": "^9.0.0-rc.0", "@angular/core": "0.0.0-NG", "@angular/common": "0.0.0-NG", "@angular/platform-browser": "0.0.0-NG", diff --git a/src/lib/tsconfig-build.json b/src/lib/tsconfig-build.json index ac9a23a96..a702f70b6 100644 --- a/src/lib/tsconfig-build.json +++ b/src/lib/tsconfig-build.json @@ -7,6 +7,7 @@ "noUnusedParameters": true, "noUnusedLocals": true, "strictNullChecks": true, + "noImplicitReturns": true, "strictFunctionTypes": true, "strictPropertyInitialization": true, "noImplicitAny": true, @@ -38,6 +39,7 @@ ], "angularCompilerOptions": { "annotateForClosureCompiler": true, + "enableIvy": false, "strictMetadataEmit": true, "flatModuleOutFile": "index.js", "flatModuleId": "@angular/flex-layout", diff --git a/tools/gulp/tasks/universal.ts b/tools/gulp/tasks/universal.ts index 80812030f..f796dbeb2 100644 --- a/tools/gulp/tasks/universal.ts +++ b/tools/gulp/tasks/universal.ts @@ -17,8 +17,7 @@ task('universal:serve', sequenceTask( task('prerender', sequenceTask( 'prerender:pre', - 'prerender:build', - 'prerender:webpack') + 'prerender:build') ); task('prerender:pre', sequenceTask( 'clean', @@ -54,17 +53,12 @@ task('prerender:bundle:rename', [], execTask( /** Task that builds the universal-app in server mode */ task('prerender:build', execTask( - 'yarn', ['build:ssr:bundle'], + 'yarn', ['build:ssr'], {cwd: universalAppSource, failOnStderr: true} )); -task('prerender:webpack', execTask( - 'yarn', ['build:server'], - {cwd: universalAppSource} -)); - task('prerender:run:server', execTask( - 'node', ['dist/server.js'], + 'yarn', ['start:ssr'], {cwd: universalAppSource, failOnStderr: true} )); diff --git a/tools/gulp/util/task-helpers.ts b/tools/gulp/util/task-helpers.ts index 4112700d2..a51086fac 100644 --- a/tools/gulp/util/task-helpers.ts +++ b/tools/gulp/util/task-helpers.ts @@ -68,7 +68,8 @@ export function execTask(binPath: string, args: string[], options: ExecTaskOptio if (!options.silent || options.failOnStderr) { childProcess.stderr.on('data', (data: string) => { - options.failOnStderr ? stderrData.push(data) : process.stderr.write(data); + options.failOnStderr && !data.includes('Compiling') ? + stderrData.push(data) : process.stderr.write(data); }); } diff --git a/yarn.lock b/yarn.lock index 702f976f1..3a74ac294 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,33 +2,27 @@ # yarn lockfile v1 -"@angular/animations@^8.0.0-rc.5": - version "8.2.13" - resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-8.2.13.tgz#0fdcf9bdcc0b310bff09a024557f0f935ae9b5dc" - integrity sha512-ZE4UZsQ6HDW1ZIj9tL45PVosCcG4Ke7ihV7eWCE1VgLZKDDxTOPbLf1UeEiszUYptMLGH3eGMNBKo85mOlkH8w== - dependencies: - tslib "^1.9.0" - -"@angular/cdk@^8.0.0-rc.1": - version "8.2.3" - resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-8.2.3.tgz#16b96ffa935cbf5a646757ecaf2b19c434678f72" - integrity sha512-ZwO5Sn720RA2YvBqud0JAHkZXjmjxM0yNzCO8RVtRE9i8Gl26Wk0j0nQeJkVm4zwv2QO8MwbKUKGTMt8evsokA== - dependencies: - tslib "^1.7.1" +"@angular/animations@^9.0.0-rc.6": + version "9.0.0-rc.6" + resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-9.0.0-rc.6.tgz#46140aac365a203a89b48a72959a5e9e8e382adb" + integrity sha512-V74N9W5bwZrTCo4SRkiiCsqr/c4UA82P30sXIjSXvjUDXxvZg7vu/TtrV8iNZcvgHifvpTuxEze6tHbRz+G82w== + +"@angular/cdk@^9.0.0-rc.5": + version "9.0.0-rc.5" + resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-9.0.0-rc.5.tgz#9afcab0966954f567978aeb67e223b0de17e3eb8" + integrity sha512-hsYN0yGcM/3lPH+eYHBgHHTukIH91uIznqcQ62cp2VH3yGbtn1bZ+EUtTq5af/A2I+wmTJQl3KikwipBQWycTQ== optionalDependencies: parse5 "^5.0.0" -"@angular/common@^8.0.0-rc.5": - version "8.2.13" - resolved "https://registry.yarnpkg.com/@angular/common/-/common-8.2.13.tgz#32e374396e17d85791672a0900ad972c6b3e50ed" - integrity sha512-I9cTcjUi88L+Mb/a/ZzUrdDcn3YgFFK9LubxaPjAfr6+G7IZ//MY5HuvG8Y41yKprXVVvQCbQ1yQD+GGRSCkaA== - dependencies: - tslib "^1.9.0" +"@angular/common@^9.0.0-rc.6": + version "9.0.0-rc.6" + resolved "https://registry.yarnpkg.com/@angular/common/-/common-9.0.0-rc.6.tgz#e8c6adc34576f58bcd43e78d25f7d6ea5a0418d1" + integrity sha512-ERfTlPi3E93u41hb7at0UGMxi2numebklfLRqQVEkwLkHz0Bb+FYrKX+tHXlXJaIjjFpQ8rDZVNJzdp8D9YlTA== -"@angular/compiler-cli@^8.0.0-rc.5": - version "8.2.13" - resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-8.2.13.tgz#c8f842e3873c9eadd6629f66d6156c94ae9cd522" - integrity sha512-ryW2Kozx/oHJrtdeIhgZ24RIU7Za3YIOHS9EMCQ8xMo+ZlSI+t2zOlLAXzK4PVWEjuTtQlKbT0KqilgU0QsHJg== +"@angular/compiler-cli@^9.0.0-rc.6": + version "9.0.0-rc.6" + resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-9.0.0-rc.6.tgz#2f9c654e69990cc433e7ed24e5bedd4f4d947b7d" + integrity sha512-ZwROZnxbRH5NnsHkolNXTdbpWWPdBlr+wOptEZBs443B6PQmnEVF+tgtlPVaCrLpqt/AmrBYw10SvvToNNB1uw== dependencies: canonical-path "1.0.0" chokidar "^2.1.1" @@ -37,67 +31,52 @@ magic-string "^0.25.0" minimist "^1.2.0" reflect-metadata "^0.1.2" + semver "^6.3.0" source-map "^0.6.1" - tslib "^1.9.0" yargs "13.1.0" -"@angular/compiler@^8.0.0-rc.5": - version "8.2.13" - resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-8.2.13.tgz#76d35761918df8cadeb1624418377712d259347f" - integrity sha512-u2NWCvEn4SjbMvn2PG6sYcf+rR5u3aYMv3/mNQ9k+2UmCIu3yJrcuCzebjo5SdlDVqKD2vzbyMZnr8VB9OcceQ== - dependencies: - tslib "^1.9.0" - -"@angular/core@^8.0.0-rc.5": - version "8.2.13" - resolved "https://registry.yarnpkg.com/@angular/core/-/core-8.2.13.tgz#b65b81ddb9400f4f11491b6032c2ace9b90e32b4" - integrity sha512-W8HN0lUQV4Sq85l17nhRIXeIfcw1ZdpgGm6to98pl0y9l/1srfzWfTnofuwCJC7gedt5AMrYJGUaNiDbByosFw== - dependencies: - tslib "^1.9.0" - -"@angular/forms@^8.0.0-rc.5": - version "8.2.13" - resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-8.2.13.tgz#8bb2a5d3e0e8adc17e2bcc94b07d3a56c557ed63" - integrity sha512-l7lHD4kbWK70KY0Xp4IpSa106ZzSgPMwRYMFKd9qhYaJ7v0Y7Shh7Z/ZDCOP730maj9WULnpy5X4eeozWXgvgg== - dependencies: - tslib "^1.9.0" - -"@angular/material@^8.0.0-rc.1": - version "8.2.3" - resolved "https://registry.yarnpkg.com/@angular/material/-/material-8.2.3.tgz#16543e4e06a3fde2651a25cfe126e88e714ae105" - integrity sha512-SOczkIaqes+r+9XF/UUiokidfFKBpHkOPIaFK857sFD0FBNPvPEpOr5oHKCG3feERRwAFqHS7Wo2ohVEWypb5A== - dependencies: - tslib "^1.7.1" - -"@angular/platform-browser-dynamic@^8.0.0-rc.5": - version "8.2.13" - resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-8.2.13.tgz#238025b7b3a6d8b1aa9025df52805e5ee0119f55" - integrity sha512-KP5psUKujAO8jZKHi6LRC+N7hE/epiGOhYZxdher1sCi81sYoZmqrEWkVZ4VKhov/4aC409CocDXcF7nmHV8tg== - dependencies: - tslib "^1.9.0" - -"@angular/platform-browser@^8.0.0-rc.5": - version "8.2.13" - resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-8.2.13.tgz#4b7ecfb67c9a3db30d9d403677db70c496c40983" - integrity sha512-1lPbeLQIbbafjq9ul3IA8s2fMJ/EXeMJ74ouTolVXoPPur9ZPRLX9FqBAO1K4QzkAWhRlyf6qIC+mDZfJILwZw== - dependencies: - tslib "^1.9.0" - -"@angular/platform-server@^8.0.0-rc.5": - version "8.2.13" - resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-8.2.13.tgz#be654535e4c59051a09603266cb5a0a1ae030505" - integrity sha512-rRSqcUF0ExiE8mhX8Gwu4aDvrcyKi7VxLd2/wXXFQ3kuxwiWJ36RJ/ciJ8WrAjWjvvHHtJ8iEyF2BxJqGjqWlQ== +"@angular/compiler@^9.0.0-rc.6": + version "9.0.0-rc.6" + resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-9.0.0-rc.6.tgz#6842a74df6803c461d99f3ff4cddb9a91feb7a78" + integrity sha512-R9nlNM40rpK3gW2wtosGf/dAwCOZg44bMusQzqaD3JDSrgR7+JIrjpbA2aaTdt0wQ/3XJyOd/jWNeokxkAsutg== + +"@angular/core@^9.0.0-rc.6": + version "9.0.0-rc.6" + resolved "https://registry.yarnpkg.com/@angular/core/-/core-9.0.0-rc.6.tgz#3e365539271c95c9bd75109bf8087198c3c7c6c0" + integrity sha512-D1iCvSk2k7PmzlDu6Hl6KfvfrH91CKxMmQP3ZC1q5C2QJf+EyjUhCSncpfSmOU9KkCD42WAD6q91Vhw25cA+kg== + +"@angular/forms@^9.0.0-rc.6": + version "9.0.0-rc.6" + resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-9.0.0-rc.6.tgz#ed8f2c8dbf7cce07dd099cdc20cb723c4eb2f1e1" + integrity sha512-3bJ39h9pIMbJWcmiFe97xh0l8ff8sD/4CMJ83owoVa34fcoRFg0M7WJA513QHugKSJjs2FQYYrsw4KXZ9Po0QQ== + +"@angular/material@^9.0.0-rc.5": + version "9.0.0-rc.5" + resolved "https://registry.yarnpkg.com/@angular/material/-/material-9.0.0-rc.5.tgz#323cdfe2e72fd35de8a8cac131524c1c9224a217" + integrity sha512-GINyl3H67xZzBSc4murQt9Xi45+lJM4hN9K68CzSm2Qrim9YRCjyRKhg/iCds1xby5AUNycOG2NEjp55RD058w== + +"@angular/platform-browser-dynamic@^9.0.0-rc.6": + version "9.0.0-rc.6" + resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-9.0.0-rc.6.tgz#1315f57c986bb161fbb7ba5126e7a320d0eda9cd" + integrity sha512-PUvde62TZ6aXgUZuQQm6xawxlHex8gcY6Pyfa+yluJf5qeirkZDXCrhvlGLFi3QNmDnLVslHsiFOL7FFpWRsYg== + +"@angular/platform-browser@^9.0.0-rc.6": + version "9.0.0-rc.6" + resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-9.0.0-rc.6.tgz#bd3a4befb015ddc1462654def7304c1207010ec6" + integrity sha512-kn4l44CbBPUd7pNQEwjdvD+wqzmwffzNdpHzmfiQTSoNKCWJk23dQrky+8P63EF+4sy3C4rZpUEifsCv0+RPNA== + +"@angular/platform-server@^9.0.0-rc.6": + version "9.0.0-rc.6" + resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-9.0.0-rc.6.tgz#9b96451c505b603876c09a96a23aad71f134ae8f" + integrity sha512-K8gWWcGxS5cNY70Xj4qdRiDnA7KHs6suGHwl0eg/Dfp6cCyenQ/c/DKnZddfRCgIkVM2eJZARFqLh2GebjU5gg== dependencies: domino "^2.1.2" - tslib "^1.9.0" xhr2 "^0.1.4" -"@angular/router@^8.0.0-rc.5": - version "8.2.13" - resolved "https://registry.yarnpkg.com/@angular/router/-/router-8.2.13.tgz#fad64a7147e2863d8332aaaa08b3bda9e3dcdd51" - integrity sha512-9CqnachtdASnEmRMtrG/R3c5nDCjjlCU4n0W/xt5+LlveyuUVvAT/CFUC38km4Df3lIvqap8mSpxzGaEzCL+wQ== - dependencies: - tslib "^1.9.0" +"@angular/router@^9.0.0-rc.6": + version "9.0.0-rc.6" + resolved "https://registry.yarnpkg.com/@angular/router/-/router-9.0.0-rc.6.tgz#9ebf92fc6402507890b05f1cfef1356e3bd3832f" + integrity sha512-uYfOE8qpI1Q3LYjoqpiNA1o9+pGEGUwtUmral9d9VKmcRaeZ0PlpreqhNFazdkqcpMWy/cZwl+Sm0qwf09A6NQ== "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": version "7.5.5" @@ -428,10 +407,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.6.tgz#a47240c10d86a9a57bb0c633f0b2e0aea9ce9253" integrity sha512-FjsYUPzEJdGXjwKqSpE0/9QEh6kzhTAeObA54rn6j3rR4C/mzpI9L0KNfoeASSPMMdxIsoJuCLDWcM/rVjIsSA== -"@types/node@^7.10.1": - version "7.10.9" - resolved "https://registry.yarnpkg.com/@types/node/-/node-7.10.9.tgz#4343e3b009f8cf5e1ed685e36097b74b4101e880" - integrity sha512-usSpgoUsRtO5xNV5YEPU8PPnHisFx8u0rokj1BPVn/hDF7zwUDzVLiuKZM38B7z8V2111Fj6kd4rGtQFUZpNOw== +"@types/node@^12.12.17": + version "12.12.17" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.17.tgz#191b71e7f4c325ee0fb23bc4a996477d92b8c39b" + integrity sha512-Is+l3mcHvs47sKy+afn2O1rV4ldZFU7W8101cNlOd+MRbjM4Onida8jSZnJdTe/0Pcf25g9BNIUsuugmE6puHA== "@types/orchestrator@*": version "0.3.2" @@ -8748,11 +8727,6 @@ source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@^0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== - source-map@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" @@ -9626,16 +9600,12 @@ tsconfig@^6.0.0: strip-bom "^3.0.0" strip-json-comments "^2.0.0" -tsickle@^0.35.0: - version "0.35.0" - resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.35.0.tgz#59235df45937c0ec5d072c616c26d2d97fba54b9" - integrity sha512-irsZLX4293YUl9TuwNC5Fy020eLSc4bC3LfKnxnx1oq5wmZD9zSP8qvNNTiwRmf2/rxH+58JINcTARDjuvn+oQ== - dependencies: - minimist "^1.2.0" - mkdirp "^0.5.1" - source-map "^0.7.3" +tsickle@^0.37.1: + version "0.37.1" + resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.37.1.tgz#2f8a87c1b15766e866457bd06fb6c0e0d84eed09" + integrity sha512-0GwgOJEnsmRsrONXCvcbAWY0CvdqF3UugPVoupUpA8Ul0qCPTuqqq0ou/hLqtKZOyyulzCP6MYRjb9/J1g9bJg== -tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: +tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== @@ -9713,10 +9683,10 @@ typescript@~2.7.1: resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836" integrity sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw== -typescript@~3.4.5: - version "3.4.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" - integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== +typescript@~3.6.4: + version "3.6.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" + integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg== uglify-js@3.4.x: version "3.4.10" @@ -10623,7 +10593,7 @@ zip-stream@^1.2.0: lodash "^4.8.0" readable-stream "^2.0.0" -zone.js@~0.9.1: - version "0.9.1" - resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.9.1.tgz#e37c6e5c54c13fae4de26b5ffe8d8e9212da6d9b" - integrity sha512-GkPiJL8jifSrKReKaTZ5jkhrMEgXbXYC+IPo1iquBjayRa0q86w3Dipjn8b415jpitMExe9lV8iTsv8tk3DGag== +zone.js@~0.10.2: + version "0.10.2" + resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.10.2.tgz#67ca084b3116fc33fc40435e0d5ea40a207e392e" + integrity sha512-UAYfiuvxLN4oyuqhJwd21Uxb4CNawrq6fPS/05Su5L4G+1TN+HVDJMUHNMobVQDFJRir2cLAODXwluaOKB7HFg==