├── .editorconfig ├── .eslintrc.json ├── .gitignore ├── .prettierignore ├── .prettierrc ├── .vscode ├── extensions.json └── settings.json ├── README.md ├── angular.json ├── apps ├── .gitkeep ├── booking-e2e │ ├── .eslintrc.json │ ├── cypress.json │ ├── project.json │ ├── src │ │ ├── fixtures │ │ │ └── example.json │ │ ├── integration │ │ │ └── app.spec.ts │ │ └── support │ │ │ ├── app.po.ts │ │ │ ├── commands.ts │ │ │ └── index.ts │ └── tsconfig.json └── booking │ ├── .browserslistrc │ ├── .eslintrc.json │ ├── project.json │ ├── src │ ├── app │ │ ├── +state │ │ │ └── index.ts │ │ ├── about │ │ │ ├── about.component.ts │ │ │ └── lazy │ │ │ │ └── lazy.component.ts │ │ ├── app.component.css │ │ ├── app.component.html │ │ ├── app.component.ts │ │ ├── app.routes.ts │ │ ├── home │ │ │ ├── home.component.css │ │ │ ├── home.component.html │ │ │ ├── home.component.spec.ts │ │ │ └── home.component.ts │ │ ├── init.service.ts │ │ ├── material.ts │ │ ├── test-setup.ts │ │ └── utils.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.css │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.editor.json │ ├── tsconfig.json │ └── tsconfig.spec.json ├── decorate-angular-cli.js ├── jest.config.ts ├── jest.preset.ts ├── libs ├── .gitkeep ├── boarding │ └── domain │ │ └── index.ts ├── booking │ ├── domain │ │ ├── .browserslistrc │ │ ├── .eslintrc.json │ │ ├── README.md │ │ ├── jest.config.ts │ │ ├── ng-package.json │ │ ├── package.json │ │ ├── project.json │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── lib │ │ │ │ ├── +state │ │ │ │ │ ├── actions.ts │ │ │ │ │ ├── effects.ts │ │ │ │ │ ├── reducers.ts │ │ │ │ │ └── selectors.ts │ │ │ │ ├── domain.providers.ts │ │ │ │ ├── entities │ │ │ │ │ ├── .gitkeep │ │ │ │ │ └── flight.ts │ │ │ │ └── infrastructure │ │ │ │ │ ├── .gitkeep │ │ │ │ │ └── flight.service.ts │ │ │ └── test-setup.ts │ │ ├── tsconfig.json │ │ ├── tsconfig.lib.json │ │ ├── tsconfig.lib.prod.json │ │ └── tsconfig.spec.json │ ├── feature-book │ │ ├── .browserslistrc │ │ ├── .eslintrc.json │ │ ├── README.md │ │ ├── jest.config.ts │ │ ├── ng-package.json │ │ ├── package.json │ │ ├── project.json │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── lib │ │ │ │ ├── flight-booking.component.html │ │ │ │ ├── flight-booking.component.ts │ │ │ │ ├── flight-booking.routes.ts │ │ │ │ ├── flight-edit │ │ │ │ │ ├── flight-edit.component.css │ │ │ │ │ ├── flight-edit.component.html │ │ │ │ │ └── flight-edit.component.ts │ │ │ │ ├── flight-search │ │ │ │ │ ├── flight-search.component.css │ │ │ │ │ ├── flight-search.component.html │ │ │ │ │ └── flight-search.component.ts │ │ │ │ └── passenger-search │ │ │ │ │ ├── passenger-search.component.css │ │ │ │ │ ├── passenger-search.component.html │ │ │ │ │ └── passenger-search.component.ts │ │ │ └── test-setup.ts │ │ ├── tsconfig.json │ │ ├── tsconfig.lib.json │ │ ├── tsconfig.lib.prod.json │ │ └── tsconfig.spec.json │ ├── feature-tickets │ │ ├── .browserslistrc │ │ ├── .eslintrc.json │ │ ├── README.md │ │ ├── jest.config.ts │ │ ├── ng-package.json │ │ ├── package.json │ │ ├── project.json │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── lib │ │ │ │ ├── my-tickets.component.ts │ │ │ │ ├── next-flight.component.ts │ │ │ │ ├── ticket.service.ts │ │ │ │ └── tickets.module.ts │ │ │ └── test-setup.ts │ │ ├── tsconfig.json │ │ ├── tsconfig.lib.json │ │ ├── tsconfig.lib.prod.json │ │ └── tsconfig.spec.json │ └── ui-common │ │ ├── .browserslistrc │ │ ├── .eslintrc.json │ │ ├── README.md │ │ ├── jest.config.ts │ │ ├── ng-package.json │ │ ├── package.json │ │ ├── project.json │ │ ├── src │ │ ├── index.ts │ │ ├── lib │ │ │ ├── booking-ui-common.module.ts │ │ │ └── flight-card │ │ │ │ ├── flight-card.component.css │ │ │ │ ├── flight-card.component.html │ │ │ │ └── flight-card.component.ts │ │ └── test-setup.ts │ │ ├── tsconfig.json │ │ ├── tsconfig.lib.json │ │ ├── tsconfig.lib.prod.json │ │ └── tsconfig.spec.json └── shared │ ├── ui-shell │ ├── .browserslistrc │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── ng-package.json │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.ts │ │ ├── lib │ │ │ ├── navbar │ │ │ │ ├── navbar.component.html │ │ │ │ └── navbar.component.ts │ │ │ └── sidebar │ │ │ │ ├── sidebar.component.css │ │ │ │ ├── sidebar.component.html │ │ │ │ └── sidebar.component.ts │ │ └── test-setup.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ └── tsconfig.spec.json │ └── util-common │ ├── .browserslistrc │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── ng-package.json │ ├── package.json │ ├── project.json │ ├── src │ ├── index.ts │ ├── lib │ │ ├── city.pipe.ts │ │ └── city.validator.ts │ └── test-setup.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ └── tsconfig.spec.json ├── nx.json ├── package.json ├── tools ├── generators │ └── .gitkeep └── tsconfig.tools.json └── tsconfig.base.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "ignorePatterns": ["**/*"], 4 | "plugins": ["@nrwl/nx"], 5 | "overrides": [ 6 | { 7 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 8 | "rules": { 9 | "@nrwl/nx/enforce-module-boundaries": [ 10 | "error", 11 | { 12 | "enforceBuildableLibDependency": true, 13 | "allow": [], 14 | "depConstraints": [ 15 | { 16 | "sourceTag": "type:app", 17 | "onlyDependOnLibsWithTags": [ 18 | "type:api", 19 | "type:feature", 20 | "type:ui", 21 | "type:domain-logic", 22 | "type:util" 23 | ] 24 | }, 25 | { 26 | "sourceTag": "type:api", 27 | "onlyDependOnLibsWithTags": [ 28 | "type:ui", 29 | "type:domain-logic", 30 | "type:util" 31 | ] 32 | }, 33 | { 34 | "sourceTag": "type:feature", 35 | "onlyDependOnLibsWithTags": [ 36 | "type:ui", 37 | "type:domain-logic", 38 | "type:util" 39 | ] 40 | }, 41 | { 42 | "sourceTag": "type:ui", 43 | "onlyDependOnLibsWithTags": ["type:domain-logic", "type:util"] 44 | }, 45 | { 46 | "sourceTag": "type:domain-logic", 47 | "onlyDependOnLibsWithTags": ["type:util"] 48 | }, 49 | { 50 | "sourceTag": "domain:shared", 51 | "onlyDependOnLibsWithTags": ["domain:shared"] 52 | }, 53 | { 54 | "sourceTag": "domain:booking", 55 | "onlyDependOnLibsWithTags": ["domain:booking", "domain:shared"] 56 | }, 57 | { 58 | "sourceTag": "domain:tickets", 59 | "onlyDependOnLibsWithTags": ["domain:tickets", "domain:shared"] 60 | } 61 | ] 62 | } 63 | ] 64 | } 65 | }, 66 | { 67 | "files": ["*.ts", "*.tsx"], 68 | "extends": ["plugin:@nrwl/nx/typescript"], 69 | "rules": {} 70 | }, 71 | { 72 | "files": ["*.js", "*.jsx"], 73 | "extends": ["plugin:@nrwl/nx/javascript"], 74 | "rules": {} 75 | } 76 | ] 77 | } 78 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # System Files 38 | .DS_Store 39 | Thumbs.db 40 | 41 | .angular 42 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Add files here to ignore them from prettier formatting 2 | 3 | /dist 4 | /coverage 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "angular.ng-template", 4 | "nrwl.angular-console", 5 | "esbenp.prettier-vscode", 6 | "firsttris.vscode-jest-runner", 7 | "dbaeumer.vscode-eslint" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.activeBackground": "#fbed80", 4 | "activityBar.activeBorder": "#06b9a5", 5 | "activityBar.background": "#fbed80", 6 | "activityBar.foreground": "#15202b", 7 | "activityBar.inactiveForeground": "#15202b99", 8 | "activityBarBadge.background": "#06b9a5", 9 | "activityBarBadge.foreground": "#15202b", 10 | "sash.hoverBorder": "#fbed80", 11 | "statusBar.background": "#f9e64f", 12 | "statusBar.foreground": "#15202b", 13 | "statusBarItem.hoverBackground": "#f7df1e", 14 | "statusBarItem.remoteBackground": "#f9e64f", 15 | "statusBarItem.remoteForeground": "#15202b", 16 | "titleBar.activeBackground": "#f9e64f", 17 | "titleBar.activeForeground": "#15202b", 18 | "titleBar.inactiveBackground": "#f9e64f99", 19 | "titleBar.inactiveForeground": "#15202b99" 20 | }, 21 | "peacock.color": "#f9e64f", 22 | "angular.enable-strict-mode-prompt": false 23 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # NxExample 4 | 5 | This project was generated using [Nx](https://nx.dev). 6 | 7 |

8 | 9 | 🔎 **Smart, Fast and Extensible Build System** 10 | 11 | ## Quick Start & Documentation 12 | 13 | [Nx Documentation](https://nx.dev/angular) 14 | 15 | [10-minute video showing all Nx features](https://nx.dev/getting-started/intro) 16 | 17 | [Interactive Tutorial](https://nx.dev/tutorial/01-create-application) 18 | 19 | ## Adding capabilities to your workspace 20 | 21 | Nx supports many plugins which add capabilities for developing different types of applications and different tools. 22 | 23 | These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well. 24 | 25 | Below are our core plugins: 26 | 27 | - [Angular](https://angular.io) 28 | - `ng add @nrwl/angular` 29 | - [React](https://reactjs.org) 30 | - `ng add @nrwl/react` 31 | - Web (no framework frontends) 32 | - `ng add @nrwl/web` 33 | - [Nest](https://nestjs.com) 34 | - `ng add @nrwl/nest` 35 | - [Express](https://expressjs.com) 36 | - `ng add @nrwl/express` 37 | - [Node](https://nodejs.org) 38 | - `ng add @nrwl/node` 39 | 40 | There are also many [community plugins](https://nx.dev/community) you could add. 41 | 42 | ## Generate an application 43 | 44 | Run `ng g @nrwl/angular:app my-app` to generate an application. 45 | 46 | > You can use any of the plugins above to generate applications as well. 47 | 48 | When using Nx, you can create multiple applications and libraries in the same workspace. 49 | 50 | ## Generate a library 51 | 52 | Run `ng g @nrwl/angular:lib my-lib` to generate a library. 53 | 54 | > You can also use any of the plugins above to generate libraries as well. 55 | 56 | Libraries are shareable across libraries and applications. They can be imported from `@nx-example/mylib`. 57 | 58 | ## Development server 59 | 60 | Run `ng serve my-app` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files. 61 | 62 | ## Code scaffolding 63 | 64 | Run `ng g component my-component --project=my-app` to generate a new component. 65 | 66 | ## Build 67 | 68 | Run `ng build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 69 | 70 | ## Running unit tests 71 | 72 | Run `ng test my-app` to execute the unit tests via [Jest](https://jestjs.io). 73 | 74 | Run `nx affected:test` to execute the unit tests affected by a change. 75 | 76 | ## Running end-to-end tests 77 | 78 | Run `ng e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io). 79 | 80 | Run `nx affected:e2e` to execute the end-to-end tests affected by a change. 81 | 82 | ## Understand your workspace 83 | 84 | Run `nx graph` to see a diagram of the dependencies of your projects. 85 | 86 | ## Further help 87 | 88 | Visit the [Nx Documentation](https://nx.dev/angular) to learn more. 89 | 90 | 91 | 92 | 93 | 94 | 95 | ## ☁ Nx Cloud 96 | 97 | ### Distributed Computation Caching & Distributed Task Execution 98 | 99 |

