├── .cz-config.ts ├── .eslintignore ├── .eslintrc.base.json ├── .eslintrc.json ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .husky ├── commit-msg ├── pre-commit └── prepare-commit-msg ├── .lintstagedrc ├── .prettierignore ├── .prettierrc ├── .vscode └── extensions.json ├── README.md ├── commitlint.config.ts ├── e2e ├── .eslintrc.json ├── cypress.config.ts ├── project.json ├── src │ ├── e2e │ │ └── app.cy.ts │ ├── fixtures │ │ └── example.json │ └── support │ │ ├── app.po.ts │ │ ├── commands.ts │ │ └── e2e.ts └── tsconfig.json ├── jest.config.app.ts ├── jest.config.ts ├── jest.preset.js ├── modules ├── orders │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── project.json │ ├── src │ │ ├── index.ts │ │ ├── lib │ │ │ ├── orders.module.ts │ │ │ ├── orders.routing.module.ts │ │ │ └── orders │ │ │ │ ├── orders.component.html │ │ │ │ ├── orders.component.scss │ │ │ │ ├── orders.component.spec.ts │ │ │ │ └── orders.component.ts │ │ └── test-setup.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── products │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── project.json │ ├── src │ │ ├── index.ts │ │ ├── lib │ │ │ ├── products.module.ts │ │ │ ├── products.routing.module.ts │ │ │ └── products │ │ │ │ ├── products.component.html │ │ │ │ ├── products.component.scss │ │ │ │ ├── products.component.spec.ts │ │ │ │ └── products.component.ts │ │ └── test-setup.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json └── shared │ └── ui │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── project.json │ ├── src │ ├── index.ts │ ├── lib │ │ └── ui │ │ │ ├── ui.component.css │ │ │ ├── ui.component.html │ │ │ ├── ui.component.spec.ts │ │ │ └── ui.component.ts │ └── test-setup.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── nx.json ├── package-lock.json ├── package.json ├── project.json ├── src ├── app │ ├── app.component.html │ ├── app.component.scss │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── app.routes.ts │ ├── hello-world │ │ ├── hello-world.component.html │ │ ├── hello-world.component.scss │ │ ├── hello-world.component.spec.ts │ │ └── hello-world.component.ts │ └── nx-welcome.component.ts ├── assets │ └── .gitkeep ├── favicon.ico ├── index.html ├── main.ts ├── styles.scss └── test-setup.ts ├── tsconfig.app.json ├── tsconfig.base.json ├── tsconfig.editor.json ├── tsconfig.json └── tsconfig.spec.json /.cz-config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | path: '@commitlint/cz-commitlint', 3 | }; 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.eslintrc.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "ignorePatterns": ["**/*"], 4 | "plugins": ["@nx"], 5 | "overrides": [ 6 | { 7 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 8 | "rules": { 9 | "@nx/enforce-module-boundaries": [ 10 | "error", 11 | { 12 | "enforceBuildableLibDependency": true, 13 | "allow": [], 14 | "depConstraints": [ 15 | { 16 | "sourceTag": "*", 17 | "onlyDependOnLibsWithTags": ["*"] 18 | }, 19 | { 20 | "sourceTag": "type:feature", 21 | "onlyDependOnLibsWithTags": ["type:feature", "type:ui"] 22 | }, 23 | { 24 | "sourceTag": "type:ui", 25 | "onlyDependOnLibsWithTags": ["type:ui"] 26 | }, 27 | { 28 | "sourceTag": "scope:orders", 29 | "onlyDependOnLibsWithTags": [ 30 | "scope:orders", 31 | "scope:products", 32 | "scope:shared" 33 | ] 34 | }, 35 | { 36 | "sourceTag": "scope:products", 37 | "onlyDependOnLibsWithTags": ["scope:products", "scope:shared"] 38 | }, 39 | { 40 | "sourceTag": "scope:shared", 41 | "onlyDependOnLibsWithTags": ["scope:shared"] 42 | } 43 | ] 44 | } 45 | ], 46 | "no-console": ["error"], 47 | "@typescript-eslint/no-unused-vars": ["error"], 48 | "@typescript-eslint/no-explicit-any": ["error"] 49 | } 50 | }, 51 | { 52 | "files": ["*.ts", "*.tsx"], 53 | "extends": ["plugin:@nx/typescript"], 54 | "rules": {} 55 | }, 56 | { 57 | "files": ["*.js", "*.jsx"], 58 | "extends": ["plugin:@nx/javascript"], 59 | "rules": {} 60 | }, 61 | { 62 | "files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], 63 | "env": { 64 | "jest": true 65 | } 66 | } 67 | ] 68 | } 69 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignorePatterns": ["!**/*"], 3 | "overrides": [ 4 | { 5 | "files": ["*.ts"], 6 | "extends": [ 7 | "plugin:@nx/angular", 8 | "plugin:@angular-eslint/template/process-inline-templates" 9 | ], 10 | "rules": { 11 | "@angular-eslint/directive-selector": [ 12 | "error", 13 | { 14 | "type": "attribute", 15 | "prefix": "app", 16 | "style": "camelCase" 17 | } 18 | ], 19 | "@angular-eslint/component-selector": [ 20 | "error", 21 | { 22 | "type": "element", 23 | "prefix": "app", 24 | "style": "kebab-case" 25 | } 26 | ] 27 | } 28 | }, 29 | { 30 | "files": ["*.html"], 31 | "extends": ["plugin:@nx/angular-template"], 32 | "rules": {} 33 | } 34 | ], 35 | "extends": ["./.eslintrc.base.json"] 36 | } 37 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | 8 | jobs: 9 | main: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | with: 14 | fetch-depth: 0 15 | - uses: nrwl/nx-set-shas@v3 16 | - run: npm ci 17 | 18 | - run: npx nx format:check 19 | - run: npx nx affected -t lint --parallel=3 20 | - run: npx nx affected -t test --parallel=3 --configuration=ci 21 | - run: npx nx affected -t build --parallel=3 22 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no-install commitlint --edit "$1" -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /.husky/prepare-commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | exec < /dev/tty && node_modules/.bin/cz --hook || true -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "{src,modules}/**/*.{js,ts,jsx,tsx,json,html,css,scss}": [ 3 | "nx affected:lint --fix true --uncommitted", 4 | "nx affected:test", 5 | "nx format:write --uncommited" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Add files here to ignore them from prettier formatting 2 | /dist 3 | /coverage 4 | .angular 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "nrwl.angular-console", 4 | "esbenp.prettier-vscode", 5 | "firsttris.vscode-jest-runner", 6 | "dbaeumer.vscode-eslint" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MyApp 2 | 3 | 4 | 5 | ✨ **This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)** ✨ 6 | 7 | 8 | ## Start the app 9 | 10 | To start the development server run `nx serve my-app`. Open your browser and navigate to http://localhost:4200/. Happy coding! 11 | 12 | 13 | ## Generate code 14 | 15 | If you happen to use Nx plugins, you can leverage code generators that might come with it. 16 | 17 | Run `nx list` to get a list of available plugins and whether they have generators. Then run `nx list ` to see what generators are available. 18 | 19 | Learn more about [Nx generators on the docs](https://nx.dev/plugin-features/use-code-generators). 20 | 21 | ## Running tasks 22 | 23 | To execute tasks with Nx use the following syntax: 24 | 25 | ``` 26 | nx <...options> 27 | ``` 28 | 29 | You can also run multiple targets: 30 | 31 | ``` 32 | nx run-many -t 33 | ``` 34 | 35 | ..or add `-p` to filter specific projects 36 | 37 | ``` 38 | nx run-many -t -p 39 | ``` 40 | 41 | Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/core-features/run-tasks). 42 | 43 | ## Want better Editor Integration? 44 | 45 | Have a look at the [Nx Console extensions](https://nx.dev/nx-console). It provides autocomplete support, a UI for exploring and running tasks & generators, and more! Available for VSCode, IntelliJ and comes with a LSP for Vim users. 46 | 47 | ## Ready to deploy? 48 | 49 | Just run `nx build demoapp` to build the application. The build artifacts will be stored in the `dist/` directory, ready to be deployed. 50 | 51 | ## Set up CI! 52 | 53 | Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further. 54 | 55 | - [Set up remote caching](https://nx.dev/core-features/share-your-cache) 56 | - [Set up task distribution across multiple machines](https://nx.dev/core-features/distribute-task-execution) 57 | - [Learn more how to setup CI](https://nx.dev/recipes/ci) 58 | 59 | ## Connect with us! 60 | 61 | - [Join the community](https://nx.dev/community) 62 | - [Subscribe to the Nx Youtube Channel](https://www.youtube.com/@nxdevtools) 63 | - [Follow us on Twitter](https://twitter.com/nxdevtools) 64 | -------------------------------------------------------------------------------- /commitlint.config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | extends: ['@commitlint/config-conventional', '@commitlint/config-nx-scopes'], 3 | }; 4 | -------------------------------------------------------------------------------- /e2e/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["plugin:cypress/recommended", "../.eslintrc.base.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 11 | "rules": {} 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /e2e/cypress.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'cypress'; 2 | import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset'; 3 | 4 | export default defineConfig({ 5 | e2e: nxE2EPreset(__dirname), 6 | }); 7 | -------------------------------------------------------------------------------- /e2e/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "e2e", 3 | "$schema": "../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "e2e/src", 5 | "projectType": "application", 6 | "targets": { 7 | "e2e": { 8 | "executor": "@nx/cypress:cypress", 9 | "options": { 10 | "cypressConfig": "e2e/cypress.config.ts", 11 | "devServerTarget": "my-app:serve:development", 12 | "testingType": "e2e" 13 | }, 14 | "configurations": { 15 | "production": { 16 | "devServerTarget": "my-app:serve:production" 17 | }, 18 | "ci": { 19 | "devServerTarget": "my-app:serve-static" 20 | } 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/linter:eslint", 25 | "outputs": ["{options.outputFile}"], 26 | "options": { 27 | "lintFilePatterns": ["e2e/**/*.{js,ts}"] 28 | } 29 | } 30 | }, 31 | "tags": [], 32 | "implicitDependencies": ["my-app"] 33 | } 34 | -------------------------------------------------------------------------------- /e2e/src/e2e/app.cy.ts: -------------------------------------------------------------------------------- 1 | import { getGreeting } from '../support/app.po'; 2 | 3 | describe('my-app', () => { 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 my-app'); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /e2e/src/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io" 4 | } 5 | -------------------------------------------------------------------------------- /e2e/src/support/app.po.ts: -------------------------------------------------------------------------------- 1 | export const getGreeting = () => cy.get('h1'); 2 | -------------------------------------------------------------------------------- /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 | 20 | // 21 | // -- This is a child command -- 22 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) 23 | // 24 | // 25 | // -- This is a dual command -- 26 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) 27 | // 28 | // 29 | // -- This will overwrite an existing command -- 30 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) 31 | -------------------------------------------------------------------------------- /e2e/src/support/e2e.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 | -------------------------------------------------------------------------------- /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", "cypress.config.ts"] 16 | } 17 | -------------------------------------------------------------------------------- /jest.config.app.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'my-app', 4 | preset: './jest.preset.js', 5 | setupFilesAfterEnv: ['/src/test-setup.ts'], 6 | coverageDirectory: './coverage/my-app', 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | 'jest-preset-angular', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | snapshotSerializers: [ 18 | 'jest-preset-angular/build/serializers/no-ng-attributes', 19 | 'jest-preset-angular/build/serializers/ng-snapshot', 20 | 'jest-preset-angular/build/serializers/html-comment', 21 | ], 22 | testMatch: [ 23 | '/src/**/__tests__/**/*.[jt]s?(x)', 24 | '/src/**/*(*.)@(spec|test).[jt]s?(x)', 25 | ], 26 | }; 27 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | import { getJestProjects } from '@nx/jest'; 2 | 3 | export default { 4 | projects: getJestProjects(), 5 | }; 6 | -------------------------------------------------------------------------------- /jest.preset.js: -------------------------------------------------------------------------------- 1 | const nxPreset = require('@nx/jest/preset').default; 2 | 3 | module.exports = { ...nxPreset }; 4 | -------------------------------------------------------------------------------- /modules/orders/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.base.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "rules": { 8 | "@angular-eslint/directive-selector": [ 9 | "error", 10 | { 11 | "type": "attribute", 12 | "prefix": "lib", 13 | "style": "camelCase" 14 | } 15 | ], 16 | "@angular-eslint/component-selector": [ 17 | "error", 18 | { 19 | "type": "element", 20 | "prefix": "lib", 21 | "style": "kebab-case" 22 | } 23 | ] 24 | }, 25 | "extends": [ 26 | "plugin:@nx/angular", 27 | "plugin:@angular-eslint/template/process-inline-templates" 28 | ] 29 | }, 30 | { 31 | "files": ["*.html"], 32 | "extends": ["plugin:@nx/angular-template"], 33 | "rules": {} 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /modules/orders/README.md: -------------------------------------------------------------------------------- 1 | # modules-orders 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test modules-orders` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /modules/orders/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'modules-orders', 4 | preset: '../../jest.preset.js', 5 | setupFilesAfterEnv: ['/src/test-setup.ts'], 6 | coverageDirectory: '../../coverage/modules/orders', 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | 'jest-preset-angular', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | snapshotSerializers: [ 18 | 'jest-preset-angular/build/serializers/no-ng-attributes', 19 | 'jest-preset-angular/build/serializers/ng-snapshot', 20 | 'jest-preset-angular/build/serializers/html-comment', 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /modules/orders/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "modules-orders", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "modules/orders/src", 5 | "prefix": "lib", 6 | "tags": ["type:feature", "scope:orders"], 7 | "projectType": "library", 8 | "targets": { 9 | "test": { 10 | "executor": "@nx/jest:jest", 11 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 12 | "options": { 13 | "jestConfig": "modules/orders/jest.config.ts", 14 | "passWithNoTests": true 15 | }, 16 | "configurations": { 17 | "ci": { 18 | "ci": true, 19 | "codeCoverage": true 20 | } 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/linter:eslint", 25 | "outputs": ["{options.outputFile}"], 26 | "options": { 27 | "lintFilePatterns": [ 28 | "modules/orders/**/*.ts", 29 | "modules/orders/**/*.html" 30 | ] 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /modules/orders/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/orders.module'; 2 | -------------------------------------------------------------------------------- /modules/orders/src/lib/orders.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule } from '@angular/core'; 3 | import { UiComponent } from 'modules/shared/ui'; 4 | import { OrdersRoutingModule } from './orders.routing.module'; 5 | import { OrdersComponent } from './orders/orders.component'; 6 | 7 | @NgModule({ 8 | imports: [CommonModule, OrdersRoutingModule, UiComponent], 9 | declarations: [OrdersComponent], 10 | }) 11 | export class OrdersModule {} 12 | -------------------------------------------------------------------------------- /modules/orders/src/lib/orders.routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { OrdersComponent } from './orders/orders.component'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: OrdersComponent, 9 | }, 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule], 15 | }) 16 | export class OrdersRoutingModule {} 17 | -------------------------------------------------------------------------------- /modules/orders/src/lib/orders/orders.component.html: -------------------------------------------------------------------------------- 1 |

Página de produtos

2 | 3 | 4 | -------------------------------------------------------------------------------- /modules/orders/src/lib/orders/orders.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewarosario/nx-angular/9c1793ed304d80a2b717104e21399d442ecae382/modules/orders/src/lib/orders/orders.component.scss -------------------------------------------------------------------------------- /modules/orders/src/lib/orders/orders.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { UiComponent } from 'modules/shared/ui'; 3 | import { OrdersComponent } from './orders.component'; 4 | 5 | describe('OrdersComponent', () => { 6 | let component: OrdersComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [UiComponent], 12 | declarations: [OrdersComponent], 13 | }).compileComponents(); 14 | 15 | fixture = TestBed.createComponent(OrdersComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /modules/orders/src/lib/orders/orders.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'lib-orders', 5 | templateUrl: './orders.component.html', 6 | styleUrls: ['./orders.component.scss'], 7 | }) 8 | export class OrdersComponent {} 9 | -------------------------------------------------------------------------------- /modules/orders/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | // @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment 2 | globalThis.ngJest = { 3 | testEnvironmentOptions: { 4 | errorOnUnknownElements: true, 5 | errorOnUnknownProperties: true, 6 | }, 7 | }; 8 | import 'jest-preset-angular/setup-jest'; 9 | -------------------------------------------------------------------------------- /modules/orders/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2022", 4 | "useDefineForClassFields": false, 5 | "forceConsistentCasingInFileNames": true, 6 | "strict": true, 7 | "noImplicitOverride": true, 8 | "noPropertyAccessFromIndexSignature": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true 11 | }, 12 | "files": [], 13 | "include": [], 14 | "references": [ 15 | { 16 | "path": "./tsconfig.lib.json" 17 | }, 18 | { 19 | "path": "./tsconfig.spec.json" 20 | } 21 | ], 22 | "extends": "../../tsconfig.base.json", 23 | "angularCompilerOptions": { 24 | "enableI18nLegacyMessageIdFormat": false, 25 | "strictInjectionParameters": true, 26 | "strictInputAccessModifiers": true, 27 | "strictTemplates": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /modules/orders/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": [ 11 | "src/**/*.spec.ts", 12 | "src/test-setup.ts", 13 | "jest.config.ts", 14 | "src/**/*.test.ts" 15 | ], 16 | "include": ["src/**/*.ts"] 17 | } 18 | -------------------------------------------------------------------------------- /modules/orders/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "target": "es2016", 7 | "types": ["jest", "node"] 8 | }, 9 | "files": ["src/test-setup.ts"], 10 | "include": [ 11 | "jest.config.ts", 12 | "src/**/*.test.ts", 13 | "src/**/*.spec.ts", 14 | "src/**/*.d.ts" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /modules/products/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.base.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "rules": { 8 | "@angular-eslint/directive-selector": [ 9 | "error", 10 | { 11 | "type": "attribute", 12 | "prefix": "lib", 13 | "style": "camelCase" 14 | } 15 | ], 16 | "@angular-eslint/component-selector": [ 17 | "error", 18 | { 19 | "type": "element", 20 | "prefix": "lib", 21 | "style": "kebab-case" 22 | } 23 | ] 24 | }, 25 | "extends": [ 26 | "plugin:@nx/angular", 27 | "plugin:@angular-eslint/template/process-inline-templates" 28 | ] 29 | }, 30 | { 31 | "files": ["*.html"], 32 | "extends": ["plugin:@nx/angular-template"], 33 | "rules": {} 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /modules/products/README.md: -------------------------------------------------------------------------------- 1 | # modules-products 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test modules-products` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /modules/products/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'modules-products', 4 | preset: '../../jest.preset.js', 5 | setupFilesAfterEnv: ['/src/test-setup.ts'], 6 | coverageDirectory: '../../coverage/modules/products', 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | 'jest-preset-angular', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | snapshotSerializers: [ 18 | 'jest-preset-angular/build/serializers/no-ng-attributes', 19 | 'jest-preset-angular/build/serializers/ng-snapshot', 20 | 'jest-preset-angular/build/serializers/html-comment', 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /modules/products/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "modules-products", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "modules/products/src", 5 | "prefix": "lib", 6 | "tags": ["type:feature", "scope:products"], 7 | "projectType": "library", 8 | "targets": { 9 | "test": { 10 | "executor": "@nx/jest:jest", 11 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 12 | "options": { 13 | "jestConfig": "modules/products/jest.config.ts", 14 | "passWithNoTests": true 15 | }, 16 | "configurations": { 17 | "ci": { 18 | "ci": true, 19 | "codeCoverage": true 20 | } 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/linter:eslint", 25 | "outputs": ["{options.outputFile}"], 26 | "options": { 27 | "lintFilePatterns": [ 28 | "modules/products/**/*.ts", 29 | "modules/products/**/*.html" 30 | ] 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /modules/products/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/products.module'; 2 | -------------------------------------------------------------------------------- /modules/products/src/lib/products.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule } from '@angular/core'; 3 | import { UiComponent } from 'modules/shared/ui'; 4 | import { ProductsRoutingModule } from './products.routing.module'; 5 | import { ProductsComponent } from './products/products.component'; 6 | 7 | @NgModule({ 8 | imports: [CommonModule, ProductsRoutingModule, UiComponent], 9 | declarations: [ProductsComponent], 10 | }) 11 | export class ProductsModule {} 12 | -------------------------------------------------------------------------------- /modules/products/src/lib/products.routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { ProductsComponent } from './products/products.component'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: ProductsComponent, 9 | }, 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule], 15 | }) 16 | export class ProductsRoutingModule {} 17 | -------------------------------------------------------------------------------- /modules/products/src/lib/products/products.component.html: -------------------------------------------------------------------------------- 1 |

