From 1e7f193cef410bd00fb3085de08056ee32f11935 Mon Sep 17 00:00:00 2001 From: tim_curchod Date: Tue, 31 Aug 2021 08:34:56 +1000 Subject: [PATCH] #6 added trendy app and ssr server that does not work --- README.md | 6 +- apps/trendy-e2e/.eslintrc.json | 20 ++ apps/trendy-e2e/cypress.json | 12 + apps/trendy-e2e/src/fixtures/example.json | 4 + apps/trendy-e2e/src/integration/app.spec.ts | 13 + apps/trendy-e2e/src/plugins/index.js | 22 ++ apps/trendy-e2e/src/support/app.po.ts | 1 + apps/trendy-e2e/src/support/commands.ts | 33 +++ apps/trendy-e2e/src/support/index.ts | 17 ++ apps/trendy-e2e/tsconfig.e2e.json | 10 + apps/trendy-e2e/tsconfig.json | 10 + apps/trendy-ssr/.eslintrc.json | 18 ++ apps/trendy-ssr/jest.config.js | 15 ++ apps/trendy-ssr/src/app/.gitkeep | 0 apps/trendy-ssr/src/assets/.gitkeep | 0 .../src/environments/environment.prod.ts | 3 + .../src/environments/environment.ts | 3 + apps/trendy-ssr/src/main.ts | 43 +++ apps/trendy-ssr/tsconfig.app.json | 10 + apps/trendy-ssr/tsconfig.json | 13 + apps/trendy-ssr/tsconfig.spec.json | 9 + apps/trendy/.browserslistrc | 17 ++ apps/trendy/.eslintrc.json | 29 +++ apps/trendy/jest.config.js | 23 ++ apps/trendy/src/app/app.component.html | 113 ++++++++ apps/trendy/src/app/app.component.scss | 133 ++++++++++ apps/trendy/src/app/app.component.spec.ts | 33 +++ apps/trendy/src/app/app.component.ts | 10 + apps/trendy/src/app/app.module.ts | 16 ++ apps/trendy/src/app/app.server.module.ts | 14 + apps/trendy/src/assets/.gitkeep | 0 .../src/environments/environment.prod.ts | 3 + apps/trendy/src/environments/environment.ts | 16 ++ apps/trendy/src/favicon.ico | Bin 0 -> 15086 bytes apps/trendy/src/index.html | 13 + apps/trendy/src/main.server.ts | 19 ++ apps/trendy/src/main.ts | 15 ++ apps/trendy/src/polyfills.ts | 64 +++++ apps/trendy/src/styles.scss | 1 + apps/trendy/src/test-setup.ts | 1 + apps/trendy/tsconfig.app.json | 9 + apps/trendy/tsconfig.editor.json | 7 + apps/trendy/tsconfig.json | 16 ++ apps/trendy/tsconfig.server.json | 17 ++ apps/trendy/tsconfig.spec.json | 10 + docs/trendy-client.md | 156 ++++++++++- jest.config.js | 1 + nx.json | 10 + package-lock.json | 230 +++++++++++----- package.json | 3 + workspace.json | 245 +++++++++++++++--- 51 files changed, 1368 insertions(+), 118 deletions(-) create mode 100644 apps/trendy-e2e/.eslintrc.json create mode 100644 apps/trendy-e2e/cypress.json create mode 100644 apps/trendy-e2e/src/fixtures/example.json create mode 100644 apps/trendy-e2e/src/integration/app.spec.ts create mode 100644 apps/trendy-e2e/src/plugins/index.js create mode 100644 apps/trendy-e2e/src/support/app.po.ts create mode 100644 apps/trendy-e2e/src/support/commands.ts create mode 100644 apps/trendy-e2e/src/support/index.ts create mode 100644 apps/trendy-e2e/tsconfig.e2e.json create mode 100644 apps/trendy-e2e/tsconfig.json create mode 100644 apps/trendy-ssr/.eslintrc.json create mode 100644 apps/trendy-ssr/jest.config.js create mode 100644 apps/trendy-ssr/src/app/.gitkeep create mode 100644 apps/trendy-ssr/src/assets/.gitkeep create mode 100644 apps/trendy-ssr/src/environments/environment.prod.ts create mode 100644 apps/trendy-ssr/src/environments/environment.ts create mode 100644 apps/trendy-ssr/src/main.ts create mode 100644 apps/trendy-ssr/tsconfig.app.json create mode 100644 apps/trendy-ssr/tsconfig.json create mode 100644 apps/trendy-ssr/tsconfig.spec.json create mode 100644 apps/trendy/.browserslistrc create mode 100644 apps/trendy/.eslintrc.json create mode 100644 apps/trendy/jest.config.js create mode 100644 apps/trendy/src/app/app.component.html create mode 100644 apps/trendy/src/app/app.component.scss create mode 100644 apps/trendy/src/app/app.component.spec.ts create mode 100644 apps/trendy/src/app/app.component.ts create mode 100644 apps/trendy/src/app/app.module.ts create mode 100644 apps/trendy/src/app/app.server.module.ts create mode 100644 apps/trendy/src/assets/.gitkeep create mode 100644 apps/trendy/src/environments/environment.prod.ts create mode 100644 apps/trendy/src/environments/environment.ts create mode 100644 apps/trendy/src/favicon.ico create mode 100644 apps/trendy/src/index.html create mode 100644 apps/trendy/src/main.server.ts create mode 100644 apps/trendy/src/main.ts create mode 100644 apps/trendy/src/polyfills.ts create mode 100644 apps/trendy/src/styles.scss create mode 100644 apps/trendy/src/test-setup.ts create mode 100644 apps/trendy/tsconfig.app.json create mode 100644 apps/trendy/tsconfig.editor.json create mode 100644 apps/trendy/tsconfig.json create mode 100644 apps/trendy/tsconfig.server.json create mode 100644 apps/trendy/tsconfig.spec.json diff --git a/README.md b/README.md index 3260e96..a0f8d9a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,11 @@ nx build --prod customer-portal --stats-json npm run bundle-report-customer-portal ``` -http://localhost:3333/api +A trend search for the nest-demo looks like this: + +```url +http://localhost:3333/api/images/Christina%20Applegate +``` Run the server and then the customer-portal and the app will be served at: http://localhost:4200 diff --git a/apps/trendy-e2e/.eslintrc.json b/apps/trendy-e2e/.eslintrc.json new file mode 100644 index 0000000..f64bf8e --- /dev/null +++ b/apps/trendy-e2e/.eslintrc.json @@ -0,0 +1,20 @@ +{ + "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "parserOptions": { + "project": "apps/trendy-e2e/tsconfig.*?.json" + }, + "rules": {} + }, + { + "files": ["src/plugins/index.js"], + "rules": { + "@typescript-eslint/no-var-requires": "off", + "no-undef": "off" + } + } + ] +} diff --git a/apps/trendy-e2e/cypress.json b/apps/trendy-e2e/cypress.json new file mode 100644 index 0000000..3d44b2e --- /dev/null +++ b/apps/trendy-e2e/cypress.json @@ -0,0 +1,12 @@ +{ + "fileServerFolder": ".", + "fixturesFolder": "./src/fixtures", + "integrationFolder": "./src/integration", + "modifyObstructiveCode": false, + "pluginsFile": "./src/plugins/index", + "supportFile": "./src/support/index.ts", + "video": true, + "videosFolder": "../../dist/cypress/apps/trendy-e2e/videos", + "screenshotsFolder": "../../dist/cypress/apps/trendy-e2e/screenshots", + "chromeWebSecurity": false +} diff --git a/apps/trendy-e2e/src/fixtures/example.json b/apps/trendy-e2e/src/fixtures/example.json new file mode 100644 index 0000000..294cbed --- /dev/null +++ b/apps/trendy-e2e/src/fixtures/example.json @@ -0,0 +1,4 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io" +} diff --git a/apps/trendy-e2e/src/integration/app.spec.ts b/apps/trendy-e2e/src/integration/app.spec.ts new file mode 100644 index 0000000..1c392f6 --- /dev/null +++ b/apps/trendy-e2e/src/integration/app.spec.ts @@ -0,0 +1,13 @@ +import { getGreeting } from '../support/app.po'; + +describe('trendy', () => { + beforeEach(() => cy.visit('/')); + + it('should display welcome message', () => { + // Custom command example, see `../support/commands.ts` file + cy.login('my-email@something.com', 'myPassword'); + + // Function helper example, see `../support/app.po.ts` file + getGreeting().contains('Welcome to trendy!'); + }); +}); diff --git a/apps/trendy-e2e/src/plugins/index.js b/apps/trendy-e2e/src/plugins/index.js new file mode 100644 index 0000000..9067e75 --- /dev/null +++ b/apps/trendy-e2e/src/plugins/index.js @@ -0,0 +1,22 @@ +// *********************************************************** +// This example plugins/index.js can be used to load plugins +// +// You can change the location of this file or turn off loading +// the plugins file with the 'pluginsFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/plugins-guide +// *********************************************************** + +// This function is called when a project is opened or re-opened (e.g. due to +// the project's config changing) + +const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor'); + +module.exports = (on, config) => { + // `on` is used to hook into various events Cypress emits + // `config` is the resolved Cypress config + + // Preprocess Typescript file using Nx helper + on('file:preprocessor', preprocessTypescript(config)); +}; diff --git a/apps/trendy-e2e/src/support/app.po.ts b/apps/trendy-e2e/src/support/app.po.ts new file mode 100644 index 0000000..3293424 --- /dev/null +++ b/apps/trendy-e2e/src/support/app.po.ts @@ -0,0 +1 @@ +export const getGreeting = () => cy.get('h1'); diff --git a/apps/trendy-e2e/src/support/commands.ts b/apps/trendy-e2e/src/support/commands.ts new file mode 100644 index 0000000..310f1fa --- /dev/null +++ b/apps/trendy-e2e/src/support/commands.ts @@ -0,0 +1,33 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** + +// eslint-disable-next-line @typescript-eslint/no-namespace +declare namespace Cypress { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + interface Chainable { + login(email: string, password: string): void; + } +} +// +// -- This is a parent command -- +Cypress.Commands.add('login', (email, password) => { + console.log('Custom command example: Login', email, password); +}); +// +// -- This is a child command -- +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/apps/trendy-e2e/src/support/index.ts b/apps/trendy-e2e/src/support/index.ts new file mode 100644 index 0000000..3d469a6 --- /dev/null +++ b/apps/trendy-e2e/src/support/index.ts @@ -0,0 +1,17 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands'; diff --git a/apps/trendy-e2e/tsconfig.e2e.json b/apps/trendy-e2e/tsconfig.e2e.json new file mode 100644 index 0000000..9dc3660 --- /dev/null +++ b/apps/trendy-e2e/tsconfig.e2e.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "sourceMap": false, + "outDir": "../../dist/out-tsc", + "allowJs": true, + "types": ["cypress", "node"] + }, + "include": ["src/**/*.ts", "src/**/*.js"] +} diff --git a/apps/trendy-e2e/tsconfig.json b/apps/trendy-e2e/tsconfig.json new file mode 100644 index 0000000..08841a7 --- /dev/null +++ b/apps/trendy-e2e/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.e2e.json" + } + ] +} diff --git a/apps/trendy-ssr/.eslintrc.json b/apps/trendy-ssr/.eslintrc.json new file mode 100644 index 0000000..9d9c0db --- /dev/null +++ b/apps/trendy-ssr/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/apps/trendy-ssr/jest.config.js b/apps/trendy-ssr/jest.config.js new file mode 100644 index 0000000..4c0420f --- /dev/null +++ b/apps/trendy-ssr/jest.config.js @@ -0,0 +1,15 @@ +module.exports = { + displayName: 'trendy-ssr', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/apps/trendy-ssr', +}; diff --git a/apps/trendy-ssr/src/app/.gitkeep b/apps/trendy-ssr/src/app/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/apps/trendy-ssr/src/assets/.gitkeep b/apps/trendy-ssr/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/apps/trendy-ssr/src/environments/environment.prod.ts b/apps/trendy-ssr/src/environments/environment.prod.ts new file mode 100644 index 0000000..c966979 --- /dev/null +++ b/apps/trendy-ssr/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true, +}; diff --git a/apps/trendy-ssr/src/environments/environment.ts b/apps/trendy-ssr/src/environments/environment.ts new file mode 100644 index 0000000..a20cfe5 --- /dev/null +++ b/apps/trendy-ssr/src/environments/environment.ts @@ -0,0 +1,3 @@ +export const environment = { + production: false, +}; diff --git a/apps/trendy-ssr/src/main.ts b/apps/trendy-ssr/src/main.ts new file mode 100644 index 0000000..64bdbbd --- /dev/null +++ b/apps/trendy-ssr/src/main.ts @@ -0,0 +1,43 @@ +import 'zone.js/dist/zone-node'; +import { enableProdMode } from '@angular/core'; +// Express Engine +import { ngExpressEngine } from '@nguniversal/express-engine'; +// Import module map for lazy loading +import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader'; +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/apps/trendy'); +// * NOTE :: leave this as require() since this file is built Dynamically from webpack +import { AppServerModuleNgFactory, LAZY_MODULE_MAP } from '../../../dist/trendy/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) => { }); +// Server 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}`); +}); diff --git a/apps/trendy-ssr/tsconfig.app.json b/apps/trendy-ssr/tsconfig.app.json new file mode 100644 index 0000000..b623116 --- /dev/null +++ b/apps/trendy-ssr/tsconfig.app.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["node"] + }, + "exclude": ["**/*.spec.ts"], + "include": ["**/*.ts"] +} diff --git a/apps/trendy-ssr/tsconfig.json b/apps/trendy-ssr/tsconfig.json new file mode 100644 index 0000000..63dbe35 --- /dev/null +++ b/apps/trendy-ssr/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/apps/trendy-ssr/tsconfig.spec.json b/apps/trendy-ssr/tsconfig.spec.json new file mode 100644 index 0000000..29efa43 --- /dev/null +++ b/apps/trendy-ssr/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": ["**/*.spec.ts", "**/*.d.ts"] +} diff --git a/apps/trendy/.browserslistrc b/apps/trendy/.browserslistrc new file mode 100644 index 0000000..427441d --- /dev/null +++ b/apps/trendy/.browserslistrc @@ -0,0 +1,17 @@ +# 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 + +# For the full list of supported browsers by the Angular framework, please see: +# https://angular.io/guide/browser-support + +# You can see what browsers were selected by your queries by running: +# npx browserslist + +last 1 Chrome version +last 1 Firefox version +last 2 Edge major versions +last 2 Safari major versions +last 2 iOS major versions +Firefox ESR +not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. diff --git a/apps/trendy/.eslintrc.json b/apps/trendy/.eslintrc.json new file mode 100644 index 0000000..7723950 --- /dev/null +++ b/apps/trendy/.eslintrc.json @@ -0,0 +1,29 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "extends": [ + "plugin:@nrwl/nx/angular", + "plugin:@angular-eslint/template/process-inline-templates" + ], + "parserOptions": { "project": ["apps/trendy/tsconfig.*?.json"] }, + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { "type": "attribute", "prefix": "demoApp", "style": "camelCase" } + ], + "@angular-eslint/component-selector": [ + "error", + { "type": "element", "prefix": "demo-app", "style": "kebab-case" } + ] + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nrwl/nx/angular-template"], + "rules": {} + } + ] +} diff --git a/apps/trendy/jest.config.js b/apps/trendy/jest.config.js new file mode 100644 index 0000000..8738ca5 --- /dev/null +++ b/apps/trendy/jest.config.js @@ -0,0 +1,23 @@ +module.exports = { + displayName: 'trendy', + preset: '../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$', + astTransformers: { + before: [ + 'jest-preset-angular/build/InlineFilesTransformer', + 'jest-preset-angular/build/StripStylesTransformer', + ], + }, + }, + }, + coverageDirectory: '../../coverage/apps/trendy', + snapshotSerializers: [ + 'jest-preset-angular/build/serializers/no-ng-attributes', + 'jest-preset-angular/build/serializers/ng-snapshot', + 'jest-preset-angular/build/serializers/html-comment', + ], +}; diff --git a/apps/trendy/src/app/app.component.html b/apps/trendy/src/app/app.component.html new file mode 100644 index 0000000..970f2e4 --- /dev/null +++ b/apps/trendy/src/app/app.component.html @@ -0,0 +1,113 @@ +
+ Nx logo +