100 | 101 | Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly. 102 | 103 | Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers. 104 | 105 | Visit [Nx Cloud](https://nx.app/) to learn more. 106 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "projects": { 4 | "booking": "apps/booking", 5 | "booking-domain": "libs/booking/domain", 6 | "booking-e2e": "apps/booking-e2e", 7 | "booking-feature-book": "libs/booking/feature-book", 8 | "booking-feature-tickets": "libs/booking/feature-tickets", 9 | "booking-ui-common": "libs/booking/ui-common", 10 | "shared-ui-shell": "libs/shared/ui-shell", 11 | "shared-util-common": "libs/shared/util-common" 12 | }, 13 | "defaultProject": "booking" 14 | } 15 | -------------------------------------------------------------------------------- /apps/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/apps/.gitkeep -------------------------------------------------------------------------------- /apps/booking-e2e/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /apps/booking-e2e/cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileServerFolder": ".", 3 | "fixturesFolder": "./src/fixtures", 4 | "integrationFolder": "./src/integration", 5 | "modifyObstructiveCode": false, 6 | "supportFile": "./src/support/index.ts", 7 | "pluginsFile": false, 8 | "video": true, 9 | "videosFolder": "../../dist/cypress/apps/booking-e2e/videos", 10 | "screenshotsFolder": "../../dist/cypress/apps/booking-e2e/screenshots", 11 | "chromeWebSecurity": false 12 | } 13 | -------------------------------------------------------------------------------- /apps/booking-e2e/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": "apps/booking-e2e", 3 | "sourceRoot": "apps/booking-e2e/src", 4 | "projectType": "application", 5 | "targets": { 6 | "e2e": { 7 | "executor": "@nrwl/cypress:cypress", 8 | "options": { 9 | "cypressConfig": "apps/booking-e2e/cypress.json", 10 | "devServerTarget": "booking:serve:development" 11 | }, 12 | "configurations": { 13 | "production": { 14 | "devServerTarget": "booking:serve:production" 15 | } 16 | } 17 | }, 18 | "lint": { 19 | "executor": "@nrwl/linter:eslint", 20 | "outputs": ["{options.outputFile}"], 21 | "options": { 22 | "lintFilePatterns": ["apps/booking-e2e/**/*.{js,ts}"] 23 | } 24 | } 25 | }, 26 | "tags": [], 27 | "implicitDependencies": ["booking"] 28 | } 29 | -------------------------------------------------------------------------------- /apps/booking-e2e/src/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io" 4 | } 5 | -------------------------------------------------------------------------------- /apps/booking-e2e/src/integration/app.spec.ts: -------------------------------------------------------------------------------- 1 | import { getGreeting } from '../support/app.po'; 2 | 3 | describe('booking', () => { 4 | beforeEach(() => cy.visit('/')); 5 | 6 | it('should display welcome message', () => { 7 | // Custom command example, see `../support/commands.ts` file 8 | cy.login('my-email@something.com', 'myPassword'); 9 | 10 | // Function helper example, see `../support/app.po.ts` file 11 | getGreeting().contains('Welcome booking'); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /apps/booking-e2e/src/support/app.po.ts: -------------------------------------------------------------------------------- 1 | export const getGreeting = () => cy.get('h1'); 2 | -------------------------------------------------------------------------------- /apps/booking-e2e/src/support/commands.ts: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | 11 | // eslint-disable-next-line @typescript-eslint/no-namespace 12 | declare namespace Cypress { 13 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 14 | interface Chainable { 15 | login(email: string, password: string): void; 16 | } 17 | } 18 | // 19 | // -- This is a parent command -- 20 | Cypress.Commands.add('login', (email, password) => { 21 | console.log('Custom command example: Login', email, password); 22 | }); 23 | // 24 | // -- This is a child command -- 25 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) 26 | // 27 | // 28 | // -- This is a dual command -- 29 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) 30 | // 31 | // 32 | // -- This will overwrite an existing command -- 33 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) 34 | -------------------------------------------------------------------------------- /apps/booking-e2e/src/support/index.ts: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands'; 18 | -------------------------------------------------------------------------------- /apps/booking-e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "sourceMap": false, 5 | "outDir": "../../dist/out-tsc", 6 | "allowJs": true, 7 | "types": ["cypress", "node"], 8 | "forceConsistentCasingInFileNames": true, 9 | "strict": true, 10 | "noImplicitOverride": true, 11 | "noPropertyAccessFromIndexSignature": true, 12 | "noImplicitReturns": true, 13 | "noFallthroughCasesInSwitch": true 14 | }, 15 | "include": ["src/**/*.ts", "src/**/*.js"], 16 | "angularCompilerOptions": { 17 | "strictInjectionParameters": true, 18 | "strictInputAccessModifiers": true, 19 | "strictTemplates": true 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /apps/booking/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /apps/booking/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "extends": [ 8 | "plugin:@nrwl/nx/angular", 9 | "plugin:@angular-eslint/template/process-inline-templates" 10 | ], 11 | "rules": { 12 | "@angular-eslint/directive-selector": [ 13 | "error", 14 | { 15 | "type": "attribute", 16 | "prefix": "app", 17 | "style": "camelCase" 18 | } 19 | ], 20 | "@angular-eslint/component-selector": [ 21 | "error", 22 | { 23 | "type": "element", 24 | "prefix": "app", 25 | "style": "kebab-case" 26 | } 27 | ] 28 | } 29 | }, 30 | { 31 | "files": ["*.html"], 32 | "extends": ["plugin:@nrwl/nx/angular-template"], 33 | "rules": {} 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /apps/booking/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectType": "application", 3 | "root": "apps/booking", 4 | "sourceRoot": "apps/booking/src", 5 | "prefix": "nx-example", 6 | "targets": { 7 | "build": { 8 | "executor": "@angular-devkit/build-angular:browser", 9 | "outputs": ["{options.outputPath}"], 10 | "options": { 11 | "outputPath": "dist/apps/booking", 12 | "index": "apps/booking/src/index.html", 13 | "main": "apps/booking/src/main.ts", 14 | "polyfills": "apps/booking/src/polyfills.ts", 15 | "tsConfig": "apps/booking/tsconfig.app.json", 16 | "inlineStyleLanguage": "scss", 17 | "assets": ["apps/booking/src/favicon.ico", "apps/booking/src/assets"], 18 | "styles": [ 19 | "node_modules/@angular-architects/paper-design/assets/css/bootstrap.css", 20 | "node_modules/@angular-architects/paper-design/assets/scss/paper-dashboard.scss", 21 | "node_modules/@angular/material/prebuilt-themes/indigo-pink.css", 22 | "apps/booking/src/styles.css" 23 | ], 24 | "scripts": [] 25 | }, 26 | "configurations": { 27 | "production": { 28 | "budgets": [ 29 | { 30 | "type": "initial", 31 | "maximumWarning": "500kb", 32 | "maximumError": "1mb" 33 | }, 34 | { 35 | "type": "anyComponentStyle", 36 | "maximumWarning": "2kb", 37 | "maximumError": "4kb" 38 | } 39 | ], 40 | "fileReplacements": [ 41 | { 42 | "replace": "apps/booking/src/environments/environment.ts", 43 | "with": "apps/booking/src/environments/environment.prod.ts" 44 | } 45 | ], 46 | "outputHashing": "all" 47 | }, 48 | "development": { 49 | "buildOptimizer": false, 50 | "optimization": false, 51 | "vendorChunk": true, 52 | "extractLicenses": false, 53 | "sourceMap": true, 54 | "namedChunks": true 55 | } 56 | }, 57 | "defaultConfiguration": "production" 58 | }, 59 | "serve": { 60 | "executor": "@angular-devkit/build-angular:dev-server", 61 | "configurations": { 62 | "production": { 63 | "browserTarget": "booking:build:production" 64 | }, 65 | "development": { 66 | "browserTarget": "booking:build:development" 67 | } 68 | }, 69 | "defaultConfiguration": "development" 70 | }, 71 | "extract-i18n": { 72 | "executor": "@angular-devkit/build-angular:extract-i18n", 73 | "options": { 74 | "browserTarget": "booking:build" 75 | } 76 | }, 77 | "lint": { 78 | "executor": "@nrwl/linter:eslint", 79 | "options": { 80 | "lintFilePatterns": ["apps/booking/**/*.ts", "apps/booking/**/*.html"] 81 | } 82 | }, 83 | "test": { 84 | "executor": "@nrwl/jest:jest", 85 | "outputs": ["coverage/apps/booking"], 86 | "options": { 87 | "jestConfig": "apps/booking/jest.config.ts", 88 | "passWithNoTests": true 89 | } 90 | } 91 | }, 92 | "tags": ["domain:booking", "type:app"] 93 | } 94 | -------------------------------------------------------------------------------- /apps/booking/src/app/+state/index.ts: -------------------------------------------------------------------------------- 1 | import { createReducer } from "@ngrx/store" 2 | 3 | export interface AppState { 4 | userName: string; 5 | } 6 | 7 | export const initState: AppState = { 8 | userName: 'Jane Doe' 9 | } 10 | 11 | export const reducer = createReducer( 12 | initState 13 | ); -------------------------------------------------------------------------------- /apps/booking/src/app/about/about.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewChild, ViewContainerRef } from "@angular/core"; 2 | 3 | @Component({ 4 | standalone: true, 5 | selector: 'app-about', 6 | template: ` 7 |

About

8 | 9 | ` 10 | }) 11 | export class AboutComponent { 12 | title = 'Standalone Demo'; 13 | 14 | @ViewChild('container', {read: ViewContainerRef}) 15 | viewContainer!: ViewContainerRef; 16 | 17 | async ngOnInit() { 18 | const esm = await import('./lazy/lazy.component'); 19 | const ref = this.viewContainer.createComponent(esm.LazyComponent) 20 | ref.instance.title = `Lazy Sub Component !!`; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /apps/booking/src/app/about/lazy/lazy.component.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from "@angular/common"; 2 | import { Component } from "@angular/core"; 3 | 4 | @Component({ 5 | standalone: true, 6 | selector: 'app-lazy', 7 | imports: [CommonModule], 8 | template: `

{{ title }}

` 9 | }) 10 | export class LazyComponent { 11 | title = 'Standalone Demo'; 12 | visible = true; 13 | } 14 | -------------------------------------------------------------------------------- /apps/booking/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | .sidenav-container { 2 | height: 100%; 3 | } 4 | 5 | .sidenav { 6 | width: 200px; 7 | } 8 | 9 | .sidenav .mat-toolbar { 10 | background: inherit; 11 | } 12 | 13 | .mat-toolbar.mat-primary { 14 | position: sticky; 15 | top: 0; 16 | z-index: 1; 17 | } 18 | 19 | .app-container { 20 | padding: 20px; 21 | } -------------------------------------------------------------------------------- /apps/booking/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 |
8 | 9 |
-------------------------------------------------------------------------------- /apps/booking/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { HomeComponent } from './home/home.component'; 2 | 3 | // Options for importing esm modules 4 | import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; 5 | import { map, shareReplay } from 'rxjs'; 6 | import { Component, Inject } from '@angular/core'; 7 | 8 | import { RouterModule } from '@angular/router'; 9 | import { CommonModule } from '@angular/common'; 10 | import { NavbarComponent, SidebarComponent } from '@nx-example/shared/ui-shell'; 11 | 12 | import material from './material'; 13 | 14 | @Component({ 15 | standalone: true, 16 | selector: 'app-root', 17 | imports: [ 18 | ...material, 19 | 20 | RouterModule, 21 | CommonModule, 22 | 23 | NavbarComponent, 24 | SidebarComponent, 25 | 26 | HomeComponent, 27 | ], 28 | templateUrl: './app.component.html', 29 | styleUrls: ['./app.component.css'] 30 | }) 31 | export class AppComponent { 32 | 33 | isHandset$ = this.breakpointObserver.observe(Breakpoints.Handset) 34 | .pipe( 35 | map(result => result.matches), 36 | shareReplay() 37 | ); 38 | 39 | constructor( 40 | @Inject(BreakpointObserver) private breakpointObserver: BreakpointObserver) { 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /apps/booking/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from "@angular/router"; 2 | import { HomeComponent } from "./home/home.component"; 3 | 4 | export const APP_ROUTES: Routes = [ 5 | { 6 | path: '', 7 | pathMatch: 'full', 8 | redirectTo: 'home' 9 | }, 10 | { 11 | path: 'home', 12 | component: HomeComponent 13 | }, 14 | { 15 | path: 'flight-booking', 16 | loadChildren: () => 17 | import('@nx-example/booking/feature-book').then(m => m.FLIGHT_BOOKING_ROUTES) 18 | }, 19 | { 20 | path: 'next-flight', 21 | loadComponent: () => 22 | import('@nx-example/booking/feature-tickets').then(m => m.NextFlightComponent) 23 | }, 24 | { 25 | path: 'tickets', 26 | loadChildren: () => 27 | import('@nx-example/booking/feature-tickets').then(m => m.TicketsModule) 28 | }, 29 | { 30 | path: 'about', 31 | loadComponent: () => 32 | import('./about/about.component').then(m => m.AboutComponent) 33 | }, 34 | ]; 35 | -------------------------------------------------------------------------------- /apps/booking/src/app/home/home.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/apps/booking/src/app/home/home.component.css -------------------------------------------------------------------------------- /apps/booking/src/app/home/home.component.html: -------------------------------------------------------------------------------- 1 |

Welcome!

-------------------------------------------------------------------------------- /apps/booking/src/app/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HomeComponent } from './home.component'; 4 | 5 | describe('HomeComponent', () => { 6 | let component: HomeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ HomeComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(HomeComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /apps/booking/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from "@angular/core"; 2 | 3 | @Component({ 4 | standalone: true, 5 | selector: 'app-home', 6 | templateUrl: './home.component.html' 7 | }) 8 | export class HomeComponent { 9 | } 10 | -------------------------------------------------------------------------------- /apps/booking/src/app/init.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable({providedIn: 'root'}) 4 | export class InitService { 5 | constructor() { } 6 | 7 | init(): void { 8 | console.debug('Initializing stuff ...'); 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /apps/booking/src/app/material.ts: -------------------------------------------------------------------------------- 1 | import { MatToolbarModule } from '@angular/material/toolbar'; 2 | import { MatButtonModule } from '@angular/material/button'; 3 | import { MatSidenavModule } from '@angular/material/sidenav'; 4 | import { MatIconModule } from '@angular/material/icon'; 5 | import { MatListModule } from '@angular/material/list'; 6 | 7 | export default [ 8 | MatToolbarModule, 9 | MatButtonModule, 10 | MatSidenavModule, 11 | MatIconModule, 12 | MatListModule 13 | ]; 14 | 15 | // Wish List: Allow just exporting building blocks w/o additional array 16 | 17 | // export { MatToolbarModule } from '@angular/material/toolbar'; 18 | // export { MatButtonModule } from '@angular/material/button'; 19 | // export { MatSidenavModule } from '@angular/material/sidenav'; 20 | // export { MatIconModule } from '@angular/material/icon'; 21 | // export { MatListModule } from '@angular/material/list'; -------------------------------------------------------------------------------- /apps/booking/src/app/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular/setup-jest'; 2 | -------------------------------------------------------------------------------- /apps/booking/src/app/utils.ts: -------------------------------------------------------------------------------- 1 | import { ɵComponentType, ɵNgModuleType, ɵDirectiveType, Type } from "@angular/core"; 2 | 3 | export type ImportableType = ɵNgModuleType | ɵComponentType | ɵDirectiveType; 4 | 5 | export function all(object: Object): Type[] { 6 | return Object.values(object) as Type[]; 7 | } -------------------------------------------------------------------------------- /apps/booking/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/apps/booking/src/assets/.gitkeep -------------------------------------------------------------------------------- /apps/booking/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /apps/booking/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /apps/booking/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/apps/booking/src/favicon.ico -------------------------------------------------------------------------------- /apps/booking/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Cli14next12 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /apps/booking/src/main.ts: -------------------------------------------------------------------------------- 1 | import { LayoutModule } from '@angular/cdk/layout'; 2 | import { HttpClientModule } from '@angular/common/http'; 3 | import { enableProdMode, importProvidersFrom } from '@angular/core'; 4 | import { bootstrapApplication } from '@angular/platform-browser'; 5 | import { RouterModule } from '@angular/router'; 6 | import { EffectsModule } from '@ngrx/effects'; 7 | import { StoreModule } from '@ngrx/store'; 8 | import { StoreDevtoolsModule } from '@ngrx/store-devtools'; 9 | import { reducer } from './app/+state'; 10 | import { AppComponent } from './app/app.component'; 11 | import { APP_ROUTES } from './app/app.routes'; 12 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 13 | 14 | import { environment } from './environments/environment'; 15 | 16 | if (environment.production) { 17 | enableProdMode(); 18 | } 19 | 20 | bootstrapApplication(AppComponent, { 21 | providers: [ 22 | importProvidersFrom(HttpClientModule), 23 | importProvidersFrom(RouterModule.forRoot(APP_ROUTES)), 24 | importProvidersFrom(StoreModule.forRoot(reducer)), 25 | importProvidersFrom(EffectsModule.forRoot()), 26 | importProvidersFrom(StoreDevtoolsModule.instrument()), 27 | importProvidersFrom(BrowserAnimationsModule), 28 | importProvidersFrom(LayoutModule), 29 | ] 30 | }); 31 | 32 | 33 | 34 | 35 | 36 | 37 | // { 38 | // provide: INJECTOR_INITIALIZER, 39 | // multi: true, 40 | // useValue: () => inject(InitService).init() 41 | // } -------------------------------------------------------------------------------- /apps/booking/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes recent versions of Safari, Chrome (including 12 | * Opera), Edge on the desktop, and iOS and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** 22 | * By default, zone.js will patch all possible macroTask and DomEvents 23 | * user can disable parts of macroTask/DomEvents patch by setting following flags 24 | * because those flags need to be set before `zone.js` being loaded, and webpack 25 | * will put import in the top of bundle, so user need to create a separate file 26 | * in this directory (for example: zone-flags.ts), and put the following flags 27 | * into that file, and then add the following code before importing zone.js. 28 | * import './zone-flags'; 29 | * 30 | * The flags allowed in zone-flags.ts are listed here. 31 | * 32 | * The following flags will work for all browsers. 33 | * 34 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 35 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 36 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 37 | * 38 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 39 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 40 | * 41 | * (window as any).__Zone_enable_cross_context_check = true; 42 | * 43 | */ 44 | 45 | /*************************************************************************************************** 46 | * Zone JS is required by default for Angular itself. 47 | */ 48 | import 'zone.js'; // Included with Angular CLI. 49 | 50 | 51 | /*************************************************************************************************** 52 | * APPLICATION IMPORTS 53 | */ 54 | -------------------------------------------------------------------------------- /apps/booking/src/styles.css: -------------------------------------------------------------------------------- 1 | .active-card { 2 | background-color: rgb(204, 197, 185); 3 | } 4 | 5 | html, body { height: 100%; } 6 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 7 | 8 | a { 9 | color: black; 10 | } 11 | 12 | .app-container { 13 | padding: 20px; 14 | } -------------------------------------------------------------------------------- /apps/booking/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | (id: string): T; 13 | keys(): string[]; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting(), 21 | ); 22 | 23 | // Then we find all the tests. 24 | const context = require.context('./', true, /\.spec\.ts$/); 25 | // And load the modules. 26 | context.keys().map(context); 27 | -------------------------------------------------------------------------------- /apps/booking/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "types": [], 6 | "target": "ES2017" 7 | }, 8 | "files": ["src/main.ts", "src/polyfills.ts"], 9 | "include": ["src/**/*.d.ts"], 10 | "exclude": ["**/*.test.ts", "**/*.spec.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /apps/booking/tsconfig.editor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["**/*.ts"], 4 | "compilerOptions": { 5 | "types": [] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /apps/booking/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.app.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | }, 12 | { 13 | "path": "./tsconfig.editor.json" 14 | } 15 | ], 16 | "compilerOptions": { 17 | "forceConsistentCasingInFileNames": true, 18 | "strict": true, 19 | "noImplicitOverride": true, 20 | "noPropertyAccessFromIndexSignature": true, 21 | "noImplicitReturns": true, 22 | "noFallthroughCasesInSwitch": true 23 | }, 24 | "angularCompilerOptions": { 25 | "strictInjectionParameters": true, 26 | "strictInputAccessModifiers": true, 27 | "strictTemplates": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /apps/booking/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "files": ["src/test-setup.ts"], 9 | "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /decorate-angular-cli.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This file decorates the Angular CLI with the Nx CLI to enable features such as computation caching 3 | * and faster execution of tasks. 4 | * 5 | * It does this by: 6 | * 7 | * - Patching the Angular CLI to warn you in case you accidentally use the undecorated ng command. 8 | * - Symlinking the ng to nx command, so all commands run through the Nx CLI 9 | * - Updating the package.json postinstall script to give you control over this script 10 | * 11 | * The Nx CLI decorates the Angular CLI, so the Nx CLI is fully compatible with it. 12 | * Every command you run should work the same when using the Nx CLI, except faster. 13 | * 14 | * Because of symlinking you can still type `ng build/test/lint` in the terminal. The ng command, in this case, 15 | * will point to nx, which will perform optimizations before invoking ng. So the Angular CLI is always invoked. 16 | * The Nx CLI simply does some optimizations before invoking the Angular CLI. 17 | * 18 | * To opt out of this patch: 19 | * - Replace occurrences of nx with ng in your package.json 20 | * - Remove the script from your postinstall script in your package.json 21 | * - Delete and reinstall your node_modules 22 | */ 23 | 24 | const fs = require('fs'); 25 | const os = require('os'); 26 | const cp = require('child_process'); 27 | const isWindows = os.platform() === 'win32'; 28 | let output; 29 | try { 30 | output = require('@nrwl/workspace').output; 31 | } catch (e) { 32 | console.warn('Angular CLI could not be decorated to enable computation caching. Please ensure @nrwl/workspace is installed.'); 33 | process.exit(0); 34 | } 35 | 36 | /** 37 | * Symlink of ng to nx, so you can keep using `ng build/test/lint` and still 38 | * invoke the Nx CLI and get the benefits of computation caching. 39 | */ 40 | function symlinkNgCLItoNxCLI() { 41 | try { 42 | const ngPath = './node_modules/.bin/ng'; 43 | const nxPath = './node_modules/.bin/nx'; 44 | if (isWindows) { 45 | /** 46 | * This is the most reliable way to create symlink-like behavior on Windows. 47 | * Such that it works in all shells and works with npx. 48 | */ 49 | ['', '.cmd', '.ps1'].forEach(ext => { 50 | if (fs.existsSync(nxPath + ext)) fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext)); 51 | }); 52 | } else { 53 | // If unix-based, symlink 54 | cp.execSync(`ln -sf ./nx ${ngPath}`); 55 | } 56 | } 57 | catch(e) { 58 | output.error({ title: 'Unable to create a symlink from the Angular CLI to the Nx CLI:' + e.message }); 59 | throw e; 60 | } 61 | } 62 | 63 | try { 64 | symlinkNgCLItoNxCLI(); 65 | require('nx/src/adapter/decorate-cli').decorateCli(); 66 | output.log({ title: 'Angular CLI has been decorated to enable computation caching.' }); 67 | } catch(e) { 68 | output.error({ title: 'Decoration of the Angular CLI did not complete successfully' }); 69 | } 70 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | const { getJestProjects } = require('@nrwl/jest'); 2 | 3 | module.exports = { 4 | projects: getJestProjects(), 5 | }; 6 | -------------------------------------------------------------------------------- /jest.preset.ts: -------------------------------------------------------------------------------- 1 | const nxPreset = require('@nrwl/jest/preset'); 2 | 3 | module.exports = { ...nxPreset }; 4 | -------------------------------------------------------------------------------- /libs/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/libs/.gitkeep -------------------------------------------------------------------------------- /libs/boarding/domain/index.ts: -------------------------------------------------------------------------------- 1 | export function noop() {} -------------------------------------------------------------------------------- /libs/booking/domain/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /libs/booking/domain/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "extends": [ 8 | "plugin:@nrwl/nx/angular", 9 | "plugin:@angular-eslint/template/process-inline-templates" 10 | ], 11 | "rules": { 12 | "@angular-eslint/directive-selector": [ 13 | "error", 14 | { 15 | "type": "attribute", 16 | "prefix": "app", 17 | "style": "camelCase" 18 | } 19 | ], 20 | "@angular-eslint/component-selector": [ 21 | "error", 22 | { 23 | "type": "element", 24 | "prefix": "app", 25 | "style": "kebab-case" 26 | } 27 | ] 28 | } 29 | }, 30 | { 31 | "files": ["*.html"], 32 | "extends": ["plugin:@nrwl/nx/angular-template"], 33 | "rules": {} 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /libs/booking/domain/README.md: -------------------------------------------------------------------------------- 1 | # booking-domain 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test booking-domain` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /libs/booking/domain/jest.config.ts: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | displayName: 'booking-domain', 3 | preset: '../../../jest.preset.ts', 4 | setupFilesAfterEnv: ['/src/test-setup.ts'], 5 | globals: { 6 | 'ts-jest': { 7 | tsconfig: '/tsconfig.spec.json', 8 | stringifyContentPathRegex: '\\.(html|svg)$', 9 | }, 10 | }, 11 | coverageDirectory: '../../../coverage/libs/booking/domain', 12 | transform: { 13 | '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular', 14 | }, 15 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 16 | snapshotSerializers: [ 17 | 'jest-preset-angular/build/serializers/no-ng-attributes', 18 | 'jest-preset-angular/build/serializers/ng-snapshot', 19 | 'jest-preset-angular/build/serializers/html-comment', 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /libs/booking/domain/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../../dist/libs/booking/domain", 4 | "lib": { 5 | "entryFile": "src/index.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /libs/booking/domain/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@nx-example/booking/domain", 3 | "version": "0.0.1", 4 | "peerDependencies": { 5 | "@angular/common": "^13.3.0", 6 | "@angular/core": "^13.3.0" 7 | }, 8 | "dependencies": { 9 | "tslib": "^2.3.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libs/booking/domain/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectType": "library", 3 | "root": "libs/booking/domain", 4 | "sourceRoot": "libs/booking/domain/src", 5 | "prefix": "booking", 6 | "targets": { 7 | "build": { 8 | "executor": "@nrwl/angular:ng-packagr-lite", 9 | "outputs": ["dist/libs/booking/domain"], 10 | "options": { 11 | "project": "libs/booking/domain/ng-package.json" 12 | }, 13 | "configurations": { 14 | "production": { 15 | "tsConfig": "libs/booking/domain/tsconfig.lib.prod.json" 16 | }, 17 | "development": { 18 | "tsConfig": "libs/booking/domain/tsconfig.lib.json" 19 | } 20 | }, 21 | "defaultConfiguration": "production" 22 | }, 23 | "test": { 24 | "executor": "@nrwl/jest:jest", 25 | "outputs": ["coverage/libs/booking/domain"], 26 | "options": { 27 | "jestConfig": "libs/booking/domain/jest.config.ts", 28 | "passWithNoTests": true 29 | } 30 | }, 31 | "lint": { 32 | "executor": "@nrwl/linter:eslint", 33 | "options": { 34 | "lintFilePatterns": [ 35 | "libs/booking/domain/**/*.ts", 36 | "libs/booking/domain/**/*.html" 37 | ] 38 | } 39 | } 40 | }, 41 | "tags": ["domain:booking", "type:domain-logic"] 42 | } 43 | -------------------------------------------------------------------------------- /libs/booking/domain/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/+state/actions'; 2 | export * from './lib/+state/effects'; 3 | export * from './lib/+state/reducers'; 4 | export * from './lib/+state/selectors'; 5 | export * from './lib/domain.providers'; 6 | export * from './lib/entities/flight'; 7 | export * from './lib/infrastructure/flight.service'; 8 | -------------------------------------------------------------------------------- /libs/booking/domain/src/lib/+state/actions.ts: -------------------------------------------------------------------------------- 1 | import { createAction, props } from "@ngrx/store"; 2 | import { Flight } from "../entities/flight"; 3 | 4 | export const loadFlights = createAction( 5 | "[booking] loadFlights", 6 | props<{from: string, to: string}>() 7 | ); 8 | 9 | export const delayFlight = createAction( 10 | "[booking] delayFlight", 11 | props<{id: number}>() 12 | ); 13 | 14 | export const loadFlightsSuccess = createAction( 15 | "[booking] loadFlightsSuccess", 16 | props<{flights: Flight[]}>() 17 | ); -------------------------------------------------------------------------------- /libs/booking/domain/src/lib/+state/effects.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@angular/core"; 2 | import { Actions, createEffect, ofType } from "@ngrx/effects"; 3 | import { map, switchMap } from "rxjs"; 4 | import { FlightService } from "../infrastructure/flight.service"; 5 | import { loadFlights, loadFlightsSuccess } from "./actions"; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class BookingEffects { 11 | 12 | loadFlights$; 13 | 14 | constructor( 15 | private actions$: Actions, 16 | private flightService: FlightService) { 17 | this.loadFlights$ = createEffect(() => this.actions$.pipe( 18 | ofType(loadFlights), 19 | switchMap(a => this.flightService.find(a.from, a.to)), 20 | map(flights => loadFlightsSuccess({flights})) 21 | )); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /libs/booking/domain/src/lib/+state/reducers.ts: -------------------------------------------------------------------------------- 1 | import { createFeature, createReducer, on } from "@ngrx/store"; 2 | import { Flight } from "../entities/flight"; 3 | import { delayFlight, loadFlightsSuccess } from "./actions"; 4 | 5 | export const BOOKING_FEATURE_KEY = 'booking'; 6 | 7 | export interface BookingSlice { 8 | [BOOKING_FEATURE_KEY]: BookingState 9 | } 10 | 11 | export interface BookingState { 12 | flights: Flight[]; 13 | } 14 | 15 | export const initialState: BookingState = { 16 | flights: [] 17 | } 18 | 19 | function updateDate(flight: Flight): Flight { 20 | return {...flight, date: new Date().toISOString() } 21 | } 22 | 23 | export const bookingFeature = createFeature({ 24 | name: BOOKING_FEATURE_KEY, 25 | reducer: createReducer( 26 | initialState, 27 | on(loadFlightsSuccess, (state, action) => { 28 | return { ...state, flights: action.flights }; 29 | }), 30 | on(delayFlight, (state, action) => { 31 | const flights = state.flights.map(f => f.id !== action.id ? f : updateDate(f) ) 32 | return { ...state, flights }; 33 | }) 34 | ) 35 | }); 36 | -------------------------------------------------------------------------------- /libs/booking/domain/src/lib/+state/selectors.ts: -------------------------------------------------------------------------------- 1 | import { createFeatureSelector, createSelector } from "@ngrx/store"; 2 | import { BookingState, BOOKING_FEATURE_KEY } from "./reducers"; 3 | 4 | export const selectBooking = createFeatureSelector(BOOKING_FEATURE_KEY); 5 | 6 | export const selectFlights = createSelector( 7 | selectBooking, 8 | booking => booking.flights 9 | ); 10 | -------------------------------------------------------------------------------- /libs/booking/domain/src/lib/domain.providers.ts: -------------------------------------------------------------------------------- 1 | // libs/booking/domain/src/lib/domain.providers.ts 2 | 3 | import { importProvidersFrom } from "@angular/core"; 4 | import { EffectsModule } from "@ngrx/effects"; 5 | import { StoreModule } from "@ngrx/store"; 6 | import { BookingEffects } from "./+state/effects"; 7 | import { bookingFeature } from "./+state/reducers"; 8 | 9 | export function forBookingDomain() { 10 | return [ 11 | importProvidersFrom(StoreModule.forFeature(bookingFeature)), 12 | importProvidersFrom(EffectsModule.forFeature([BookingEffects])), 13 | ]; 14 | } 15 | -------------------------------------------------------------------------------- /libs/booking/domain/src/lib/entities/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/libs/booking/domain/src/lib/entities/.gitkeep -------------------------------------------------------------------------------- /libs/booking/domain/src/lib/entities/flight.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface Flight { 3 | id: number; 4 | from: string; 5 | to: string; 6 | date: string; 7 | delayed: boolean; 8 | } 9 | 10 | export const initFlight: Flight = { 11 | id: 0, 12 | from: '', 13 | to: '', 14 | date: '', 15 | delayed: false 16 | }; 17 | -------------------------------------------------------------------------------- /libs/booking/domain/src/lib/infrastructure/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/libs/booking/domain/src/lib/infrastructure/.gitkeep -------------------------------------------------------------------------------- /libs/booking/domain/src/lib/infrastructure/flight.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Flight } from '../entities/flight'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class FlightService { 10 | flights: Flight[] = []; 11 | baseUrl = `http://www.angular.at/api`; 12 | 13 | reqDelay = 1000; 14 | 15 | constructor(private http: HttpClient) {} 16 | 17 | load(from: string, to: string, urgent: boolean): void { 18 | this.find(from, to, urgent).subscribe({ 19 | next: (flights) => { 20 | this.flights = flights; 21 | }, 22 | error: (err) => console.error('Error loading flights', err), 23 | }); 24 | } 25 | 26 | find( 27 | from: string, 28 | to: string, 29 | urgent: boolean = false 30 | ): Observable { 31 | // For offline access 32 | // let url = '/assets/data/data.json'; 33 | 34 | // For online access 35 | let url = [this.baseUrl, 'flight'].join('/'); 36 | 37 | if (urgent) { 38 | url = [this.baseUrl, 'error?code=403'].join('/'); 39 | } 40 | 41 | const params = new HttpParams().set('from', from).set('to', to); 42 | 43 | const headers = new HttpHeaders().set('Accept', 'application/json'); 44 | 45 | return this.http.get(url, { params, headers }); 46 | // return of(flights).pipe(delay(this.reqDelay)) 47 | } 48 | 49 | findById(id: string): Observable { 50 | const reqObj = { params: new HttpParams().set('id', id) }; 51 | const url = [this.baseUrl, 'flight'].join('/'); 52 | return this.http.get(url, reqObj); 53 | // return of(flights[0]).pipe(delay(this.reqDelay)) 54 | } 55 | 56 | save(flight: Flight): Observable { 57 | const url = [this.baseUrl, 'flight'].join('/'); 58 | return this.http.post(url, flight); 59 | } 60 | 61 | delay() { 62 | const ONE_MINUTE = 1000 * 60; 63 | 64 | const oldFlights = this.flights; 65 | const oldFlight = oldFlights[0]; 66 | const oldDate = new Date(oldFlight.date); 67 | 68 | // Mutable 69 | oldDate.setTime(oldDate.getTime() + 15 * ONE_MINUTE); 70 | oldFlight.date = oldDate.toISOString(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /libs/booking/domain/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular/setup-jest'; 2 | -------------------------------------------------------------------------------- /libs/booking/domain/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /libs/booking/domain/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "inlineSources": true, 8 | "types": [] 9 | }, 10 | "exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"], 11 | "include": ["**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /libs/booking/domain/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "compilerOptions": { 4 | "declarationMap": false 5 | }, 6 | "angularCompilerOptions": {} 7 | } 8 | -------------------------------------------------------------------------------- /libs/booking/domain/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "files": ["src/test-setup.ts"], 9 | "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /libs/booking/feature-book/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /libs/booking/feature-book/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "extends": [ 8 | "plugin:@nrwl/nx/angular", 9 | "plugin:@angular-eslint/template/process-inline-templates" 10 | ], 11 | "rules": { 12 | "@angular-eslint/directive-selector": [ 13 | "error", 14 | { 15 | "type": "attribute", 16 | "prefix": "flight", 17 | "style": "camelCase" 18 | } 19 | ], 20 | "@angular-eslint/component-selector": [ 21 | "error", 22 | { 23 | "type": "element", 24 | "prefix": "flight", 25 | "style": "kebab-case" 26 | } 27 | ] 28 | } 29 | }, 30 | { 31 | "files": ["*.html"], 32 | "extends": ["plugin:@nrwl/nx/angular-template"], 33 | "rules": {} 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /libs/booking/feature-book/README.md: -------------------------------------------------------------------------------- 1 | # booking-feature-book 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test booking-feature-book` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /libs/booking/feature-book/jest.config.ts: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | displayName: 'booking-feature-book', 3 | preset: '../../../jest.preset.ts', 4 | setupFilesAfterEnv: ['/src/test-setup.ts'], 5 | globals: { 6 | 'ts-jest': { 7 | tsconfig: '/tsconfig.spec.json', 8 | stringifyContentPathRegex: '\\.(html|svg)$', 9 | }, 10 | }, 11 | coverageDirectory: '../../../coverage/libs/booking/feature-book', 12 | transform: { 13 | '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular', 14 | }, 15 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 16 | snapshotSerializers: [ 17 | 'jest-preset-angular/build/serializers/no-ng-attributes', 18 | 'jest-preset-angular/build/serializers/ng-snapshot', 19 | 'jest-preset-angular/build/serializers/html-comment', 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /libs/booking/feature-book/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../../dist/libs/booking/feature-book", 4 | "lib": { 5 | "entryFile": "src/index.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /libs/booking/feature-book/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@nx-example/booking/feature-book", 3 | "version": "0.0.1", 4 | "peerDependencies": { 5 | "@angular/common": "^13.3.0", 6 | "@angular/core": "^13.3.0" 7 | }, 8 | "dependencies": { 9 | "tslib": "^2.3.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libs/booking/feature-book/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectType": "library", 3 | "root": "libs/booking/feature-book", 4 | "sourceRoot": "libs/booking/feature-book/src", 5 | "prefix": "booking", 6 | "targets": { 7 | "build": { 8 | "executor": "@nrwl/angular:ng-packagr-lite", 9 | "outputs": ["dist/libs/booking/feature-book"], 10 | "options": { 11 | "project": "libs/booking/feature-book/ng-package.json" 12 | }, 13 | "configurations": { 14 | "production": { 15 | "tsConfig": "libs/booking/feature-book/tsconfig.lib.prod.json" 16 | }, 17 | "development": { 18 | "tsConfig": "libs/booking/feature-book/tsconfig.lib.json" 19 | } 20 | }, 21 | "defaultConfiguration": "production" 22 | }, 23 | "test": { 24 | "executor": "@nrwl/jest:jest", 25 | "outputs": ["coverage/libs/booking/feature-book"], 26 | "options": { 27 | "jestConfig": "libs/booking/feature-book/jest.config.ts", 28 | "passWithNoTests": true 29 | } 30 | }, 31 | "lint": { 32 | "executor": "@nrwl/linter:eslint", 33 | "options": { 34 | "lintFilePatterns": [ 35 | "libs/booking/feature-book/**/*.ts", 36 | "libs/booking/feature-book/**/*.html" 37 | ] 38 | } 39 | } 40 | }, 41 | "tags": ["domain:booking", "type:feature"] 42 | } 43 | -------------------------------------------------------------------------------- /libs/booking/feature-book/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/flight-booking.routes'; 2 | export * from './lib/flight-booking.component'; -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/flight-booking.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 14 | 15 |
16 |
17 | 18 | -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/flight-booking.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from "@angular/core"; 2 | import { RouterModule } from "@angular/router"; 3 | 4 | @Component({ 5 | standalone: true, 6 | selector: 'flight-booking', 7 | imports: [ 8 | RouterModule, 9 | ], 10 | templateUrl: './flight-booking.component.html' 11 | }) 12 | export class FlightBookingComponent { 13 | } 14 | -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/flight-booking.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from "@angular/router"; 2 | import { forBookingDomain } from "@nx-example/booking/domain"; 3 | import { FlightBookingComponent } from "./flight-booking.component"; 4 | import { FlightEditComponent } from "./flight-edit/flight-edit.component"; 5 | import { FlightSearchComponent } from "./flight-search/flight-search.component"; 6 | import { PassengerSearchComponent } from "./passenger-search/passenger-search.component"; 7 | 8 | export const FLIGHT_BOOKING_ROUTES: Routes = [{ 9 | path: '', 10 | component: FlightBookingComponent, 11 | providers: [ 12 | forBookingDomain() 13 | ], 14 | children: [ 15 | { 16 | path: '', 17 | pathMatch: 'full', 18 | redirectTo: 'flight-search' 19 | }, 20 | { 21 | path: 'flight-search', 22 | component: FlightSearchComponent 23 | }, 24 | { 25 | path: 'passenger-search', 26 | component: PassengerSearchComponent 27 | }, 28 | { 29 | path: 'flight-edit/:id', 30 | component: FlightEditComponent 31 | } 32 | ] 33 | }]; 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | // { 42 | // provide: INJECTOR_INITIALIZER, 43 | // multi: true, 44 | // useValue: () => inject(InitService).init() 45 | // } 46 | -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/flight-edit/flight-edit.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/libs/booking/feature-book/src/lib/flight-edit/flight-edit.component.css -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/flight-edit/flight-edit.component.html: -------------------------------------------------------------------------------- 1 |

Flight Edit

2 | 3 |

Id: {{id}}

4 |

ShowDetails: {{showDetails}}

5 | -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/flight-edit/flight-edit.component.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { Component, Inject, OnInit } from '@angular/core'; 3 | import { ActivatedRoute, RouterModule } from '@angular/router'; 4 | 5 | @Component({ 6 | standalone: true, 7 | imports: [CommonModule, RouterModule], 8 | selector: 'app-flight-edit', 9 | templateUrl: './flight-edit.component.html', 10 | }) 11 | export class FlightEditComponent implements OnInit { 12 | 13 | id: string | undefined; 14 | showDetails: string | undefined; 15 | showWarning = false; 16 | 17 | constructor(@Inject(ActivatedRoute) private route: ActivatedRoute) {} 18 | 19 | ngOnInit() { 20 | this.route.params.subscribe((p) => { 21 | this.id = p['id']; 22 | this.showDetails = p['showDetails']; 23 | }); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/flight-search/flight-search.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/libs/booking/feature-book/src/lib/flight-search/flight-search.component.css -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/flight-search/flight-search.component.html: -------------------------------------------------------------------------------- 1 |

Flight Search

2 | 3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 |
11 | Invalid city! 12 |
13 | 14 |
15 | 16 | 17 |
18 |
19 | 24 |
25 | 26 |
27 | 30 | 31 | 34 | 35 |
36 | {{flights.length}} flights found! 37 |
38 | 39 |
40 |
41 | 42 |
43 |
44 | 45 | 46 |
47 |
48 | 49 |
{{ basket | json }}
-------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/flight-search/flight-search.component.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from "@angular/common"; 2 | import { Component, Inject } from "@angular/core"; 3 | import { FormsModule } from "@angular/forms"; 4 | import { Store } from "@ngrx/store"; 5 | import { BookingSlice, delayFlight, loadFlights, selectFlights } from "@nx-example/booking/domain"; 6 | import { FlightCardComponent } from "@nx-example/booking/ui-common"; 7 | import { CityValidator } from "@nx-example/shared/util-common"; 8 | import { take } from "rxjs"; 9 | 10 | @Component({ 11 | standalone: true, 12 | imports: [ 13 | CommonModule, 14 | FormsModule, 15 | FlightCardComponent, 16 | CityValidator, 17 | ], 18 | selector: 'flight-search', 19 | templateUrl: './flight-search.component.html' 20 | }) 21 | export class FlightSearchComponent { 22 | 23 | from = 'Hamburg'; // in Germany 24 | to = 'Graz'; // in Austria 25 | urgent = false; 26 | 27 | flights$ = this.store.select(selectFlights); 28 | 29 | basket: { [id: number]: boolean } = { 30 | 3: true, 31 | 5: true 32 | }; 33 | 34 | constructor(@Inject(Store) private store: Store) { 35 | } 36 | 37 | search(): void { 38 | if (!this.from || !this.to) return; 39 | 40 | this.store.dispatch(loadFlights({ 41 | from: this.from, 42 | to: this.to 43 | })); 44 | } 45 | 46 | delay(): void { 47 | this.flights$.pipe(take(1)).subscribe(flights => { 48 | const id = flights[0].id; 49 | this.store.dispatch(delayFlight({id})); 50 | }); 51 | } 52 | 53 | } 54 | 55 | -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/passenger-search/passenger-search.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/libs/booking/feature-book/src/lib/passenger-search/passenger-search.component.css -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/passenger-search/passenger-search.component.html: -------------------------------------------------------------------------------- 1 |

2 | passenger-search works! 3 |

4 | -------------------------------------------------------------------------------- /libs/booking/feature-book/src/lib/passenger-search/passenger-search.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from "@angular/core"; 2 | 3 | @Component({ 4 | standalone: true, 5 | selector: 'app-passenger-search', 6 | templateUrl: './passenger-search.component.html', 7 | }) 8 | export class PassengerSearchComponent { 9 | } 10 | -------------------------------------------------------------------------------- /libs/booking/feature-book/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular/setup-jest'; 2 | -------------------------------------------------------------------------------- /libs/booking/feature-book/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /libs/booking/feature-book/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "inlineSources": true, 8 | "types": [] 9 | }, 10 | "exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"], 11 | "include": ["**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /libs/booking/feature-book/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "compilerOptions": { 4 | "declarationMap": false 5 | }, 6 | "angularCompilerOptions": {} 7 | } 8 | -------------------------------------------------------------------------------- /libs/booking/feature-book/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "files": ["src/test-setup.ts"], 9 | "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "extends": [ 8 | "plugin:@nrwl/nx/angular", 9 | "plugin:@angular-eslint/template/process-inline-templates" 10 | ], 11 | "rules": { 12 | "@angular-eslint/directive-selector": [ 13 | "error", 14 | { 15 | "type": "attribute", 16 | "prefix": "app", 17 | "style": "camelCase" 18 | } 19 | ], 20 | "@angular-eslint/component-selector": [ 21 | "error", 22 | { 23 | "type": "element", 24 | "prefix": "app", 25 | "style": "kebab-case" 26 | } 27 | ] 28 | } 29 | }, 30 | { 31 | "files": ["*.html"], 32 | "extends": ["plugin:@nrwl/nx/angular-template"], 33 | "rules": {} 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/README.md: -------------------------------------------------------------------------------- 1 | # booking-feature-tickets 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test booking-feature-tickets` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/jest.config.ts: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | displayName: 'booking-feature-tickets', 3 | preset: '../../../jest.preset.ts', 4 | setupFilesAfterEnv: ['/src/test-setup.ts'], 5 | globals: { 6 | 'ts-jest': { 7 | tsconfig: '/tsconfig.spec.json', 8 | stringifyContentPathRegex: '\\.(html|svg)$', 9 | }, 10 | }, 11 | coverageDirectory: '../../../coverage/libs/booking/feature-tickets', 12 | transform: { 13 | '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular', 14 | }, 15 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 16 | snapshotSerializers: [ 17 | 'jest-preset-angular/build/serializers/no-ng-attributes', 18 | 'jest-preset-angular/build/serializers/ng-snapshot', 19 | 'jest-preset-angular/build/serializers/html-comment', 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../../dist/libs/booking/feature-tickets", 4 | "lib": { 5 | "entryFile": "src/index.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@nx-example/booking/feature-tickets", 3 | "version": "0.0.1", 4 | "peerDependencies": { 5 | "@angular/common": "^13.3.0", 6 | "@angular/core": "^13.3.0" 7 | }, 8 | "dependencies": { 9 | "tslib": "^2.3.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectType": "library", 3 | "root": "libs/booking/feature-tickets", 4 | "sourceRoot": "libs/booking/feature-tickets/src", 5 | "prefix": "booking", 6 | "targets": { 7 | "build": { 8 | "executor": "@nrwl/angular:ng-packagr-lite", 9 | "outputs": ["dist/libs/booking/feature-tickets"], 10 | "options": { 11 | "project": "libs/booking/feature-tickets/ng-package.json" 12 | }, 13 | "configurations": { 14 | "production": { 15 | "tsConfig": "libs/booking/feature-tickets/tsconfig.lib.prod.json" 16 | }, 17 | "development": { 18 | "tsConfig": "libs/booking/feature-tickets/tsconfig.lib.json" 19 | } 20 | }, 21 | "defaultConfiguration": "production" 22 | }, 23 | "test": { 24 | "executor": "@nrwl/jest:jest", 25 | "outputs": ["coverage/libs/booking/feature-tickets"], 26 | "options": { 27 | "jestConfig": "libs/booking/feature-tickets/jest.config.ts", 28 | "passWithNoTests": true 29 | } 30 | }, 31 | "lint": { 32 | "executor": "@nrwl/linter:eslint", 33 | "options": { 34 | "lintFilePatterns": [ 35 | "libs/booking/feature-tickets/**/*.ts", 36 | "libs/booking/feature-tickets/**/*.html" 37 | ] 38 | } 39 | } 40 | }, 41 | "tags": ["domain:booking", "type:feature"] 42 | } 43 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/my-tickets.component'; 2 | export * from './lib/next-flight.component'; 3 | export * from './lib/tickets.module'; 4 | export * from './lib/ticket.service'; 5 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/src/lib/my-tickets.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import { Flight } from '@nx-example/booking/domain'; 3 | import { TicketService } from './ticket.service'; 4 | 5 | @Component({ 6 | selector: 'app-my-tickets', 7 | template: ` 8 |

{{title}}

9 | 10 | 11 | 12 | 13 | ` 14 | }) 15 | export class MyTicketsComponent implements OnInit { 16 | 17 | @Input() title = 'My Tickets'; 18 | @Input() limit = -1; 19 | 20 | tickets: Flight[] = []; 21 | 22 | constructor(private ticketService: TicketService) { } 23 | 24 | ngOnInit(): void { 25 | this.tickets = this.ticketService.get(this.limit); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /libs/booking/feature-tickets/src/lib/next-flight.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { TicketsModule } from './tickets.module'; 3 | 4 | @Component({ 5 | selector: 'app-next-flight', 6 | standalone: true, 7 | template: ` 8 | 9 | `, 10 | imports: [ 11 | TicketsModule 12 | ] 13 | }) 14 | export class NextFlightComponent { 15 | } -------------------------------------------------------------------------------- /libs/booking/feature-tickets/src/lib/ticket.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Flight } from '@nx-example/booking/domain'; 3 | 4 | @Injectable() 5 | export class TicketService { 6 | 7 | readonly tickets: Flight[] = [ 8 | { id: 4711, from: 'Graz', to: 'Düsseldorf', delayed: false, date: new Date().toISOString()}, 9 | { id: 4712, from: 'Graz', to: 'Paderborn', delayed: false, date: new Date().toISOString()} 10 | ]; 11 | 12 | constructor() { 13 | console.log('creating ticket service'); 14 | } 15 | 16 | get(limit: number = -1) { 17 | if (limit === -1) { 18 | return this.tickets; 19 | } 20 | return this.tickets.slice(0, limit); 21 | } 22 | } -------------------------------------------------------------------------------- /libs/booking/feature-tickets/src/lib/tickets.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { MyTicketsComponent } from './my-tickets.component'; 4 | import { RouterModule } from '@angular/router'; 5 | import { TicketService } from './ticket.service'; 6 | import { FlightCardComponent } from '@nx-example/booking/ui-common'; 7 | 8 | // This is for demonstrating the interaction between 9 | // code that uses NgModules and code that doesn't. 10 | 11 | @NgModule({ 12 | imports: [ 13 | CommonModule, 14 | FlightCardComponent, 15 | RouterModule.forChild([ 16 | { path: 'my-tickets', component: MyTicketsComponent } 17 | ]) 18 | ], 19 | declarations: [ 20 | MyTicketsComponent 21 | ], 22 | providers: [ 23 | // For demo purposes 24 | // Please consider using providedIn: 'root' instead 25 | TicketService 26 | ], 27 | exports: [ 28 | MyTicketsComponent 29 | ] 30 | }) 31 | export class TicketsModule { } 32 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular/setup-jest'; 2 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "inlineSources": true, 8 | "types": [] 9 | }, 10 | "exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"], 11 | "include": ["**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "compilerOptions": { 4 | "declarationMap": false 5 | }, 6 | "angularCompilerOptions": {} 7 | } 8 | -------------------------------------------------------------------------------- /libs/booking/feature-tickets/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "files": ["src/test-setup.ts"], 9 | "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /libs/booking/ui-common/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /libs/booking/ui-common/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "extends": [ 8 | "plugin:@nrwl/nx/angular", 9 | "plugin:@angular-eslint/template/process-inline-templates" 10 | ], 11 | "rules": { 12 | "@angular-eslint/directive-selector": [ 13 | "error", 14 | { 15 | "type": "attribute", 16 | "prefix": "flight", 17 | "style": "camelCase" 18 | } 19 | ], 20 | "@angular-eslint/component-selector": [ 21 | "error", 22 | { 23 | "type": "element", 24 | "prefix": "flight", 25 | "style": "kebab-case" 26 | } 27 | ] 28 | } 29 | }, 30 | { 31 | "files": ["*.html"], 32 | "extends": ["plugin:@nrwl/nx/angular-template"], 33 | "rules": {} 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /libs/booking/ui-common/README.md: -------------------------------------------------------------------------------- 1 | # booking-ui-common 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test booking-ui-common` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /libs/booking/ui-common/jest.config.ts: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | displayName: 'booking-ui-common', 3 | preset: '../../../jest.preset.ts', 4 | setupFilesAfterEnv: ['/src/test-setup.ts'], 5 | globals: { 6 | 'ts-jest': { 7 | tsconfig: '/tsconfig.spec.json', 8 | stringifyContentPathRegex: '\\.(html|svg)$', 9 | }, 10 | }, 11 | coverageDirectory: '../../../coverage/libs/booking/ui-common', 12 | transform: { 13 | '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular', 14 | }, 15 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 16 | snapshotSerializers: [ 17 | 'jest-preset-angular/build/serializers/no-ng-attributes', 18 | 'jest-preset-angular/build/serializers/ng-snapshot', 19 | 'jest-preset-angular/build/serializers/html-comment', 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /libs/booking/ui-common/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../../dist/libs/booking/ui-common", 4 | "lib": { 5 | "entryFile": "src/index.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /libs/booking/ui-common/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@nx-example/booking/ui-common", 3 | "version": "0.0.1", 4 | "peerDependencies": { 5 | "@angular/common": "^13.3.0", 6 | "@angular/core": "^13.3.0" 7 | }, 8 | "dependencies": { 9 | "tslib": "^2.3.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libs/booking/ui-common/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectType": "library", 3 | "root": "libs/booking/ui-common", 4 | "sourceRoot": "libs/booking/ui-common/src", 5 | "prefix": "common", 6 | "targets": { 7 | "build": { 8 | "executor": "@nrwl/angular:ng-packagr-lite", 9 | "outputs": ["dist/libs/booking/ui-common"], 10 | "options": { 11 | "project": "libs/booking/ui-common/ng-package.json" 12 | }, 13 | "configurations": { 14 | "production": { 15 | "tsConfig": "libs/booking/ui-common/tsconfig.lib.prod.json" 16 | }, 17 | "development": { 18 | "tsConfig": "libs/booking/ui-common/tsconfig.lib.json" 19 | } 20 | }, 21 | "defaultConfiguration": "production" 22 | }, 23 | "test": { 24 | "executor": "@nrwl/jest:jest", 25 | "outputs": ["coverage/libs/booking/ui-common"], 26 | "options": { 27 | "jestConfig": "libs/booking/ui-common/jest.config.ts", 28 | "passWithNoTests": true 29 | } 30 | }, 31 | "lint": { 32 | "executor": "@nrwl/linter:eslint", 33 | "options": { 34 | "lintFilePatterns": [ 35 | "libs/booking/ui-common/**/*.ts", 36 | "libs/booking/ui-common/**/*.html" 37 | ] 38 | } 39 | } 40 | }, 41 | "tags": ["domain:booking", "type:ui"] 42 | } 43 | -------------------------------------------------------------------------------- /libs/booking/ui-common/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/flight-card/flight-card.component'; 2 | -------------------------------------------------------------------------------- /libs/booking/ui-common/src/lib/booking-ui-common.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | 4 | @NgModule({ 5 | imports: [CommonModule], 6 | }) 7 | export class BookingUiCommonModule {} 8 | -------------------------------------------------------------------------------- /libs/booking/ui-common/src/lib/flight-card/flight-card.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/libs/booking/ui-common/src/lib/flight-card/flight-card.component.css -------------------------------------------------------------------------------- /libs/booking/ui-common/src/lib/flight-card/flight-card.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |

{{item.from | city:'short' }} - {{item.to | city:'short'}}

5 |
6 | 7 |
8 |

Flight-No.: #{{item.id}}

9 |

Date: {{item.date | date:'dd.MM.yyyy HH:mm:ss'}}

10 |

11 | 12 | 13 | Edit 14 |

15 |
16 | 17 |
18 | -------------------------------------------------------------------------------- /libs/booking/ui-common/src/lib/flight-card/flight-card.component.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from "@angular/common"; 2 | import { Component, EventEmitter, Input, Output } from "@angular/core"; 3 | import { RouterModule } from "@angular/router"; 4 | import { Flight, initFlight } from "@nx-example/booking/domain"; 5 | import { CityPipe } from "@nx-example/shared/util-common"; 6 | 7 | @Component({ 8 | standalone: true, 9 | selector: 'flight-card', 10 | imports: [CommonModule, RouterModule, CityPipe], 11 | templateUrl: './flight-card.component.html', 12 | }) 13 | export class FlightCardComponent { 14 | 15 | @Input() item: Flight = initFlight; 16 | @Input() selected: boolean | undefined; 17 | @Output() selectedChange = new EventEmitter(); 18 | @Input() showEditButton = true; 19 | 20 | select() { 21 | this.selected = true; 22 | this.selectedChange.next(true); 23 | } 24 | 25 | deselect() { 26 | this.selected = false; 27 | this.selectedChange.next(false); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /libs/booking/ui-common/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular/setup-jest'; 2 | -------------------------------------------------------------------------------- /libs/booking/ui-common/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /libs/booking/ui-common/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "inlineSources": true, 8 | "types": [] 9 | }, 10 | "exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"], 11 | "include": ["**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /libs/booking/ui-common/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "compilerOptions": { 4 | "declarationMap": false 5 | }, 6 | "angularCompilerOptions": {} 7 | } 8 | -------------------------------------------------------------------------------- /libs/booking/ui-common/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "files": ["src/test-setup.ts"], 9 | "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "extends": [ 8 | "plugin:@nrwl/nx/angular", 9 | "plugin:@angular-eslint/template/process-inline-templates" 10 | ], 11 | "rules": { 12 | "@angular-eslint/directive-selector": [ 13 | "error", 14 | { 15 | "type": "attribute", 16 | "prefix": "app", 17 | "style": "camelCase" 18 | } 19 | ], 20 | "@angular-eslint/component-selector": [ 21 | "error", 22 | { 23 | "type": "element", 24 | "prefix": "app", 25 | "style": "kebab-case" 26 | } 27 | ] 28 | } 29 | }, 30 | { 31 | "files": ["*.html"], 32 | "extends": ["plugin:@nrwl/nx/angular-template"], 33 | "rules": {} 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/README.md: -------------------------------------------------------------------------------- 1 | # shared-ui-shell 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test shared-ui-shell` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/jest.config.ts: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | displayName: 'shared-ui-shell', 3 | preset: '../../../jest.preset.ts', 4 | setupFilesAfterEnv: ['/src/test-setup.ts'], 5 | globals: { 6 | 'ts-jest': { 7 | tsconfig: '/tsconfig.spec.json', 8 | stringifyContentPathRegex: '\\.(html|svg)$', 9 | }, 10 | }, 11 | coverageDirectory: '../../../coverage/libs/shared/ui-shell', 12 | transform: { 13 | '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular', 14 | }, 15 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 16 | snapshotSerializers: [ 17 | 'jest-preset-angular/build/serializers/no-ng-attributes', 18 | 'jest-preset-angular/build/serializers/ng-snapshot', 19 | 'jest-preset-angular/build/serializers/html-comment', 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../../dist/libs/shared/ui-shell", 4 | "lib": { 5 | "entryFile": "src/index.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@nx-example/shared/ui-shell", 3 | "version": "0.0.1", 4 | "peerDependencies": { 5 | "@angular/common": "^13.3.0", 6 | "@angular/core": "^13.3.0" 7 | }, 8 | "dependencies": { 9 | "tslib": "^2.3.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectType": "library", 3 | "root": "libs/shared/ui-shell", 4 | "sourceRoot": "libs/shared/ui-shell/src", 5 | "prefix": "shell", 6 | "targets": { 7 | "build": { 8 | "executor": "@nrwl/angular:ng-packagr-lite", 9 | "outputs": ["dist/libs/shared/ui-shell"], 10 | "options": { 11 | "project": "libs/shared/ui-shell/ng-package.json" 12 | }, 13 | "configurations": { 14 | "production": { 15 | "tsConfig": "libs/shared/ui-shell/tsconfig.lib.prod.json" 16 | }, 17 | "development": { 18 | "tsConfig": "libs/shared/ui-shell/tsconfig.lib.json" 19 | } 20 | }, 21 | "defaultConfiguration": "production" 22 | }, 23 | "test": { 24 | "executor": "@nrwl/jest:jest", 25 | "outputs": ["coverage/libs/shared/ui-shell"], 26 | "options": { 27 | "jestConfig": "libs/shared/ui-shell/jest.config.ts", 28 | "passWithNoTests": true 29 | } 30 | }, 31 | "lint": { 32 | "executor": "@nrwl/linter:eslint", 33 | "options": { 34 | "lintFilePatterns": [ 35 | "libs/shared/ui-shell/**/*.ts", 36 | "libs/shared/ui-shell/**/*.html" 37 | ] 38 | } 39 | } 40 | }, 41 | "tags": ["domain:shared", "type:ui"] 42 | } 43 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/src/index.ts: -------------------------------------------------------------------------------- 1 | export { NavbarComponent } from './lib/navbar/navbar.component'; 2 | export { SidebarComponent } from './lib/sidebar/sidebar.component'; 3 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/src/lib/navbar/navbar.component.html: -------------------------------------------------------------------------------- 1 | 2 | 9 | Flighs42 10 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/src/lib/navbar/navbar.component.ts: -------------------------------------------------------------------------------- 1 | import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; 2 | import { CommonModule } from '@angular/common'; 3 | import { Component, Inject } from '@angular/core'; 4 | import { MatIconModule } from '@angular/material/icon'; 5 | import { MatToolbarModule } from '@angular/material/toolbar'; 6 | import { map, shareReplay } from 'rxjs'; 7 | 8 | // import { FlightBookingComponent } from '@nx-example/booking/feature-book'; 9 | 10 | @Component({ 11 | standalone: true, 12 | selector: 'app-navbar-cmp', 13 | templateUrl: './navbar.component.html', 14 | imports: [ 15 | CommonModule, 16 | MatToolbarModule, 17 | MatIconModule 18 | ] 19 | }) 20 | export class NavbarComponent { 21 | isHandset$ = this.breakpointObserver.observe(Breakpoints.Handset) 22 | .pipe( 23 | map(result => result.matches), 24 | shareReplay() 25 | ); 26 | 27 | constructor( 28 | @Inject(BreakpointObserver) private breakpointObserver: BreakpointObserver) { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/src/lib/sidebar/sidebar.component.css: -------------------------------------------------------------------------------- 1 | .sidenav-container { 2 | height: 100%; 3 | } 4 | 5 | .sidenav { 6 | width: 200px; 7 | } 8 | 9 | .sidenav .mat-toolbar { 10 | background: inherit; 11 | } 12 | 13 | .mat-toolbar.mat-primary { 14 | position: sticky; 15 | top: 0; 16 | z-index: 1; 17 | } 18 | 19 | .app-container { 20 | padding: 20px; 21 | } -------------------------------------------------------------------------------- /libs/shared/ui-shell/src/lib/sidebar/sidebar.component.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | Menu 7 | 8 | Home 9 | Flights 10 | My Tickets 11 | Next Flight 12 | About 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/src/lib/sidebar/sidebar.component.ts: -------------------------------------------------------------------------------- 1 | import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; 2 | import { CommonModule } from '@angular/common'; 3 | import { Component, Inject } from '@angular/core'; 4 | import { MatButtonModule } from '@angular/material/button'; 5 | import { MatIconModule } from '@angular/material/icon'; 6 | import { MatListModule } from '@angular/material/list'; 7 | import { MatSidenavModule } from '@angular/material/sidenav'; 8 | import { MatToolbarModule } from '@angular/material/toolbar'; 9 | import { RouterModule } from '@angular/router'; 10 | import { map, shareReplay } from 'rxjs'; 11 | 12 | @Component({ 13 | standalone: true, 14 | selector: 'app-sidebar-cmp', 15 | imports: [ 16 | RouterModule, 17 | CommonModule, 18 | MatToolbarModule, 19 | MatButtonModule, 20 | MatSidenavModule, 21 | MatIconModule, 22 | MatListModule, 23 | ], 24 | templateUrl: './sidebar.component.html', 25 | styleUrls: ['./sidebar.component.css'] 26 | }) 27 | export class SidebarComponent { 28 | isHandset$ = this.breakpointObserver.observe(Breakpoints.Handset) 29 | .pipe( 30 | map(result => result.matches), 31 | shareReplay() 32 | ); 33 | 34 | constructor( 35 | @Inject(BreakpointObserver) private breakpointObserver: BreakpointObserver) { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular/setup-jest'; 2 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "inlineSources": true, 8 | "types": [] 9 | }, 10 | "exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"], 11 | "include": ["**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "compilerOptions": { 4 | "declarationMap": false 5 | }, 6 | "angularCompilerOptions": {} 7 | } 8 | -------------------------------------------------------------------------------- /libs/shared/ui-shell/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "files": ["src/test-setup.ts"], 9 | "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /libs/shared/util-common/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /libs/shared/util-common/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "extends": [ 8 | "plugin:@nrwl/nx/angular", 9 | "plugin:@angular-eslint/template/process-inline-templates" 10 | ], 11 | "rules": { 12 | "@angular-eslint/directive-selector": [ 13 | "error", 14 | { 15 | "type": "attribute", 16 | "prefix": "app", 17 | "style": "camelCase" 18 | } 19 | ], 20 | "@angular-eslint/component-selector": [ 21 | "error", 22 | { 23 | "type": "element", 24 | "prefix": "app", 25 | "style": "kebab-case" 26 | } 27 | ] 28 | } 29 | }, 30 | { 31 | "files": ["*.html"], 32 | "extends": ["plugin:@nrwl/nx/angular-template"], 33 | "rules": {} 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /libs/shared/util-common/README.md: -------------------------------------------------------------------------------- 1 | # shared-util-common 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test shared-util-common` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /libs/shared/util-common/jest.config.ts: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | displayName: 'shared-util-common', 3 | preset: '../../../jest.preset.ts', 4 | setupFilesAfterEnv: ['/src/test-setup.ts'], 5 | globals: { 6 | 'ts-jest': { 7 | tsconfig: '/tsconfig.spec.json', 8 | stringifyContentPathRegex: '\\.(html|svg)$', 9 | }, 10 | }, 11 | coverageDirectory: '../../../coverage/libs/shared/util-common', 12 | transform: { 13 | '^.+\\.(ts|mjs|js|html)$': 'jest-preset-angular', 14 | }, 15 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 16 | snapshotSerializers: [ 17 | 'jest-preset-angular/build/serializers/no-ng-attributes', 18 | 'jest-preset-angular/build/serializers/ng-snapshot', 19 | 'jest-preset-angular/build/serializers/html-comment', 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /libs/shared/util-common/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../../dist/libs/shared/util-common", 4 | "lib": { 5 | "entryFile": "src/index.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /libs/shared/util-common/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@nx-example/shared/util-common", 3 | "version": "0.0.1", 4 | "peerDependencies": { 5 | "@angular/common": "^13.3.0", 6 | "@angular/core": "^13.3.0" 7 | }, 8 | "dependencies": { 9 | "tslib": "^2.3.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libs/shared/util-common/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectType": "library", 3 | "root": "libs/shared/util-common", 4 | "sourceRoot": "libs/shared/util-common/src", 5 | "prefix": "common", 6 | "targets": { 7 | "build": { 8 | "executor": "@nrwl/angular:ng-packagr-lite", 9 | "outputs": ["dist/libs/shared/util-common"], 10 | "options": { 11 | "project": "libs/shared/util-common/ng-package.json" 12 | }, 13 | "configurations": { 14 | "production": { 15 | "tsConfig": "libs/shared/util-common/tsconfig.lib.prod.json" 16 | }, 17 | "development": { 18 | "tsConfig": "libs/shared/util-common/tsconfig.lib.json" 19 | } 20 | }, 21 | "defaultConfiguration": "production" 22 | }, 23 | "test": { 24 | "executor": "@nrwl/jest:jest", 25 | "outputs": ["coverage/libs/shared/util-common"], 26 | "options": { 27 | "jestConfig": "libs/shared/util-common/jest.config.ts", 28 | "passWithNoTests": true 29 | } 30 | }, 31 | "lint": { 32 | "executor": "@nrwl/linter:eslint", 33 | "options": { 34 | "lintFilePatterns": [ 35 | "libs/shared/util-common/**/*.ts", 36 | "libs/shared/util-common/**/*.html" 37 | ] 38 | } 39 | } 40 | }, 41 | "tags": ["domain:shared", "type:util"] 42 | } 43 | -------------------------------------------------------------------------------- /libs/shared/util-common/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/city.pipe'; 2 | export * from './lib/city.validator'; 3 | -------------------------------------------------------------------------------- /libs/shared/util-common/src/lib/city.pipe.ts: -------------------------------------------------------------------------------- 1 | import {Pipe, PipeTransform} from '@angular/core'; 2 | 3 | @Pipe({ 4 | standalone: true, 5 | name: 'city', 6 | pure: true 7 | }) 8 | export class CityPipe implements PipeTransform { 9 | 10 | transform(value: string, fmt: string): string { 11 | 12 | let short, long; 13 | 14 | switch (value) { 15 | case 'Hamburg': 16 | short = 'HAM'; 17 | long = 'Airport Hamburg Fulsbüttel Helmut Schmidt'; 18 | break; 19 | case 'Graz': 20 | short = 'GRZ'; 21 | long = 'Flughafen Graz Thalerhof'; 22 | break; 23 | default: 24 | short = long = value; //'ROM'; 25 | } 26 | 27 | if (fmt === 'short') return short; 28 | return long; 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /libs/shared/util-common/src/lib/city.validator.ts: -------------------------------------------------------------------------------- 1 | import { Directive } from '@angular/core'; 2 | import { Validator, AbstractControl, NG_VALIDATORS, ValidationErrors } from '@angular/forms'; 3 | 4 | @Directive({ 5 | standalone: true, 6 | selector: 'input[appCity]', 7 | providers: [ 8 | { 9 | provide: NG_VALIDATORS, 10 | useExisting: CityValidator, 11 | multi: true 12 | } 13 | ] 14 | }) 15 | export class CityValidator implements Validator { 16 | 17 | public validate(c: AbstractControl): ValidationErrors { 18 | 19 | if (c.value === 'Graz' 20 | || c.value === 'Hamburg' 21 | || c.value === 'Frankfurt' 22 | || c.value === 'Wien' 23 | || c.value === 'Mallorca') { 24 | 25 | return {}; 26 | } 27 | 28 | return { 29 | appCity: true 30 | }; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /libs/shared/util-common/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular/setup-jest'; 2 | -------------------------------------------------------------------------------- /libs/shared/util-common/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.base.json", 3 | "files": [], 4 | "include": [], 5 | "references": [ 6 | { 7 | "path": "./tsconfig.lib.json" 8 | }, 9 | { 10 | "path": "./tsconfig.spec.json" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /libs/shared/util-common/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "inlineSources": true, 8 | "types": [] 9 | }, 10 | "exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"], 11 | "include": ["**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /libs/shared/util-common/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "compilerOptions": { 4 | "declarationMap": false 5 | }, 6 | "angularCompilerOptions": {} 7 | } 8 | -------------------------------------------------------------------------------- /libs/shared/util-common/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "files": ["src/test-setup.ts"], 9 | "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /nx.json: -------------------------------------------------------------------------------- 1 | { 2 | "npmScope": "nx-example", 3 | "affected": { 4 | "defaultBase": "main" 5 | }, 6 | "cli": { 7 | "defaultCollection": "@nrwl/angular", 8 | "packageManager": "npm" 9 | }, 10 | "implicitDependencies": { 11 | "package.json": { 12 | "dependencies": "*", 13 | "devDependencies": "*" 14 | }, 15 | ".eslintrc.json": "*" 16 | }, 17 | "tasksRunnerOptions": { 18 | "default": { 19 | "runner": "nx/tasks-runners/default", 20 | "options": { 21 | "cacheableOperations": ["build", "lint", "test", "e2e"] 22 | } 23 | } 24 | }, 25 | "targetDependencies": { 26 | "build": [ 27 | { 28 | "target": "build", 29 | "projects": "dependencies" 30 | } 31 | ] 32 | }, 33 | "generators": { 34 | "@nrwl/angular:application": { 35 | "style": "css", 36 | "linter": "eslint", 37 | "unitTestRunner": "jest", 38 | "e2eTestRunner": "cypress" 39 | }, 40 | "@nrwl/angular:library": { 41 | "linter": "eslint", 42 | "unitTestRunner": "jest" 43 | }, 44 | "@nrwl/angular:component": { 45 | "style": "css" 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nx-example", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "ng": "nx", 7 | "postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main", 8 | "start": "nx serve", 9 | "build": "nx build", 10 | "test": "nx test" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular-architects/paper-design": "^1.0.2", 15 | "@angular/animations": "^14.0.0", 16 | "@angular/cdk": "^14.0.0", 17 | "@angular/common": "^14.0.0", 18 | "@angular/compiler": "^14.0.0", 19 | "@angular/core": "^14.0.0", 20 | "@angular/forms": "^14.0.0", 21 | "@angular/material": "^14.0.0", 22 | "@angular/platform-browser": "^14.0.0", 23 | "@angular/platform-browser-dynamic": "^14.0.0", 24 | "@angular/router": "^14.0.0", 25 | "@ngrx/effects": "^14.0.0", 26 | "@ngrx/store": "^14.0.0", 27 | "@ngrx/store-devtools": "^14.0.0", 28 | "@nrwl/angular": "14.0.5", 29 | "rxjs": "~7.5.0", 30 | "tslib": "^2.0.0", 31 | "zone.js": "~0.11.4" 32 | }, 33 | "devDependencies": { 34 | "@angular-architects/ddd": "^2.0.0", 35 | "@angular-devkit/build-angular": "14.0.0", 36 | "@angular-eslint/eslint-plugin": "~13.1.0", 37 | "@angular-eslint/eslint-plugin-template": "~13.1.0", 38 | "@angular-eslint/template-parser": "~13.1.0", 39 | "@angular/cli": "14.0.0", 40 | "@angular/compiler-cli": "^14.0.0", 41 | "@angular/language-service": "^14.0.0", 42 | "@nrwl/cli": "14.0.5", 43 | "@nrwl/cypress": "14.0.5", 44 | "@nrwl/eslint-plugin-nx": "14.0.5", 45 | "@nrwl/jest": "14.0.5", 46 | "@nrwl/linter": "14.0.5", 47 | "@nrwl/workspace": "14.0.5", 48 | "@types/jest": "27.4.1", 49 | "@types/node": "16.11.7", 50 | "@typescript-eslint/eslint-plugin": "~5.18.0", 51 | "@typescript-eslint/parser": "~5.18.0", 52 | "cypress": "^9.1.0", 53 | "eslint": "~8.12.0", 54 | "eslint-config-prettier": "8.1.0", 55 | "eslint-plugin-cypress": "^2.10.3", 56 | "jest": "27.5.1", 57 | "jest-preset-angular": "11.1.1", 58 | "ng-packagr": "^14.0.0", 59 | "nx": "14.0.5", 60 | "postcss": "^8.4.5", 61 | "postcss-import": "^14.0.2", 62 | "postcss-preset-env": "^6.7.0", 63 | "postcss-url": "^10.1.1", 64 | "prettier": "^2.5.1", 65 | "ts-jest": "27.1.4", 66 | "ts-node": "9.1.1", 67 | "typescript": "~4.6.2" 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /tools/generators/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manfredsteyer/demo-nx-standalone/a032d9cc8f745ef83f0c2195e0f860931309bd78/tools/generators/.gitkeep -------------------------------------------------------------------------------- /tools/tsconfig.tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "../dist/out-tsc/tools", 5 | "rootDir": ".", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": ["node"], 9 | "importHelpers": false 10 | }, 11 | "include": ["**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "importHelpers": true, 11 | "target": "es2015", 12 | "module": "esnext", 13 | "lib": ["es2017", "dom"], 14 | "skipLibCheck": true, 15 | "skipDefaultLibCheck": true, 16 | "baseUrl": ".", 17 | "paths": { 18 | "@nx-example/boarding/domain": ["libs/boarding/domain/index.ts"], 19 | 20 | "@nx-example/booking/domain": ["libs/booking/domain/src/index.ts"], 21 | "@nx-example/booking/feature-book": [ 22 | "libs/booking/feature-book/src/index.ts" 23 | ], 24 | "@nx-example/booking/feature-tickets": [ 25 | "libs/booking/feature-tickets/src/index.ts" 26 | ], 27 | "@nx-example/booking/ui-common": ["libs/booking/ui-common/src/index.ts"], 28 | "@nx-example/shared/ui-shell": ["libs/shared/ui-shell/src/index.ts"], 29 | "@nx-example/shared/util-common": ["libs/shared/util-common/src/index.ts"] 30 | } 31 | }, 32 | "exclude": ["node_modules", "tmp"] 33 | } 34 | --------------------------------------------------------------------------------