products works!

2 | 3 | -------------------------------------------------------------------------------- /modules/products/src/lib/products/products.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewarosario/nx-angular/9c1793ed304d80a2b717104e21399d442ecae382/modules/products/src/lib/products/products.component.scss -------------------------------------------------------------------------------- /modules/products/src/lib/products/products.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { UiComponent } from 'modules/shared/ui'; 3 | import { ProductsComponent } from './products.component'; 4 | 5 | describe('ProductsComponent', () => { 6 | let component: ProductsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | imports: [UiComponent], 12 | declarations: [ProductsComponent], 13 | }).compileComponents(); 14 | 15 | fixture = TestBed.createComponent(ProductsComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /modules/products/src/lib/products/products.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'lib-products', 5 | templateUrl: './products.component.html', 6 | styleUrls: ['./products.component.scss'], 7 | }) 8 | export class ProductsComponent {} 9 | -------------------------------------------------------------------------------- /modules/products/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | // @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment 2 | globalThis.ngJest = { 3 | testEnvironmentOptions: { 4 | errorOnUnknownElements: true, 5 | errorOnUnknownProperties: true, 6 | }, 7 | }; 8 | import 'jest-preset-angular/setup-jest'; 9 | -------------------------------------------------------------------------------- /modules/products/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2022", 4 | "useDefineForClassFields": false, 5 | "forceConsistentCasingInFileNames": true, 6 | "strict": true, 7 | "noImplicitOverride": true, 8 | "noPropertyAccessFromIndexSignature": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true 11 | }, 12 | "files": [], 13 | "include": [], 14 | "references": [ 15 | { 16 | "path": "./tsconfig.lib.json" 17 | }, 18 | { 19 | "path": "./tsconfig.spec.json" 20 | } 21 | ], 22 | "extends": "../../tsconfig.base.json", 23 | "angularCompilerOptions": { 24 | "enableI18nLegacyMessageIdFormat": false, 25 | "strictInjectionParameters": true, 26 | "strictInputAccessModifiers": true, 27 | "strictTemplates": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /modules/products/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": [ 11 | "src/**/*.spec.ts", 12 | "src/test-setup.ts", 13 | "jest.config.ts", 14 | "src/**/*.test.ts" 15 | ], 16 | "include": ["src/**/*.ts"] 17 | } 18 | -------------------------------------------------------------------------------- /modules/products/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "target": "es2016", 7 | "types": ["jest", "node"] 8 | }, 9 | "files": ["src/test-setup.ts"], 10 | "include": [ 11 | "jest.config.ts", 12 | "src/**/*.test.ts", 13 | "src/**/*.spec.ts", 14 | "src/**/*.d.ts" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /modules/shared/ui/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../../.eslintrc.base.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "rules": { 8 | "@angular-eslint/directive-selector": [ 9 | "error", 10 | { 11 | "type": "attribute", 12 | "prefix": "lib", 13 | "style": "camelCase" 14 | } 15 | ], 16 | "@angular-eslint/component-selector": [ 17 | "error", 18 | { 19 | "type": "element", 20 | "prefix": "lib", 21 | "style": "kebab-case" 22 | } 23 | ] 24 | }, 25 | "extends": [ 26 | "plugin:@nx/angular", 27 | "plugin:@angular-eslint/template/process-inline-templates" 28 | ] 29 | }, 30 | { 31 | "files": ["*.html"], 32 | "extends": ["plugin:@nx/angular-template"], 33 | "rules": {} 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /modules/shared/ui/README.md: -------------------------------------------------------------------------------- 1 | # modules-shared-ui 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Running unit tests 6 | 7 | Run `nx test modules-shared-ui` to execute the unit tests. 8 | -------------------------------------------------------------------------------- /modules/shared/ui/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'modules-shared-ui', 4 | preset: '../../../jest.preset.js', 5 | setupFilesAfterEnv: ['/src/test-setup.ts'], 6 | coverageDirectory: '../../../coverage/modules/shared/ui', 7 | transform: { 8 | '^.+\\.(ts|mjs|js|html)$': [ 9 | 'jest-preset-angular', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | stringifyContentPathRegex: '\\.(html|svg)$', 13 | }, 14 | ], 15 | }, 16 | transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], 17 | snapshotSerializers: [ 18 | 'jest-preset-angular/build/serializers/no-ng-attributes', 19 | 'jest-preset-angular/build/serializers/ng-snapshot', 20 | 'jest-preset-angular/build/serializers/html-comment', 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /modules/shared/ui/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "modules-shared-ui", 3 | "$schema": "../../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "modules/shared/ui/src", 5 | "prefix": "lib", 6 | "tags": ["type:ui", "scope:shared"], 7 | "projectType": "library", 8 | "targets": { 9 | "test": { 10 | "executor": "@nx/jest:jest", 11 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 12 | "options": { 13 | "jestConfig": "modules/shared/ui/jest.config.ts", 14 | "passWithNoTests": true 15 | }, 16 | "configurations": { 17 | "ci": { 18 | "ci": true, 19 | "codeCoverage": true 20 | } 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/linter:eslint", 25 | "outputs": ["{options.outputFile}"], 26 | "options": { 27 | "lintFilePatterns": [ 28 | "modules/shared/ui/**/*.ts", 29 | "modules/shared/ui/**/*.html" 30 | ] 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /modules/shared/ui/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/ui/ui.component'; 2 | -------------------------------------------------------------------------------- /modules/shared/ui/src/lib/ui/ui.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewarosario/nx-angular/9c1793ed304d80a2b717104e21399d442ecae382/modules/shared/ui/src/lib/ui/ui.component.css -------------------------------------------------------------------------------- /modules/shared/ui/src/lib/ui/ui.component.html: -------------------------------------------------------------------------------- 1 |