Welcome to {{ title }}!

+
+
+

Resources & Tools

+

Thank you for using and showing some ♥ for Nx.

+ +

Here are some links to help you get started.

+ +

Next Steps

+

Here are some things you can do with Nx.

+
+ Add UI library +
+# Generate UI lib
+ng g @nrwl/angular:lib ui
+
+# Add a component
+ng g @nrwl/angular:component xyz --project ui
+
+
+ View dependency graph +
nx dep-graph
+
+
+ Run affected commands +
+# see what's been affected by changes
+ng affected:dep-graph
+
+# run tests for current changes
+ng affected:test
+
+# run e2e tests for current changes
+ng affected:e2e
+
+
+
+ + diff --git a/apps/trendy/src/app/app.component.scss b/apps/trendy/src/app/app.component.scss new file mode 100644 index 0000000..f222adf --- /dev/null +++ b/apps/trendy/src/app/app.component.scss @@ -0,0 +1,133 @@ +/* + * Remove template code below + */ +:host { + display: block; + font-family: sans-serif; + min-width: 300px; + max-width: 600px; + margin: 50px auto; +} + +.gutter-left { + margin-left: 9px; +} + +.col-span-2 { + grid-column: span 2; +} + +.flex { + display: flex; + align-items: center; + justify-content: center; +} + +header { + background-color: #143055; + color: white; + padding: 5px; + border-radius: 3px; +} + +main { + padding: 0 36px; +} + +p { + text-align: center; +} + +h1 { + text-align: center; + margin-left: 18px; + font-size: 24px; +} + +h2 { + text-align: center; + font-size: 20px; + margin: 40px 0 10px 0; +} + +.resources { + text-align: center; + list-style: none; + padding: 0; + display: grid; + grid-gap: 9px; + grid-template-columns: 1fr 1fr; +} + +.resource { + color: #0094ba; + height: 36px; + background-color: rgba(0, 0, 0, 0); + border: 1px solid rgba(0, 0, 0, 0.12); + border-radius: 4px; + padding: 3px 9px; + text-decoration: none; +} + +.resource:hover { + background-color: rgba(68, 138, 255, 0.04); +} + +pre { + padding: 9px; + border-radius: 4px; + background-color: black; + color: #eee; +} + +details { + border-radius: 4px; + color: #333; + background-color: rgba(0, 0, 0, 0); + border: 1px solid rgba(0, 0, 0, 0.12); + padding: 3px 9px; + margin-bottom: 9px; +} + +summary { + cursor: pointer; + outline: none; + height: 36px; + line-height: 36px; +} + +.github-star-container { + margin-top: 12px; + line-height: 20px; +} + +.github-star-container a { + display: flex; + align-items: center; + text-decoration: none; + color: #333; +} + +.github-star-badge { + color: #24292e; + display: flex; + align-items: center; + font-size: 12px; + padding: 3px 10px; + border: 1px solid rgba(27, 31, 35, 0.2); + border-radius: 3px; + background-image: linear-gradient(-180deg, #fafbfc, #eff3f6 90%); + margin-left: 4px; + font-weight: 600; +} + +.github-star-badge:hover { + background-image: linear-gradient(-180deg, #f0f3f6, #e6ebf1 90%); + border-color: rgba(27, 31, 35, 0.35); + background-position: -0.5em; +} +.github-star-badge .material-icons { + height: 16px; + width: 16px; + margin-right: 4px; +} diff --git a/apps/trendy/src/app/app.component.spec.ts b/apps/trendy/src/app/app.component.spec.ts new file mode 100644 index 0000000..172f21d --- /dev/null +++ b/apps/trendy/src/app/app.component.spec.ts @@ -0,0 +1,33 @@ +import { TestBed } from '@angular/core/testing'; +import { AppComponent } from './app.component'; +import { RouterTestingModule } from '@angular/router/testing'; + +describe('AppComponent', () => { + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [RouterTestingModule], + declarations: [AppComponent], + }).compileComponents(); + }); + + it('should create the app', () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app).toBeTruthy(); + }); + + it(`should have as title 'trendy'`, () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app.title).toEqual('trendy'); + }); + + it('should render title', () => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.nativeElement; + expect(compiled.querySelector('h1').textContent).toContain( + 'Welcome to trendy!' + ); + }); +}); diff --git a/apps/trendy/src/app/app.component.ts b/apps/trendy/src/app/app.component.ts new file mode 100644 index 0000000..0ed7ab4 --- /dev/null +++ b/apps/trendy/src/app/app.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'demo-app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.scss'], +}) +export class AppComponent { + title = 'trendy'; +} diff --git a/apps/trendy/src/app/app.module.ts b/apps/trendy/src/app/app.module.ts new file mode 100644 index 0000000..95da4ef --- /dev/null +++ b/apps/trendy/src/app/app.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; + +import { AppComponent } from './app.component'; +import { RouterModule } from '@angular/router'; + +@NgModule({ + declarations: [AppComponent], + imports: [ + BrowserModule.withServerTransition({ appId: 'serverApp' }), + RouterModule.forRoot([], { initialNavigation: 'enabled' }), + ], + providers: [], + bootstrap: [AppComponent], +}) +export class AppModule {} diff --git a/apps/trendy/src/app/app.server.module.ts b/apps/trendy/src/app/app.server.module.ts new file mode 100644 index 0000000..795380c --- /dev/null +++ b/apps/trendy/src/app/app.server.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { ServerModule } from '@angular/platform-server'; + +import { AppModule } from './app.module'; +import { AppComponent } from './app.component'; + +@NgModule({ + imports: [ + AppModule, + ServerModule, + ], + bootstrap: [AppComponent], +}) +export class AppServerModule {} diff --git a/apps/trendy/src/assets/.gitkeep b/apps/trendy/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/apps/trendy/src/environments/environment.prod.ts b/apps/trendy/src/environments/environment.prod.ts new file mode 100644 index 0000000..c966979 --- /dev/null +++ b/apps/trendy/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true, +}; diff --git a/apps/trendy/src/environments/environment.ts b/apps/trendy/src/environments/environment.ts new file mode 100644 index 0000000..66998ae --- /dev/null +++ b/apps/trendy/src/environments/environment.ts @@ -0,0 +1,16 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false, +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/plugins/zone-error'; // Included with Angular CLI. diff --git a/apps/trendy/src/favicon.ico b/apps/trendy/src/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..317ebcb2336e0833a22dddf0ab287849f26fda57 GIT binary patch literal 15086 zcmeI332;U^%p|z7g|#(P)qFEA@4f!_@qOK2 z_lJl}!lhL!VT_U|uN7%8B2iKH??xhDa;*`g{yjTFWHvXn;2s{4R7kH|pKGdy(7z!K zgftM+Ku7~24TLlh(!g)gz|foI94G^t2^IO$uvX$3(OR0<_5L2sB)lMAMy|+`xodJ{ z_Uh_1m)~h?a;2W{dmhM;u!YGo=)OdmId_B<%^V^{ovI@y`7^g1_V9G}*f# zNzAtvou}I!W1#{M^@ROc(BZ! z+F!!_aR&Px3_reO(EW+TwlW~tv*2zr?iP7(d~a~yA|@*a89IUke+c472NXM0wiX{- zl`UrZC^1XYyf%1u)-Y)jj9;MZ!SLfd2Hl?o|80Su%Z?To_=^g_Jt0oa#CT*tjx>BI z16wec&AOWNK<#i0Qd=1O$fymLRoUR*%;h@*@v7}wApDl^w*h}!sYq%kw+DKDY)@&A z@9$ULEB3qkR#85`lb8#WZw=@})#kQig9oqy^I$dj&k4jU&^2(M3q{n1AKeGUKPFbr z1^<)aH;VsG@J|B&l>UtU#Ejv3GIqERzYgL@UOAWtW<{p#zy`WyJgpCy8$c_e%wYJL zyGHRRx38)HyjU3y{-4z6)pzb>&Q1pR)B&u01F-|&Gx4EZWK$nkUkOI|(D4UHOXg_- zw{OBf!oWQUn)Pe(=f=nt=zkmdjpO^o8ZZ9o_|4tW1ni+Un9iCW47*-ut$KQOww!;u z`0q)$s6IZO!~9$e_P9X!hqLxu`fpcL|2f^I5d4*a@Dq28;@2271v_N+5HqYZ>x;&O z05*7JT)mUe&%S0@UD)@&8SmQrMtsDfZT;fkdA!r(S=}Oz>iP)w=W508=Rc#nNn7ym z1;42c|8($ALY8#a({%1#IXbWn9-Y|0eDY$_L&j{63?{?AH{);EzcqfydD$@-B`Y3<%IIj7S7rK_N}je^=dEk%JQ4c z!tBdTPE3Tse;oYF>cnrapWq*o)m47X1`~6@(!Y29#>-#8zm&LXrXa(3=7Z)ElaQqj z-#0JJy3Fi(C#Rx(`=VXtJ63E2_bZGCz+QRa{W0e2(m3sI?LOcUBx)~^YCqZ{XEPX)C>G>U4tfqeH8L(3|pQR*zbL1 zT9e~4Tb5p9_G}$y4t`i*4t_Mr9QYvL9C&Ah*}t`q*}S+VYh0M6GxTTSXI)hMpMpIq zD1ImYqJLzbj0}~EpE-aH#VCH_udYEW#`P2zYmi&xSPs_{n6tBj=MY|-XrA;SGA_>y zGtU$?HXm$gYj*!N)_nQ59%lQdXtQZS3*#PC-{iB_sm+ytD*7j`D*k(P&IH2GHT}Eh z5697eQECVIGQAUe#eU2I!yI&%0CP#>%6MWV z@zS!p@+Y1i1b^QuuEF*13CuB zu69dve5k7&Wgb+^s|UB08Dr3u`h@yM0NTj4h7MnHo-4@xmyr7(*4$rpPwsCDZ@2be zRz9V^GnV;;?^Lk%ynzq&K(Aix`mWmW`^152Hoy$CTYVehpD-S1-W^#k#{0^L`V6CN+E z!w+xte;2vu4AmVNEFUOBmrBL>6MK@!O2*N|2=d|Y;oN&A&qv=qKn73lDD zI(+oJAdgv>Yr}8(&@ZuAZE%XUXmX(U!N+Z_sjL<1vjy1R+1IeHt`79fnYdOL{$ci7 z%3f0A*;Zt@ED&Gjm|OFTYBDe%bbo*xXAQsFz+Q`fVBH!N2)kaxN8P$c>sp~QXnv>b zwq=W3&Mtmih7xkR$YA)1Yi?avHNR6C99!u6fh=cL|KQ&PwF!n@ud^n(HNIImHD!h87!i*t?G|p0o+eelJ?B@A64_9%SBhNaJ64EvKgD&%LjLCYnNfc; znj?%*p@*?dq#NqcQFmmX($wms@CSAr9#>hUR^=I+=0B)vvGX%T&#h$kmX*s=^M2E!@N9#m?LhMvz}YB+kd zG~mbP|D(;{s_#;hsKK9lbVK&Lo734x7SIFJ9V_}2$@q?zm^7?*XH94w5Qae{7zOMUF z^?%F%)c1Y)Q?Iy?I>knw*8gYW#ok|2gdS=YYZLiD=CW|Nj;n^x!=S#iJ#`~Ld79+xXpVmUK^B(xO_vO!btA9y7w3L3-0j-y4 z?M-V{%z;JI`bk7yFDcP}OcCd*{Q9S5$iGA7*E1@tfkyjAi!;wP^O71cZ^Ep)qrQ)N z#wqw0_HS;T7x3y|`P==i3hEwK%|>fZ)c&@kgKO1~5<5xBSk?iZV?KI6&i72H6S9A* z=U(*e)EqEs?Oc04)V-~K5AUmh|62H4*`UAtItO$O(q5?6jj+K^oD!04r=6#dsxp?~}{`?&sXn#q2 zGuY~7>O2=!u@@Kfu7q=W*4egu@qPMRM>(eyYyaIE<|j%d=iWNdGsx%c!902v#ngNg z@#U-O_4xN$s_9?(`{>{>7~-6FgWpBpqXb`Ydc3OFL#&I}Irse9F_8R@4zSS*Y*o*B zXL?6*Aw!AfkNCgcr#*yj&p3ZDe2y>v$>FUdKIy_2N~}6AbHc7gA3`6$g@1o|dE>vz z4pl(j9;kyMsjaw}lO?(?Xg%4k!5%^t#@5n=WVc&JRa+XT$~#@rldvN3S1rEpU$;XgxVny7mki3 z-Hh|jUCHrUXuLr!)`w>wgO0N%KTB-1di>cj(x3Bav`7v z3G7EIbU$z>`Nad7Rk_&OT-W{;qg)-GXV-aJT#(ozdmnA~Rq3GQ_3mby(>q6Ocb-RgTUhTN)))x>m&eD;$J5Bg zo&DhY36Yg=J=$Z>t}RJ>o|@hAcwWzN#r(WJ52^g$lh^!63@hh+dR$&_dEGu&^CR*< z!oFqSqO@>xZ*nC2oiOd0eS*F^IL~W-rsrO`J`ej{=ou_q^_(<$&-3f^J z&L^MSYWIe{&pYq&9eGaArA~*kA + + + + Trendy + + + + + + + + diff --git a/apps/trendy/src/main.server.ts b/apps/trendy/src/main.server.ts new file mode 100644 index 0000000..748c5e9 --- /dev/null +++ b/apps/trendy/src/main.server.ts @@ -0,0 +1,19 @@ +/*************************************************************************************************** + * Initialize the server environment - for example, adding DOM built-in types to the global scope. + * + * NOTE: + * This import must come before any imports (direct or transitive) that rely on DOM built-ins being + * available, such as `@angular/elements`. + */ +import '@angular/platform-server/init'; + +import { enableProdMode } from '@angular/core'; + +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +export { AppServerModule } from './app/app.server.module'; +export { renderModule, renderModuleFactory } from '@angular/platform-server'; diff --git a/apps/trendy/src/main.ts b/apps/trendy/src/main.ts new file mode 100644 index 0000000..796338d --- /dev/null +++ b/apps/trendy/src/main.ts @@ -0,0 +1,15 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +document.addEventListener('DOMContentLoaded', () => { + platformBrowserDynamic() + .bootstrapModule(AppModule) + .catch((err) => console.error(err)); +}); diff --git a/apps/trendy/src/polyfills.ts b/apps/trendy/src/polyfills.ts new file mode 100644 index 0000000..8a120c3 --- /dev/null +++ b/apps/trendy/src/polyfills.ts @@ -0,0 +1,64 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** + * IE11 requires the following for NgClass support on SVG elements + */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + * + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + * + * (window as any).__Zone_enable_cross_context_check = true; + * + */ + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js'; // Included with Angular CLI. + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/apps/trendy/src/styles.scss b/apps/trendy/src/styles.scss new file mode 100644 index 0000000..90d4ee0 --- /dev/null +++ b/apps/trendy/src/styles.scss @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/apps/trendy/src/test-setup.ts b/apps/trendy/src/test-setup.ts new file mode 100644 index 0000000..1100b3e --- /dev/null +++ b/apps/trendy/src/test-setup.ts @@ -0,0 +1 @@ +import 'jest-preset-angular/setup-jest'; diff --git a/apps/trendy/tsconfig.app.json b/apps/trendy/tsconfig.app.json new file mode 100644 index 0000000..30b0468 --- /dev/null +++ b/apps/trendy/tsconfig.app.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [] + }, + "files": ["src/main.ts", "src/polyfills.ts"], + "include": ["src/**/*.d.ts"] +} diff --git a/apps/trendy/tsconfig.editor.json b/apps/trendy/tsconfig.editor.json new file mode 100644 index 0000000..20c4afd --- /dev/null +++ b/apps/trendy/tsconfig.editor.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "include": ["**/*.ts"], + "compilerOptions": { + "types": ["jest", "node"] + } +} diff --git a/apps/trendy/tsconfig.json b/apps/trendy/tsconfig.json new file mode 100644 index 0000000..81cb95e --- /dev/null +++ b/apps/trendy/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + }, + { + "path": "./tsconfig.editor.json" + } + ] +} diff --git a/apps/trendy/tsconfig.server.json b/apps/trendy/tsconfig.server.json new file mode 100644 index 0000000..7d82b1f --- /dev/null +++ b/apps/trendy/tsconfig.server.json @@ -0,0 +1,17 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "./tsconfig.app.json", + "compilerOptions": { + "outDir": "../../out-tsc/server", + "target": "es2019", + "types": [ + "node" + ] + }, + "files": [ + "src/main.server.ts" + ], + "angularCompilerOptions": { + "entryModule": "./src/app/app.server.module#AppServerModule" + } +} diff --git a/apps/trendy/tsconfig.spec.json b/apps/trendy/tsconfig.spec.json new file mode 100644 index 0000000..cfff29a --- /dev/null +++ b/apps/trendy/tsconfig.spec.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["**/*.spec.ts", "**/*.d.ts"] +} diff --git a/docs/trendy-client.md b/docs/trendy-client.md index 642d2af..0fed097 100644 --- a/docs/trendy-client.md +++ b/docs/trendy-client.md @@ -58,7 +58,7 @@ nx generate @nrwl/angular:app customer-portal --routing Going with this: -```hs +```sh nx generate @nrwl/angular:app trendy --routing ``` @@ -67,26 +67,166 @@ This brings up the difference between CamelCase or snake-case (also called kebab What is the Angular Express Engine? It's for SSR. Don't overthink it. There is a lot to get through. ```sh -npx ng add @nguniversal/express-engine --clientProject my-app +npx ng add @nguniversal/express-engine --clientProject trendy +``` + +This would be the nx method? + +```sh +nx add @nguniversal/express-engine --clientProject my-app +``` + +[This article](https://blog.nrwl.io/nx-workspace-schematics-server-side-rendering-ssr-with-angular-universal-afc04ead55) by +Benjamin Cabanes shows using a specific schematic for it. + +```sh +yarn add @nguniversal/express-engine @nguniversal/module-map-ngfactory-loader ``` -Step 4: “apps” was dropped from the path. We will add that back in +```sh +ng generate @schematics/angular:universal --clientProject=tuskdesk +``` + +The second article includes provideModuleMap. This is used for the server which will serve the app. Are we serving the app? That remains to be seen? I thought NodeJS was not suited for serving large things like an Angular app, but only for small API requests? + +The official [docs](https://angular.io/start/start-deployment) say: + +*Copy the contents of the dist/my-project-name folder to your web server. Because these files are static, you can host them on any web server capable of serving files; such as Node.js, Java, .NET, or any backend such as Firebase, Google Cloud, or App Engine. For more information, see Building & Serving and Deployment.* + +There are three links to Google there. I guess they developed Angular, so that makes sense. But we want the free option. How about the Heroku solution? But wait, we are trying to optimize for a Google image search. Would they give a slight edge to hosting on their server? Good point. I might have a use for that Google Cloud account I created and then walked away from when I saw the monthly cost of a ML backed Jupyter notebook instance. + +There is actually a [community plugin](https://www.npmjs.com/package/@simondotm/nx-firebase) for firebase. It should work for hosting. I'm sorry it's not an official plugin, but I get that they can't support everything. + +The is also [Nxtend](https://nxtend.dev/docs/firebase/getting-started/) which looks more mature, given they have Ionic/Capacitor plugins and a website. + +Here are the [docs for firebase hosting](https://firebase.google.com/docs/hosting). I'm thinking this will tick a box for Google, and there are lots of boxes to tick for SEO. + +So going with this for now: + +```sh +npm i @nguniversal/express-engine @nguniversal/module-map-ngfactory-loader +``` + +Next: + +```sh +nx generate @schematics/angular:universal --clientProject=trendy +``` + +*'clientProject' is not found in schema* + +Using ng instead of nx results in this error: + +*The generate command requires to be run in an Angular project, but a project definition could not be found.* + +Maybe it should be --project=trendy? Seems to work: + +```sh +PS C:\Users\timof\repos\satisfactory> nx generate @schematics/angular:universal --project=trendy +✔ Packages installed successfully. +CREATE apps/trendy/src/main.server.ts +CREATE apps/trendy/src/app/app.server.module.ts +CREATE apps/trendy/tsconfig.server.json +UPDATE package.json +UPDATE workspace.json +UPDATE apps/trendy/src/main.ts +UPDATE apps/trendy/src/app/app.module.ts +``` -Step 5: Inside of the generated server.ts file (apps > my-app > server.ts) we need to add “apps” to the distFolder  +#### Updating build paths -Step 5: +There is no angular.json in our project, as we have a generic workspace.json. + +```json +"outputPath": "dist/apps/trendy/browser", +``` + +Do we really need the "Creating our NodeJS server" from the Helgevold article? How about just the Christensen? Lets try without it using the extra node server. + +There are some differences in the different approaches. npm run build:ssr +npm run serve:ssr + +You can now view your app in a browser at http://localhost:4000/ + +From the Benjamin Cabanes article: + +nx run trendy:build --configuration=production -This command will start up the server. +nx run trendy:server --configuration=production +The Christensen has this: + +```sh npm run serve:ssr +npm ERR! missing script: serve:ssr +``` + +In "Step 5: Update server distFolder" Inside of the generated server.ts file (apps > my-app > server.ts) we have no such file. There is a main.server.ts, but it looks nothing like the one in the article. + +So, back to another server. + +nx generate @nrwl/node:application trendy-ssr + +The code shown has this issue: + +```err +Require statement not part of import statement.eslint@typescript-eslint/no-var-requires +var require: NodeRequire +(id: string) => any +``` + +Changed the require statement to an import thanks to the quick fix suggestion: + +```js +import { AppServerModuleNgFactory, LAZY_MODULE_MAP } from '../../../dist/trendy/server/main'; +``` + +Then the workflow: + +nx run trendy:build --configuration=production +nx run trendy:server --configuration=production +nx run trendy-ssr:serve + +```txt +ERROR in ./apps/trendy-ssr/src/main.ts +Module not found: Error: Can't resolve '../../../dist/apps/trendy/server/main' in 'C:\Users\timof\repos\satisfactory\apps\trendy-ssr\src' +There was an error with the build. See above. +``` -view your app in a browser at  http://localhost:4000/ +After fixing that require situation, this is a bigger error: + +```err +ERROR in ./dist/trendy/server/main.js 4527:84 +Module parse failed: 'with' in strict mode (4527:84) +File was processed with these loaders: + * ./node_modules/ts-loader/index.js +You may need an additional loader to handle the result of these loaders. +| return !0; +| } while (test.sel); return !1; }; +> }, 2422: module => { module.exports = { Window_run: function _run(code, file) { with (file && (code += "\n//@ sourceURL=" + file), this) +| eval(code); }, EventHandlerBuilder_build: function build() { try { +| with (this.document.defaultView || Object.create(null)) +There was an error with the build. See above. +``` + +*change the module target to commonjs Set the module to commonjs in your tsconfig.server.json, this however has the drawback of disabling lazy-loading on the server.* + +```err +> nx run trendy:server:production +error TS6046: Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext'. +``` + +*set domino as an external dependency. In angular.json under server.options add "externalDependencies": ['domino'], this will cause domino not to be included in your server bundle, and it will be required during runtime.* + +What is domino? And we have no server.options. ### Deploy -https://www.thisdot.co/blog/deploying-nx-workspace-based-angular-and-nestjs-apps-to-heroku +The first idea was to deploy to Heroku with [this guide](https://www.thisdot.co/blog/deploying-nx-workspace-based-angular-and-nestjs-apps-to-heroku). But then realizing that Google might like it more if we used Firebase (still free hopefully) then [this Nxtend doc page is the guide for that](https://nxtend.dev/docs/firebase/getting-started/) + + ### AsSense diff --git a/jest.config.js b/jest.config.js index 651e535..110018a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,5 +8,6 @@ module.exports = { '/libs/products', '/apps/nest-demo', '/libs/trends', + '/apps/trendy', ], }; diff --git a/nx.json b/nx.json index 0602c79..1cbd2a3 100644 --- a/nx.json +++ b/nx.json @@ -46,6 +46,16 @@ }, "trends": { "tags": [] + }, + "trendy": { + "tags": [] + }, + "trendy-e2e": { + "tags": [], + "implicitDependencies": ["trendy"] + }, + "trendy-ssr": { + "tags": [] } } } diff --git a/package-lock.json b/package-lock.json index 9c7a292..8a68713 100644 --- a/package-lock.json +++ b/package-lock.json @@ -646,6 +646,16 @@ "tslib": "^2.1.0" } }, + "@angular/platform-server": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/@angular/platform-server/-/platform-server-12.0.0.tgz", + "integrity": "sha512-8q87lUVglqGLVa6ttR0SkSUK3p2+1z8wAoAxg9iLbqXo8c9JJ9Qdo8/rNThcqROHq6X5Q2p7T45GpDipNq2VkQ==", + "requires": { + "domino": "^2.1.2", + "tslib": "^2.1.0", + "xhr2": "^0.2.0" + } + }, "@angular/router": { "version": "12.0.0", "resolved": "https://registry.npmjs.org/@angular/router/-/router-12.0.0.tgz", @@ -2472,6 +2482,108 @@ } } }, + "@nguniversal/common": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/@nguniversal/common/-/common-12.1.0.tgz", + "integrity": "sha512-3sclweTDdgrcpuvW6MJMxwsF/bnrpCIgn9BWECwefOsuBnN7OYGzqjuKPKIZQJaw+wvkGagv/GBAoq98IoCR4A==", + "requires": { + "critters": "0.0.10", + "jsdom": "16.6.0", + "tslib": "^2.3.0" + }, + "dependencies": { + "acorn": { + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.4.1.tgz", + "integrity": "sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==" + }, + "form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "jsdom": { + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.6.0.tgz", + "integrity": "sha512-Ty1vmF4NHJkolaEmdjtxTfSfkdb8Ywarwf63f+F8/mDD1uLSSWDxDuMiZxiPhwunLrn9LOSVItWj4bLYsLN3Dg==", + "requires": { + "abab": "^2.0.5", + "acorn": "^8.2.4", + "acorn-globals": "^6.0.0", + "cssom": "^0.4.4", + "cssstyle": "^2.3.0", + "data-urls": "^2.0.0", + "decimal.js": "^10.2.1", + "domexception": "^2.0.1", + "escodegen": "^2.0.0", + "form-data": "^3.0.0", + "html-encoding-sniffer": "^2.0.1", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.0", + "parse5": "6.0.1", + "saxes": "^5.0.1", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.0.0", + "w3c-hr-time": "^1.0.2", + "w3c-xmlserializer": "^2.0.0", + "webidl-conversions": "^6.1.0", + "whatwg-encoding": "^1.0.5", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.5.0", + "ws": "^7.4.5", + "xml-name-validator": "^3.0.0" + } + }, + "tough-cookie": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", + "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.1.2" + } + }, + "tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + } + } + }, + "@nguniversal/express-engine": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/@nguniversal/express-engine/-/express-engine-12.1.0.tgz", + "integrity": "sha512-rgJ+ZlToX2wC7u8H5kIlT0lL3HNE7Awdazoc0HbeVV9xlCKBye29ndTAON6JZEn+8tIVAN0sZioziBZED/Yrvg==", + "requires": { + "@nguniversal/common": "12.1.0", + "tslib": "^2.3.0" + }, + "dependencies": { + "tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + } + } + }, + "@nguniversal/module-map-ngfactory-loader": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@nguniversal/module-map-ngfactory-loader/-/module-map-ngfactory-loader-8.2.6.tgz", + "integrity": "sha512-YcxXSrDZt6iDR+YbesJvprNpHd1nRLeThJwAFlcwvK/GVGSyKeWV6eqk3bRkBkgkw8OwaG/4lOQ4aofxQw+13w==" + }, "@nodelib/fs.scandir": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", @@ -3586,6 +3698,11 @@ "defer-to-connect": "^1.0.1" } }, + "@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==" + }, "@trysound/sax": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.1.1.tgz", @@ -4268,8 +4385,7 @@ "abab": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz", - "integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==", - "dev": true + "integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==" }, "accepts": { "version": "1.3.7", @@ -4283,14 +4399,12 @@ "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" }, "acorn-globals": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz", "integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==", - "dev": true, "requires": { "acorn": "^7.1.1", "acorn-walk": "^7.1.1" @@ -4305,8 +4419,7 @@ "acorn-walk": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", - "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", - "dev": true + "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==" }, "adjust-sourcemap-loader": { "version": "4.0.0", @@ -4335,7 +4448,6 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, "requires": { "debug": "4" } @@ -5194,8 +5306,7 @@ "browser-process-hrtime": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true + "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==" }, "browserify-aes": { "version": "1.2.0", @@ -6275,7 +6386,6 @@ "version": "0.0.10", "resolved": "https://registry.npmjs.org/critters/-/critters-0.0.10.tgz", "integrity": "sha512-p5VKhP1803+f+0Jq5P03w1SbiHtpAKm+1EpJHkiPxQPq0Vu9QLZHviJ02GRrWi0dlcJqrmzMWInbwp4d22RsGw==", - "dev": true, "requires": { "chalk": "^4.1.0", "css": "^3.0.0", @@ -6332,7 +6442,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/css/-/css-3.0.0.tgz", "integrity": "sha512-DG9pFfwOrzc+hawpmqX/dHYHJG+Bsdb0klhyi1sDneOgGOXy9wQIC8hzyVp1e4NRYDBdxcylvywPkkXCHAzTyQ==", - "dev": true, "requires": { "inherits": "^2.0.4", "source-map": "^0.6.1", @@ -6343,7 +6452,6 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.6.0.tgz", "integrity": "sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==", - "dev": true, "requires": { "atob": "^2.1.2", "decode-uri-component": "^0.2.0" @@ -6872,14 +6980,12 @@ "cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==" }, "cssstyle": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, "requires": { "cssom": "~0.3.6" }, @@ -6887,8 +6993,7 @@ "cssom": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" } } }, @@ -6987,7 +7092,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", "integrity": "sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==", - "dev": true, "requires": { "abab": "^2.0.3", "whatwg-mimetype": "^2.3.0", @@ -7022,8 +7126,7 @@ "decimal.js": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz", - "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==", - "dev": true + "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==" }, "decode-uri-component": { "version": "0.2.0", @@ -7062,8 +7165,7 @@ "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" }, "deepmerge": { "version": "4.2.2", @@ -7405,7 +7507,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz", "integrity": "sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg==", - "dev": true, "requires": { "webidl-conversions": "^5.0.0" }, @@ -7413,8 +7514,7 @@ "webidl-conversions": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz", - "integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==", - "dev": true + "integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==" } } }, @@ -7427,6 +7527,11 @@ "domelementtype": "^2.2.0" } }, + "domino": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/domino/-/domino-2.1.6.tgz", + "integrity": "sha512-3VdM/SXBZX2omc9JF9nOPCtDaYQ67BGp5CoLpIQlO2KCAPETs8TcDHacF26jXadGbvUteZzRTeos2fhID5+ucQ==" + }, "domutils": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.6.0.tgz", @@ -7676,7 +7781,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", - "dev": true, "requires": { "esprima": "^4.0.1", "estraverse": "^5.2.0", @@ -7688,14 +7792,12 @@ "estraverse": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==" }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, "requires": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" @@ -7705,7 +7807,6 @@ "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, "requires": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", @@ -7718,14 +7819,12 @@ "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, "requires": { "prelude-ls": "~1.1.2" } @@ -8461,8 +8560,7 @@ "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, "fast-safe-stringify": { "version": "2.0.7", @@ -9315,7 +9413,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", "integrity": "sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ==", - "dev": true, "requires": { "whatwg-encoding": "^1.0.5" } @@ -9380,6 +9477,16 @@ "requires-port": "^1.0.0" } }, + "http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "requires": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + } + }, "http-proxy-middleware": { "version": "0.19.1", "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz", @@ -9523,7 +9630,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, "requires": { "agent-base": "6", "debug": "4" @@ -9991,8 +10097,7 @@ "is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", - "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", - "dev": true + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" }, "is-promise": { "version": "2.2.2", @@ -12589,8 +12694,7 @@ "nwsapi": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", - "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", - "dev": true + "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==" }, "oauth-sign": { "version": "0.9.0", @@ -13002,8 +13106,7 @@ "parse5": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", - "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", - "dev": true + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" }, "parse5-html-rewriting-stream": { "version": "6.0.1", @@ -13019,7 +13122,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", - "dev": true, "requires": { "parse5": "^6.0.1" } @@ -16231,8 +16333,7 @@ "pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", - "integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==", - "dev": true + "integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==" }, "pretty-format": { "version": "25.5.0", @@ -17343,7 +17444,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", "integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==", - "dev": true, "requires": { "xmlchars": "^2.2.0" } @@ -17880,8 +17980,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-js": { "version": "0.6.2", @@ -18480,8 +18579,7 @@ "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", - "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", - "dev": true + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" }, "table": { "version": "6.7.1", @@ -18801,7 +18899,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.0.2.tgz", "integrity": "sha512-3n1qG+/5kg+jrbTzwAykB5yRYtQCTqOGKq5U5PE3b0a1/mzo6snDhjGS0zJVJunO0NrT3Dg1MLy5TjWP/UJppg==", - "dev": true, "requires": { "punycode": "^2.1.1" } @@ -19532,7 +19629,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", - "dev": true, "requires": { "browser-process-hrtime": "^1.0.0" } @@ -19541,7 +19637,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz", "integrity": "sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA==", - "dev": true, "requires": { "xml-name-validator": "^3.0.0" } @@ -19818,8 +19913,7 @@ "webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", - "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==", - "dev": true + "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==" }, "webpack": { "version": "5.36.2", @@ -20636,7 +20730,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", - "dev": true, "requires": { "iconv-lite": "0.4.24" } @@ -20644,14 +20737,12 @@ "whatwg-mimetype": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", - "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", - "dev": true + "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" }, "whatwg-url": { "version": "8.5.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.5.0.tgz", "integrity": "sha512-fy+R77xWv0AiqfLl4nuGUlQ3/6b5uNfQ4WAbGQVMYshCTCCPK9psC1nWh3XHuxGVCtlcDDQPQW1csmmIQo+fwg==", - "dev": true, "requires": { "lodash": "^4.7.0", "tr46": "^2.0.2", @@ -20701,8 +20792,7 @@ "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" }, "worker-farm": { "version": "1.7.0", @@ -20751,8 +20841,7 @@ "ws": { "version": "7.4.5", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.5.tgz", - "integrity": "sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==", - "dev": true + "integrity": "sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==" }, "xdg-basedir": { "version": "4.0.0", @@ -20760,17 +20849,20 @@ "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "dev": true }, + "xhr2": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/xhr2/-/xhr2-0.2.1.tgz", + "integrity": "sha512-sID0rrVCqkVNUn8t6xuv9+6FViXjUVXq8H5rWOH2rz9fDNQEd4g0EA2XlcEdJXRz5BMEn4O1pJFdT+z4YHhoWw==" + }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", - "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", - "dev": true + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==" }, "xmlchars": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", - "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==" }, "xtend": { "version": "4.0.2", diff --git a/package.json b/package.json index 85ec42c..0ce100a 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "@angular/material": "^12.0.1", "@angular/platform-browser": "12.0.0", "@angular/platform-browser-dynamic": "12.0.0", + "@angular/platform-server": "12.0.0", "@angular/router": "12.0.0", "@nestjs/common": "^7.0.0", "@nestjs/core": "^7.0.0", @@ -50,6 +51,8 @@ "@ngrx/entity": "^12.0.0", "@ngrx/router-store": "^12.0.0", "@ngrx/store": "^12.0.0", + "@nguniversal/express-engine": "^12.1.0", + "@nguniversal/module-map-ngfactory-loader": "^8.2.6", "@nrwl/angular": "^12.3.3", "@nrwl/nx": "^7.8.7", "fs": "0.0.1-security", diff --git a/workspace.json b/workspace.json index c1c02e5..5fd4146 100644 --- a/workspace.json +++ b/workspace.json @@ -9,9 +9,7 @@ "targets": { "test": { "executor": "@nrwl/jest:jest", - "outputs": [ - "coverage/libs/auth" - ], + "outputs": ["coverage/libs/auth"], "options": { "jestConfig": "libs/auth/jest.config.js", "passWithNoTests": true @@ -47,9 +45,7 @@ "apps/customer-portal/src/favicon.ico", "apps/customer-portal/src/assets" ], - "styles": [ - "apps/customer-portal/src/styles.scss" - ], + "styles": ["apps/customer-portal/src/styles.scss"], "scripts": [] }, "configurations": { @@ -117,9 +113,7 @@ }, "test": { "executor": "@nrwl/jest:jest", - "outputs": [ - "coverage/apps/customer-portal" - ], + "outputs": ["coverage/apps/customer-portal"], "options": { "jestConfig": "apps/customer-portal/jest.config.js", "passWithNoTests": true @@ -148,9 +142,7 @@ "lint": { "executor": "@nrwl/linter:eslint", "options": { - "lintFilePatterns": [ - "apps/customer-portal-e2e/**/*.{js,ts}" - ] + "lintFilePatterns": ["apps/customer-portal-e2e/**/*.{js,ts}"] } } } @@ -163,9 +155,7 @@ "targets": { "test": { "executor": "@nrwl/jest:jest", - "outputs": [ - "coverage/libs/data-models" - ], + "outputs": ["coverage/libs/data-models"], "options": { "jestConfig": "libs/data-models/jest.config.js", "passWithNoTests": true @@ -190,9 +180,7 @@ "targets": { "test": { "executor": "@nrwl/jest:jest", - "outputs": [ - "coverage/libs/layout" - ], + "outputs": ["coverage/libs/layout"], "options": { "jestConfig": "libs/layout/jest.config.js", "passWithNoTests": true @@ -217,9 +205,7 @@ "targets": { "test": { "executor": "@nrwl/jest:jest", - "outputs": [ - "coverage/libs/material" - ], + "outputs": ["coverage/libs/material"], "options": { "jestConfig": "libs/material/jest.config.js", "passWithNoTests": true @@ -243,16 +229,12 @@ "targets": { "build": { "executor": "@nrwl/node:build", - "outputs": [ - "{options.outputPath}" - ], + "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/apps/nest-demo", "main": "apps/nest-demo/src/main.ts", "tsConfig": "apps/nest-demo/tsconfig.app.json", - "assets": [ - "apps/nest-demo/src/assets" - ] + "assets": ["apps/nest-demo/src/assets"] }, "configurations": { "production": { @@ -277,16 +259,12 @@ "lint": { "executor": "@nrwl/linter:eslint", "options": { - "lintFilePatterns": [ - "apps/nest-demo/**/*.ts" - ] + "lintFilePatterns": ["apps/nest-demo/**/*.ts"] } }, "test": { "executor": "@nrwl/jest:jest", - "outputs": [ - "coverage/apps/nest-demo" - ], + "outputs": ["coverage/apps/nest-demo"], "options": { "jestConfig": "apps/nest-demo/jest.config.js", "passWithNoTests": true @@ -302,9 +280,7 @@ "targets": { "test": { "executor": "@nrwl/jest:jest", - "outputs": [ - "coverage/libs/products" - ], + "outputs": ["coverage/libs/products"], "options": { "jestConfig": "libs/products/jest.config.js", "passWithNoTests": true @@ -329,9 +305,7 @@ "targets": { "test": { "executor": "@nrwl/jest:jest", - "outputs": [ - "coverage/libs/trends" - ], + "outputs": ["coverage/libs/trends"], "options": { "jestConfig": "libs/trends/jest.config.js", "passWithNoTests": true @@ -347,6 +321,197 @@ } } } + }, + "trendy": { + "projectType": "application", + "root": "apps/trendy", + "sourceRoot": "apps/trendy/src", + "prefix": "demo-app", + "targets": { + "build": { + "executor": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/apps/trendy/browser", + "index": "apps/trendy/src/index.html", + "main": "apps/trendy/src/main.ts", + "polyfills": "apps/trendy/src/polyfills.ts", + "tsConfig": "apps/trendy/tsconfig.app.json", + "inlineStyleLanguage": "scss", + "assets": ["apps/trendy/src/favicon.ico", "apps/trendy/src/assets"], + "styles": ["apps/trendy/src/styles.scss"], + "scripts": [] + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "500kb", + "maximumError": "1mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "2kb", + "maximumError": "4kb" + } + ], + "fileReplacements": [ + { + "replace": "apps/trendy/src/environments/environment.ts", + "with": "apps/trendy/src/environments/environment.prod.ts" + } + ], + "outputHashing": "all" + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "executor": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "browserTarget": "trendy:build:production" + }, + "development": { + "browserTarget": "trendy:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "executor": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "trendy:build" + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": [ + "apps/trendy/src/**/*.ts", + "apps/trendy/src/**/*.html" + ] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/apps/trendy"], + "options": { + "jestConfig": "apps/trendy/jest.config.js", + "passWithNoTests": true + } + }, + "server": { + "executor": "@angular-devkit/build-angular:server", + "options": { + "outputPath": "dist/trendy/server", + "main": "apps/trendy/src/main.server.ts", + "tsConfig": "apps/trendy/tsconfig.server.json", + "inlineStyleLanguage": "scss" + }, + "configurations": { + "production": { + "outputHashing": "media", + "fileReplacements": [ + { + "replace": "apps/trendy/src/environments/environment.ts", + "with": "apps/trendy/src/environments/environment.prod.ts" + } + ] + }, + "development": { + "optimization": false, + "sourceMap": true, + "extractLicenses": false + } + }, + "defaultConfiguration": "production" + } + } + }, + "trendy-e2e": { + "root": "apps/trendy-e2e", + "sourceRoot": "apps/trendy-e2e/src", + "projectType": "application", + "targets": { + "e2e": { + "executor": "@nrwl/cypress:cypress", + "options": { + "cypressConfig": "apps/trendy-e2e/cypress.json", + "tsConfig": "apps/trendy-e2e/tsconfig.e2e.json", + "devServerTarget": "trendy:serve:development" + }, + "configurations": { + "production": { + "devServerTarget": "trendy:serve:production" + } + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["apps/trendy-e2e/**/*.{js,ts}"] + } + } + } + }, + "trendy-ssr": { + "root": "apps/trendy-ssr", + "sourceRoot": "apps/trendy-ssr/src", + "projectType": "application", + "targets": { + "build": { + "executor": "@nrwl/node:build", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/apps/trendy-ssr", + "main": "apps/trendy-ssr/src/main.ts", + "tsConfig": "apps/trendy-ssr/tsconfig.app.json", + "assets": ["apps/trendy-ssr/src/assets"] + }, + "configurations": { + "production": { + "optimization": true, + "extractLicenses": true, + "inspect": false, + "fileReplacements": [ + { + "replace": "apps/trendy-ssr/src/environments/environment.ts", + "with": "apps/trendy-ssr/src/environments/environment.prod.ts" + } + ] + } + } + }, + "serve": { + "executor": "@nrwl/node:execute", + "options": { + "buildTarget": "trendy-ssr:build" + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "options": { + "lintFilePatterns": ["apps/trendy-ssr/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/apps/trendy-ssr"], + "options": { + "jestConfig": "apps/trendy-ssr/jest.config.js", + "passWithNoTests": true + } + } + } } }, "cli": { @@ -369,4 +534,4 @@ } }, "defaultProject": "customer-portal" -} \ No newline at end of file +}