ui works!

2 | -------------------------------------------------------------------------------- /modules/shared/ui/src/lib/ui/ui.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { UiComponent } from './ui.component'; 3 | 4 | describe('UiComponent', () => { 5 | let component: UiComponent; 6 | let fixture: ComponentFixture; 7 | 8 | beforeEach(async () => { 9 | await TestBed.configureTestingModule({ 10 | imports: [UiComponent], 11 | }).compileComponents(); 12 | 13 | fixture = TestBed.createComponent(UiComponent); 14 | component = fixture.componentInstance; 15 | fixture.detectChanges(); 16 | }); 17 | 18 | it('should create', () => { 19 | expect(component).toBeTruthy(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /modules/shared/ui/src/lib/ui/ui.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | 4 | @Component({ 5 | selector: 'lib-ui', 6 | standalone: true, 7 | imports: [CommonModule], 8 | templateUrl: './ui.component.html', 9 | styleUrls: ['./ui.component.css'], 10 | }) 11 | export class UiComponent {} 12 | -------------------------------------------------------------------------------- /modules/shared/ui/src/test-setup.ts: -------------------------------------------------------------------------------- 1 | // @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment 2 | globalThis.ngJest = { 3 | testEnvironmentOptions: { 4 | errorOnUnknownElements: true, 5 | errorOnUnknownProperties: true, 6 | }, 7 | }; 8 | import 'jest-preset-angular/setup-jest'; 9 | -------------------------------------------------------------------------------- /modules/shared/ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2022", 4 | "useDefineForClassFields": false, 5 | "forceConsistentCasingInFileNames": true, 6 | "strict": true, 7 | "noImplicitOverride": true, 8 | "noPropertyAccessFromIndexSignature": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true 11 | }, 12 | "files": [], 13 | "include": [], 14 | "references": [ 15 | { 16 | "path": "./tsconfig.lib.json" 17 | }, 18 | { 19 | "path": "./tsconfig.spec.json" 20 | } 21 | ], 22 | "extends": "../../../tsconfig.base.json", 23 | "angularCompilerOptions": { 24 | "enableI18nLegacyMessageIdFormat": false, 25 | "strictInjectionParameters": true, 26 | "strictInputAccessModifiers": true, 27 | "strictTemplates": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /modules/shared/ui/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": [ 11 | "src/**/*.spec.ts", 12 | "src/test-setup.ts", 13 | "jest.config.ts", 14 | "src/**/*.test.ts" 15 | ], 16 | "include": ["src/**/*.ts"] 17 | } 18 | -------------------------------------------------------------------------------- /modules/shared/ui/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../dist/out-tsc", 5 | "module": "commonjs", 6 | "target": "es2016", 7 | "types": ["jest", "node"] 8 | }, 9 | "files": ["src/test-setup.ts"], 10 | "include": [ 11 | "jest.config.ts", 12 | "src/**/*.test.ts", 13 | "src/**/*.spec.ts", 14 | "src/**/*.d.ts" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /nx.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/nx/schemas/nx-schema.json", 3 | "tasksRunnerOptions": { 4 | "default": { 5 | "runner": "nx-cloud", 6 | "options": { 7 | "cacheableOperations": ["build", "lint", "test", "e2e"], 8 | "accessToken": "ODNmZGViZjUtYzMxMi00YjBjLTljZmItY2YyYWRkMjQzZWUwfHJlYWQtd3JpdGU=" 9 | } 10 | } 11 | }, 12 | "targetDefaults": { 13 | "build": { 14 | "dependsOn": ["^build"], 15 | "inputs": ["production", "^production"] 16 | }, 17 | "test": { 18 | "inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"] 19 | }, 20 | "e2e": { 21 | "inputs": ["default", "^production"] 22 | }, 23 | "lint": { 24 | "inputs": [ 25 | "default", 26 | "{workspaceRoot}/.eslintrc.json", 27 | "{workspaceRoot}/.eslintignore" 28 | ] 29 | } 30 | }, 31 | "namedInputs": { 32 | "default": ["{projectRoot}/**/*", "sharedGlobals"], 33 | "production": [ 34 | "default", 35 | "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", 36 | "!{projectRoot}/tsconfig.spec.json", 37 | "!{projectRoot}/jest.config.[jt]s", 38 | "!{projectRoot}/src/test-setup.[jt]s", 39 | "!{projectRoot}/test-setup.[jt]s", 40 | "!{projectRoot}/.eslintrc.json" 41 | ], 42 | "sharedGlobals": [] 43 | }, 44 | "generators": { 45 | "@nx/angular:application": { 46 | "style": "scss", 47 | "linter": "eslint", 48 | "unitTestRunner": "jest", 49 | "e2eTestRunner": "cypress" 50 | }, 51 | "@nx/angular:library": { 52 | "linter": "eslint", 53 | "unitTestRunner": "jest" 54 | }, 55 | "@nx/angular:component": { 56 | "style": "scss" 57 | } 58 | }, 59 | "defaultProject": "my-app" 60 | } 61 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-app", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "start": "nx serve", 7 | "build": "nx build", 8 | "test": "nx test", 9 | "prepare": "husky install" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "~16.1.0", 14 | "@angular/common": "~16.1.0", 15 | "@angular/compiler": "~16.1.0", 16 | "@angular/core": "~16.1.0", 17 | "@angular/forms": "~16.1.0", 18 | "@angular/platform-browser": "~16.1.0", 19 | "@angular/platform-browser-dynamic": "~16.1.0", 20 | "@angular/router": "~16.1.0", 21 | "@nx/angular": "16.6.0", 22 | "rxjs": "~7.8.0", 23 | "tslib": "^2.3.0", 24 | "zone.js": "~0.13.0" 25 | }, 26 | "devDependencies": { 27 | "@angular-devkit/build-angular": "~16.1.0", 28 | "@angular-devkit/core": "~16.1.0", 29 | "@angular-devkit/schematics": "~16.1.0", 30 | "@angular-eslint/eslint-plugin": "~16.0.0", 31 | "@angular-eslint/eslint-plugin-template": "~16.0.0", 32 | "@angular-eslint/template-parser": "~16.0.0", 33 | "@angular/cli": "~16.1.0", 34 | "@angular/compiler-cli": "~16.1.0", 35 | "@angular/language-service": "~16.1.0", 36 | "@commitlint/cli": "^17.7.1", 37 | "@commitlint/config-conventional": "^17.7.0", 38 | "@commitlint/config-nx-scopes": "^17.6.4", 39 | "@commitlint/cz-commitlint": "^17.7.1", 40 | "@nx/cypress": "16.6.0", 41 | "@nx/eslint-plugin": "16.6.0", 42 | "@nx/jest": "16.6.0", 43 | "@nx/js": "16.6.0", 44 | "@nx/linter": "16.6.0", 45 | "@nx/web": "16.6.0", 46 | "@nx/workspace": "16.6.0", 47 | "@schematics/angular": "~16.1.0", 48 | "@types/jest": "^29.4.0", 49 | "@types/node": "16.11.7", 50 | "@typescript-eslint/eslint-plugin": "^5.60.1", 51 | "@typescript-eslint/parser": "^5.60.1", 52 | "commitizen": "^4.3.0", 53 | "cypress": "^12.16.0", 54 | "cz-conventional-changelog": "^3.3.0", 55 | "eslint": "~8.15.0", 56 | "eslint-config-prettier": "8.1.0", 57 | "eslint-plugin-cypress": "^2.10.3", 58 | "husky": "^8.0.0", 59 | "jest": "^29.4.1", 60 | "jest-environment-jsdom": "^29.4.1", 61 | "jest-preset-angular": "~13.1.0", 62 | "lint-staged": "^14.0.1", 63 | "nx": "16.6.0", 64 | "nx-cloud": "latest", 65 | "prettier": "^2.6.2", 66 | "ts-jest": "^29.1.0", 67 | "ts-node": "10.9.1", 68 | "typescript": "~5.1.3" 69 | }, 70 | "config": { 71 | "commitizen": { 72 | "path": "./node_modules/cz-conventional-changelog" 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-app", 3 | "$schema": "node_modules/nx/schemas/project-schema.json", 4 | "projectType": "application", 5 | "prefix": "app", 6 | "sourceRoot": "./src", 7 | "tags": [], 8 | "targets": { 9 | "build": { 10 | "executor": "@angular-devkit/build-angular:browser", 11 | "outputs": ["{options.outputPath}"], 12 | "options": { 13 | "outputPath": "dist/my-app", 14 | "index": "./src/index.html", 15 | "main": "./src/main.ts", 16 | "polyfills": ["zone.js"], 17 | "tsConfig": "./tsconfig.app.json", 18 | "assets": ["./src/favicon.ico", "./src/assets"], 19 | "styles": ["./src/styles.scss"], 20 | "scripts": [] 21 | }, 22 | "configurations": { 23 | "production": { 24 | "budgets": [ 25 | { 26 | "type": "initial", 27 | "maximumWarning": "500kb", 28 | "maximumError": "1mb" 29 | }, 30 | { 31 | "type": "anyComponentStyle", 32 | "maximumWarning": "2kb", 33 | "maximumError": "4kb" 34 | } 35 | ], 36 | "outputHashing": "all" 37 | }, 38 | "development": { 39 | "buildOptimizer": false, 40 | "optimization": false, 41 | "vendorChunk": true, 42 | "extractLicenses": false, 43 | "sourceMap": true, 44 | "namedChunks": true 45 | } 46 | }, 47 | "defaultConfiguration": "production" 48 | }, 49 | "serve": { 50 | "executor": "@angular-devkit/build-angular:dev-server", 51 | "configurations": { 52 | "production": { 53 | "browserTarget": "my-app:build:production" 54 | }, 55 | "development": { 56 | "browserTarget": "my-app:build:development" 57 | } 58 | }, 59 | "defaultConfiguration": "development" 60 | }, 61 | "extract-i18n": { 62 | "executor": "@angular-devkit/build-angular:extract-i18n", 63 | "options": { 64 | "browserTarget": "my-app:build" 65 | } 66 | }, 67 | "lint": { 68 | "executor": "@nx/linter:eslint", 69 | "outputs": ["{options.outputFile}"], 70 | "options": { 71 | "lintFilePatterns": ["./src/**/*.ts", "./src/**/*.html"] 72 | } 73 | }, 74 | "test": { 75 | "executor": "@nx/jest:jest", 76 | "outputs": ["{workspaceRoot}/coverage/{projectName}"], 77 | "options": { 78 | "jestConfig": "jest.config.app.ts", 79 | "passWithNoTests": true 80 | }, 81 | "configurations": { 82 | "ci": { 83 | "ci": true, 84 | "codeCoverage": true 85 | } 86 | } 87 | }, 88 | "serve-static": { 89 | "executor": "@nx/web:file-server", 90 | "options": { 91 | "buildTarget": "my-app:build" 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewarosario/nx-angular/9c1793ed304d80a2b717104e21399d442ecae382/src/app/app.component.scss -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | import { NxWelcomeComponent } from './nx-welcome.component'; 5 | 6 | describe('AppComponent', () => { 7 | beforeEach(async () => { 8 | await TestBed.configureTestingModule({ 9 | imports: [RouterTestingModule], 10 | declarations: [AppComponent, NxWelcomeComponent], 11 | }).compileComponents(); 12 | }); 13 | 14 | it(`should have as title 'my-app'`, () => { 15 | const fixture = TestBed.createComponent(AppComponent); 16 | const app = fixture.componentInstance; 17 | expect(app.title).toEqual('my-app'); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'], 7 | }) 8 | export class AppComponent { 9 | title = 'my-app'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { RouterModule } from '@angular/router'; 4 | import { AppComponent } from './app.component'; 5 | import { appRoutes } from './app.routes'; 6 | import { NxWelcomeComponent } from './nx-welcome.component'; 7 | import { HelloWorldComponent } from './hello-world/hello-world.component'; 8 | 9 | @NgModule({ 10 | declarations: [AppComponent, NxWelcomeComponent, HelloWorldComponent], 11 | imports: [ 12 | BrowserModule, 13 | RouterModule.forRoot(appRoutes, { initialNavigation: 'enabledBlocking' }), 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent], 17 | }) 18 | export class AppModule {} 19 | -------------------------------------------------------------------------------- /src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Route } from '@angular/router'; 2 | import { NxWelcomeComponent } from './nx-welcome.component'; 3 | 4 | export const appRoutes: Route[] = [ 5 | { 6 | path: '', 7 | component: NxWelcomeComponent, 8 | pathMatch: 'full', 9 | }, 10 | { 11 | path: 'products', 12 | loadChildren: () => 13 | import('modules/products').then((m) => m.ProductsModule), 14 | }, 15 | { 16 | path: 'orders', 17 | loadChildren: () => import('modules/orders').then((m) => m.OrdersModule), 18 | }, 19 | ]; 20 | -------------------------------------------------------------------------------- /src/app/hello-world/hello-world.component.html: -------------------------------------------------------------------------------- 1 |

hello-world works!

2 | -------------------------------------------------------------------------------- /src/app/hello-world/hello-world.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewarosario/nx-angular/9c1793ed304d80a2b717104e21399d442ecae382/src/app/hello-world/hello-world.component.scss -------------------------------------------------------------------------------- /src/app/hello-world/hello-world.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { HelloWorldComponent } from './hello-world.component'; 3 | 4 | describe('HelloWorldComponent', () => { 5 | let component: HelloWorldComponent; 6 | let fixture: ComponentFixture; 7 | 8 | beforeEach(async () => { 9 | await TestBed.configureTestingModule({ 10 | declarations: [HelloWorldComponent], 11 | }).compileComponents(); 12 | 13 | fixture = TestBed.createComponent(HelloWorldComponent); 14 | component = fixture.componentInstance; 15 | fixture.detectChanges(); 16 | }); 17 | 18 | it('should create', () => { 19 | expect(component).toBeTruthy(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/app/hello-world/hello-world.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-hello-world', 5 | templateUrl: './hello-world.component.html', 6 | styleUrls: ['./hello-world.component.scss'], 7 | }) 8 | export class HelloWorldComponent {} 9 | -------------------------------------------------------------------------------- /src/app/nx-welcome.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewEncapsulation } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-nx-welcome', 5 | template: ` 6 | 13 | 417 |
418 |
419 | 420 |
421 |

422 | Hello there, 423 | Welcome my-app 👋 424 |

425 |
426 | 427 |
428 |
429 |

430 | 436 | 442 | 443 | You're up and running 444 |

445 | What's next? 446 |
447 |
448 | 454 | 457 | 458 |
459 |
460 | 461 | 761 | 762 |
763 |

Next steps

764 |

Here are some things you can do with Nx:

765 |
766 | 767 | 773 | 779 | 780 | Add UI library 781 | 782 |
# Generate UI lib
783 | nx g @nx/angular:lib ui
784 | # Add a component
785 | nx g @nx/angular:component button --project ui
786 |
787 |
788 | 789 | 795 | 801 | 802 | View interactive project graph 803 | 804 |
nx graph
805 |
806 |
807 | 808 | 814 | 820 | 821 | Run affected commands 822 | 823 |
# see what's been affected by changes
824 | nx affected:graph
825 | # run tests for current changes
826 | nx affected:test
827 | # run e2e tests for current changes
828 | nx affected:e2e
829 |
830 |
831 |

832 | Carefully crafted with 833 | 839 | 845 | 846 |

847 |
848 |
849 | `, 850 | styles: [], 851 | encapsulation: ViewEncapsulation.None, 852 | }) 853 | export class NxWelcomeComponent {} 854 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewarosario/nx-angular/9c1793ed304d80a2b717104e21399d442ecae382/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrewarosario/nx-angular/9c1793ed304d80a2b717104e21399d442ecae382/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | my-app 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | import { throwError } from 'rxjs'; 3 | import { AppModule } from './app/app.module'; 4 | 5 | platformBrowserDynamic() 6 | .bootstrapModule(AppModule) 7 | .catch((err) => throwError(() => err)); 8 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /src/test-setup.ts: -------------------------------------------------------------------------------- 1 | // @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment 2 | globalThis.ngJest = { 3 | testEnvironmentOptions: { 4 | errorOnUnknownElements: true, 5 | errorOnUnknownProperties: true, 6 | }, 7 | }; 8 | import 'jest-preset-angular/setup-jest'; 9 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "types": [] 6 | }, 7 | "files": ["src/main.ts"], 8 | "include": ["src/**/*.d.ts"], 9 | "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /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": "es2022", 12 | "module": "esnext", 13 | "lib": ["es2020", "dom"], 14 | "skipLibCheck": true, 15 | "skipDefaultLibCheck": true, 16 | "baseUrl": ".", 17 | "paths": { 18 | "modules/orders": ["modules/orders/src/index.ts"], 19 | "modules/products": ["modules/products/src/index.ts"], 20 | "modules/shared/ui": ["modules/shared/ui/src/index.ts"] 21 | } 22 | }, 23 | "exclude": ["node_modules", "tmp"] 24 | } 25 | -------------------------------------------------------------------------------- /tsconfig.editor.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["src/**/*.ts"], 4 | "compilerOptions": { 5 | "types": ["jest", "node"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "useDefineForClassFields": false, 4 | "forceConsistentCasingInFileNames": true, 5 | "strict": true, 6 | "noImplicitOverride": true, 7 | "noPropertyAccessFromIndexSignature": true, 8 | "noImplicitReturns": true, 9 | "noFallthroughCasesInSwitch": true 10 | }, 11 | "files": [], 12 | "include": [], 13 | "references": [ 14 | { 15 | "path": "./tsconfig.app.json" 16 | }, 17 | { 18 | "path": "./tsconfig.spec.json" 19 | }, 20 | { 21 | "path": "./tsconfig.editor.json" 22 | } 23 | ], 24 | "angularCompilerOptions": { 25 | "enableI18nLegacyMessageIdFormat": false, 26 | "strictInjectionParameters": true, 27 | "strictInputAccessModifiers": true, 28 | "strictTemplates": true 29 | }, 30 | "extends": "./tsconfig.base.json" 31 | } 32 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "module": "commonjs", 6 | "target": "es2016", 7 | "types": ["jest", "node"] 8 | }, 9 | "files": ["src/test-setup.ts"], 10 | "include": [ 11 | "jest.config.ts", 12 | "src/**/*.test.ts", 13 | "src/**/*.spec.ts", 14 | "src/**/*.d.ts" 15 | ] 16 | } 17 | --------------------------------------------------------------------------------