├── dashboardPage ├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ └── modules │ │ │ └── dashboard │ │ │ ├── components │ │ │ └── charts │ │ │ │ ├── bar │ │ │ │ ├── bar.component.html │ │ │ │ ├── bar.component.scss │ │ │ │ ├── bar.component.spec.ts │ │ │ │ └── bar.component.ts │ │ │ │ ├── charts.module.ts │ │ │ │ ├── pie │ │ │ │ ├── pie.component.html │ │ │ │ ├── pie.component.scss │ │ │ │ ├── pie.component.spec.ts │ │ │ │ └── pie.component.ts │ │ │ │ └── scatter │ │ │ │ ├── scatter.component.html │ │ │ │ ├── scatter.component.scss │ │ │ │ ├── scatter.component.spec.ts │ │ │ │ └── scatter.component.ts │ │ │ ├── dashboard-routing.module.ts │ │ │ ├── dashboard.module.ts │ │ │ └── dashboard │ │ │ ├── dashboard.component.html │ │ │ ├── dashboard.component.scss │ │ │ ├── dashboard.component.spec.ts │ │ │ └── dashboard.component.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json ├── webpack.config.js └── webpack.prod.config.js ├── layout ├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── core │ │ │ └── services │ │ │ │ └── auth │ │ │ │ ├── auth.service.spec.ts │ │ │ │ └── auth.service.ts │ │ └── modules │ │ │ └── layout │ │ │ ├── footer │ │ │ ├── footer.component.html │ │ │ ├── footer.component.scss │ │ │ ├── footer.component.spec.ts │ │ │ └── footer.component.ts │ │ │ ├── header │ │ │ ├── header.component.html │ │ │ ├── header.component.scss │ │ │ ├── header.component.spec.ts │ │ │ └── header.component.ts │ │ │ ├── layout.module.ts │ │ │ └── logo │ │ │ ├── logo.component.scss │ │ │ ├── logo.component.spec.ts │ │ │ ├── logo.component.svg │ │ │ └── logo.component.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json ├── webpack.config.js └── webpack.prod.config.js ├── registerPage ├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── core │ │ │ └── services │ │ │ │ └── auth │ │ │ │ ├── auth.service.spec.ts │ │ │ │ ├── auth.service.ts │ │ │ │ └── auth.types.ts │ │ └── modules │ │ │ └── register │ │ │ ├── components │ │ │ └── register-form │ │ │ │ ├── register-form.component.html │ │ │ │ ├── register-form.component.scss │ │ │ │ ├── register-form.component.spec.ts │ │ │ │ └── register-form.component.ts │ │ │ ├── pages │ │ │ └── register-page │ │ │ │ ├── register-page.component.html │ │ │ │ ├── register-page.component.scss │ │ │ │ ├── register-page.component.spec.ts │ │ │ │ └── register-page.component.ts │ │ │ ├── register-page-routing.module.ts │ │ │ └── register-page.module.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json ├── webpack.config.js └── webpack.prod.config.js ├── shell ├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── app.routes.ts │ │ ├── core │ │ │ ├── components │ │ │ │ ├── loader │ │ │ │ │ ├── loader.component.html │ │ │ │ │ ├── loader.component.scss │ │ │ │ │ ├── loader.component.spec.ts │ │ │ │ │ └── loader.component.ts │ │ │ │ └── navbar │ │ │ │ │ ├── navbar.component.html │ │ │ │ │ ├── navbar.component.scss │ │ │ │ │ ├── navbar.component.spec.ts │ │ │ │ │ └── navbar.component.ts │ │ │ ├── guards │ │ │ │ ├── logged-only.guard.spec.ts │ │ │ │ ├── logged-only.guard.ts │ │ │ │ ├── unlogged-only.guard.spec.ts │ │ │ │ └── unlogged-only.guard.ts │ │ │ └── services │ │ │ │ ├── auth │ │ │ │ ├── auth.service.spec.ts │ │ │ │ └── auth.service.ts │ │ │ │ └── microfrontends │ │ │ │ ├── microfrontend.service.ts │ │ │ │ └── microfrontend.types.ts │ │ └── utils │ │ │ ├── federation-utils.ts │ │ │ └── route-utils.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json ├── webpack.config.js └── webpack.prod.config.js ├── staticPage ├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src │ ├── app │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ └── modules │ │ │ └── static │ │ │ ├── pages │ │ │ └── static-page │ │ │ │ ├── static-page.component.html │ │ │ │ ├── static-page.component.scss │ │ │ │ ├── static-page.component.spec.ts │ │ │ │ └── static-page.component.ts │ │ │ ├── static.module.ts │ │ │ └── static.routing.module.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json ├── webpack.config.js └── webpack.prod.config.js └── tablePage ├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.html │ ├── app.component.scss │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ └── modules │ │ └── table │ │ ├── components │ │ └── paginated-table │ │ │ ├── paginated-table.component.html │ │ │ ├── paginated-table.component.scss │ │ │ ├── paginated-table.component.spec.ts │ │ │ └── paginated-table.component.ts │ │ ├── pages │ │ └── table-page │ │ │ ├── table-page.component.html │ │ │ ├── table-page.component.scss │ │ │ ├── table-page.component.spec.ts │ │ │ └── table-page.component.ts │ │ ├── table-routing.module.ts │ │ └── table.module.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.scss └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json ├── webpack.config.js └── webpack.prod.config.js /dashboardPage/.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 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /dashboardPage/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /dashboardPage/.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 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | 16 | # IDEs and editors 17 | /.idea 18 | .project 19 | .classpath 20 | .c9/ 21 | *.launch 22 | .settings/ 23 | *.sublime-workspace 24 | 25 | # IDE - VSCode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # misc 34 | /.sass-cache 35 | /connect.lock 36 | /coverage 37 | /libpeerconnection.log 38 | npm-debug.log 39 | yarn-error.log 40 | testem.log 41 | /typings 42 | 43 | # System Files 44 | .DS_Store 45 | Thumbs.db 46 | -------------------------------------------------------------------------------- /dashboardPage/README.md: -------------------------------------------------------------------------------- 1 | # DashboardPage 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.4. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 28 | -------------------------------------------------------------------------------- /dashboardPage/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "dashboardPage": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | }, 12 | "@schematics/angular:application": { 13 | "strict": true 14 | } 15 | }, 16 | "root": "", 17 | "sourceRoot": "src", 18 | "prefix": "app", 19 | "architect": { 20 | "build": { 21 | "builder": "ngx-build-plus:browser", 22 | "options": { 23 | "outputPath": "dist/dashboardPage", 24 | "index": "src/index.html", 25 | "main": "src/main.ts", 26 | "polyfills": "src/polyfills.ts", 27 | "tsConfig": "tsconfig.app.json", 28 | "inlineStyleLanguage": "scss", 29 | "assets": [ 30 | "src/favicon.ico", 31 | "src/assets" 32 | ], 33 | "styles": [ 34 | "src/styles.scss" 35 | ], 36 | "scripts": [], 37 | "extraWebpackConfig": "webpack.config.js" 38 | }, 39 | "configurations": { 40 | "production": { 41 | "budgets": [ 42 | { 43 | "type": "initial", 44 | "maximumWarning": "500kb", 45 | "maximumError": "1mb" 46 | }, 47 | { 48 | "type": "anyComponentStyle", 49 | "maximumWarning": "2kb", 50 | "maximumError": "4kb" 51 | } 52 | ], 53 | "fileReplacements": [ 54 | { 55 | "replace": "src/environments/environment.ts", 56 | "with": "src/environments/environment.prod.ts" 57 | } 58 | ], 59 | "outputHashing": "all", 60 | "extraWebpackConfig": "webpack.prod.config.js" 61 | }, 62 | "development": { 63 | "buildOptimizer": false, 64 | "optimization": false, 65 | "vendorChunk": true, 66 | "extractLicenses": false, 67 | "sourceMap": true, 68 | "namedChunks": true 69 | } 70 | }, 71 | "defaultConfiguration": "production" 72 | }, 73 | "serve": { 74 | "builder": "ngx-build-plus:dev-server", 75 | "configurations": { 76 | "production": { 77 | "browserTarget": "dashboardPage:build:production" 78 | }, 79 | "development": { 80 | "browserTarget": "dashboardPage:build:development", 81 | "extraWebpackConfig": "webpack.config.js", 82 | "port": 4204 83 | } 84 | }, 85 | "defaultConfiguration": "development" 86 | }, 87 | "extract-i18n": { 88 | "builder": "@angular-devkit/build-angular:extract-i18n", 89 | "options": { 90 | "browserTarget": "dashboardPage:build" 91 | } 92 | }, 93 | "test": { 94 | "builder": "ngx-build-plus:karma", 95 | "options": { 96 | "main": "src/test.ts", 97 | "polyfills": "src/polyfills.ts", 98 | "tsConfig": "tsconfig.spec.json", 99 | "karmaConfig": "karma.conf.js", 100 | "inlineStyleLanguage": "scss", 101 | "assets": [ 102 | "src/favicon.ico", 103 | "src/assets" 104 | ], 105 | "styles": [ 106 | "src/styles.scss" 107 | ], 108 | "scripts": [], 109 | "extraWebpackConfig": "webpack.config.js" 110 | } 111 | } 112 | } 113 | } 114 | }, 115 | "defaultProject": "dashboardPage" 116 | } 117 | -------------------------------------------------------------------------------- /dashboardPage/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/dashboardPage'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /dashboardPage/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dashboard-page", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "~12.2.0", 14 | "@angular/common": "~12.2.0", 15 | "@angular/compiler": "~12.2.0", 16 | "@angular/core": "~12.2.0", 17 | "@angular/forms": "~12.2.0", 18 | "@angular/platform-browser": "~12.2.0", 19 | "@angular/platform-browser-dynamic": "~12.2.0", 20 | "@angular/router": "~12.2.0", 21 | "d3": "^4.13.0", 22 | "micro-angualr-libs": "^1.0.0", 23 | "ngx-common-ui-lib": "0.0.1", 24 | "rxjs": "~6.6.0", 25 | "tslib": "^2.3.0", 26 | "zone.js": "~0.11.4" 27 | }, 28 | "devDependencies": { 29 | "@angular-devkit/build-angular": "~12.2.4", 30 | "@angular/cli": "~12.2.4", 31 | "@angular/compiler-cli": "~12.2.0", 32 | "@types/d3": "^7.0.0", 33 | "@types/jasmine": "~3.8.0", 34 | "@types/node": "^12.11.1", 35 | "jasmine-core": "~3.8.0", 36 | "karma": "~6.3.0", 37 | "karma-chrome-launcher": "~3.1.0", 38 | "karma-coverage": "~2.0.3", 39 | "karma-jasmine": "~4.0.0", 40 | "karma-jasmine-html-reporter": "~1.7.0", 41 | "ngx-build-plus": "^12.2.0", 42 | "typescript": "~4.3.5" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /dashboardPage/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { DashboardModule } from './modules/dashboard/dashboard.module'; 4 | 5 | const routes: Routes = []; 6 | 7 | @NgModule({ 8 | imports: [RouterModule.forRoot(routes), DashboardModule], 9 | exports: [RouterModule] 10 | }) 11 | export class AppRoutingModule { } 12 | -------------------------------------------------------------------------------- /dashboardPage/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /dashboardPage/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/dashboardPage/src/app/app.component.scss -------------------------------------------------------------------------------- /dashboardPage/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 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'dashboardPage'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('dashboardPage'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement as HTMLElement; 33 | expect(compiled.querySelector('.content span')?.textContent).toContain('dashboardPage app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /dashboardPage/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 | } 10 | -------------------------------------------------------------------------------- /dashboardPage/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { AppComponent } from './app.component'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | AppRoutingModule 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent] 17 | }) 18 | export class AppModule { } 19 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/bar/bar.component.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/bar/bar.component.scss: -------------------------------------------------------------------------------- 1 | figure { 2 | margin: 0; 3 | } 4 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/bar/bar.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BarComponent } from './bar.component'; 4 | 5 | describe('BarComponent', () => { 6 | let component: BarComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BarComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BarComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/bar/bar.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import * as d3 from 'd3'; 3 | 4 | export interface BarChartPoint { 5 | y: number; 6 | label: string; 7 | } 8 | 9 | @Component({ 10 | selector: 'app-bar', 11 | templateUrl: './bar.component.html', 12 | styleUrls: ['./bar.component.scss'] 13 | }) 14 | export class BarComponent implements OnInit { 15 | @Input() data: BarChartPoint[] = []; 16 | 17 | 18 | private svg: d3.Selection | null = null; 19 | private margin = 50; 20 | private width = 300 - (this.margin * 2); 21 | private height = 200 - (this.margin * 2); 22 | 23 | constructor() { } 24 | 25 | ngOnInit(): void { 26 | this.createSvg(); 27 | this.drawBars(this.data); 28 | } 29 | 30 | private createSvg(): void { 31 | this.svg = d3.select('figure#bar') 32 | .append('svg') 33 | .attr('width', this.width + (this.margin * 2)) 34 | .attr('height', this.height + (this.margin * 2)) 35 | .append('g') 36 | .attr('transform', 'translate(' + this.margin + ',' + this.margin + ')'); 37 | } 38 | 39 | private drawBars(data: BarChartPoint[]): void { 40 | const x = d3.scaleBand() 41 | .range([0, this.width]) 42 | .domain(data.map(d => d.label)) 43 | .padding(0.2); 44 | 45 | this.svg!.append('g') 46 | .attr('transform', 'translate(0,' + this.height + ')') 47 | .call(d3.axisBottom(x)) 48 | .selectAll('text') 49 | .attr('transform', 'translate(-10,0)rotate(-45)') 50 | .style('text-anchor', 'end'); 51 | 52 | const y = d3.scaleLinear() 53 | .domain([0, 200000]) 54 | .range([this.height, 0]); 55 | 56 | this.svg!.append('g') 57 | .call(d3.axisLeft(y)); 58 | 59 | this.svg!.selectAll('bars') 60 | .data(data) 61 | .enter() 62 | .append('rect') 63 | .attr('x', d => x(d.label)!) 64 | .attr('y', d => y(d.y)) 65 | .attr('width', x.bandwidth()) 66 | .attr('height', (d) => this.height - y(d.y)) 67 | .attr('fill', '#d04a35'); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/charts.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { BarComponent } from './bar/bar.component'; 4 | import { PieComponent } from './pie/pie.component'; 5 | import { ScatterComponent } from './scatter/scatter.component'; 6 | 7 | 8 | 9 | @NgModule({ 10 | declarations: [BarComponent, PieComponent, ScatterComponent], 11 | imports: [ 12 | CommonModule 13 | ], 14 | exports: [BarComponent, PieComponent, ScatterComponent] 15 | }) 16 | export class ChartsModule { } 17 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/pie/pie.component.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/pie/pie.component.scss: -------------------------------------------------------------------------------- 1 | figure { 2 | margin: 0; 3 | } 4 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/pie/pie.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PieComponent } from './pie.component'; 4 | 5 | describe('PieComponent', () => { 6 | let component: PieComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PieComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PieComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/pie/pie.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import * as d3 from 'd3'; 3 | 4 | export interface PieChartPoint { 5 | label: string; 6 | value: number; 7 | } 8 | 9 | @Component({ 10 | selector: 'app-pie', 11 | templateUrl: './pie.component.html', 12 | styleUrls: ['./pie.component.scss'] 13 | }) 14 | export class PieComponent implements OnInit { 15 | @Input() data: PieChartPoint[] = []; 16 | private svg: d3.Selection | null = null; 17 | private margin = 50; 18 | private width = 300; 19 | private height = 200; 20 | private radius = Math.min(this.width, this.height) / 2 - this.margin; 21 | private colors: d3.ScaleOrdinal = d3.scaleOrdinal(); 22 | 23 | constructor() { } 24 | 25 | ngOnInit(): void { 26 | this.createSvg(); 27 | this.createColors(); 28 | this.drawChart(); 29 | } 30 | 31 | private createSvg(): void { 32 | this.svg = d3.select('figure#pie') 33 | .append('svg') 34 | .attr('width', this.width) 35 | .attr('height', this.height) 36 | .append('g') 37 | .attr( 38 | 'transform', 39 | 'translate(' + this.width / 2 + ',' + this.height / 2 + ')' 40 | ); 41 | } 42 | 43 | private createColors(): void { 44 | this.colors = d3.scaleOrdinal() 45 | .domain(this.data.map(d => d.value.toString())) 46 | .range(['#c7d3ec', '#a5b8db', '#879cc4', '#677795', '#5a6782']); 47 | } 48 | 49 | private drawChart(): void { 50 | const pie = d3.pie().value((d) => d.value); 51 | 52 | this.svg! 53 | .selectAll('pieces') 54 | .data(pie(this.data)) 55 | .enter() 56 | .append('path') 57 | .attr('d', d3.arc() 58 | .innerRadius(0) 59 | .outerRadius(this.radius) as any 60 | ) 61 | .attr('fill', (d, i) => (this.colors(i.toString()) as string)) 62 | .attr('stroke', '#121926') 63 | .style('stroke-width', '1px'); 64 | 65 | // Add labels 66 | const labelLocation = d3.arc() 67 | .innerRadius(100) 68 | .outerRadius(this.radius); 69 | 70 | this.svg! 71 | .selectAll('pieces') 72 | .data(pie(this.data)) 73 | .enter() 74 | .append('text') 75 | .text(d => d.data.label) 76 | .attr('transform', d => 'translate(' + labelLocation.centroid(d as any) + ')') 77 | .style('text-anchor', 'middle') 78 | .style('font-size', 15); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/scatter/scatter.component.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/scatter/scatter.component.scss: -------------------------------------------------------------------------------- 1 | figure { 2 | margin: 0; 3 | } 4 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/scatter/scatter.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ScatterComponent } from './scatter.component'; 4 | 5 | describe('ScatterComponent', () => { 6 | let component: ScatterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ScatterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ScatterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/components/charts/scatter/scatter.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import * as d3 from 'd3'; 3 | 4 | export interface ScatterChartPoint { 5 | label: string; 6 | x: number; 7 | y: number; 8 | } 9 | 10 | @Component({ 11 | selector: 'app-scatter', 12 | templateUrl: './scatter.component.html', 13 | styleUrls: ['./scatter.component.scss'] 14 | }) 15 | export class ScatterComponent implements OnInit { 16 | @Input() data: ScatterChartPoint[] = []; 17 | 18 | private svg: d3.Selection | null= null; 19 | private margin = 50; 20 | private width = 300 - (this.margin * 2); 21 | private height = 200 - (this.margin * 2); 22 | constructor() { } 23 | 24 | ngOnInit(): void { 25 | this.createSvg(); 26 | this.drawPlot() 27 | } 28 | 29 | private createSvg(): void { 30 | this.svg = d3.select('figure#scatter') 31 | .append('svg') 32 | .attr('width', this.width + (this.margin * 2)) 33 | .attr('height', this.height + (this.margin * 2)) 34 | .append('g') 35 | .attr('transform', 'translate(' + this.margin + ',' + this.margin + ')'); 36 | } 37 | 38 | private drawPlot(): void { 39 | const x = d3.scaleLinear() 40 | .domain([2009, 2017]) 41 | .range([ 0, this.width ]); 42 | this.svg!.append('g') 43 | .attr('transform', 'translate(0,' + this.height + ')') 44 | .call(d3.axisBottom(x).tickFormat(d3.format('d'))); 45 | 46 | const y = d3.scaleLinear() 47 | .domain([0, 200000]) 48 | .range([ this.height, 0]); 49 | this.svg!.append('g') 50 | .call(d3.axisLeft(y)); 51 | 52 | const dots = this.svg!.append('g'); 53 | dots.selectAll('dot') 54 | .data(this.data) 55 | .enter() 56 | .append('circle') 57 | .attr('cx', d => x(d.x)) 58 | .attr('cy', d => y(d.y)) 59 | .attr('r', 7) 60 | .style('opacity', .5) 61 | .style('fill', '#69b3a2'); 62 | 63 | dots.selectAll('text') 64 | .data(this.data) 65 | .enter() 66 | .append('text') 67 | .text(d => d.label) 68 | .attr('x', d => x(d.x) + 10) 69 | .attr('y', d => y(d.y)) 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/dashboard-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { DashboardComponent } from './dashboard/dashboard.component'; 4 | 5 | const routes: Routes = [{ path: '', component: DashboardComponent }]; 6 | 7 | 8 | @NgModule({ 9 | imports: [RouterModule.forChild(routes)], 10 | exports: [RouterModule], 11 | }) 12 | export class DashboardRoutingModule { } 13 | 14 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/dashboard.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { DashboardComponent } from './dashboard/dashboard.component'; 4 | import { DashboardRoutingModule } from './dashboard-routing.module'; 5 | import { ChartsModule } from './components/charts/charts.module'; 6 | import { NgxCommonUiLibModule } from 'ngx-common-ui-lib'; 7 | 8 | 9 | 10 | @NgModule({ 11 | declarations: [DashboardComponent], 12 | imports: [ 13 | CommonModule, 14 | DashboardRoutingModule, 15 | ChartsModule, 16 | NgxCommonUiLibModule 17 | ] 18 | }) 19 | export class DashboardModule { } 20 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/dashboard/dashboard.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
6 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/dashboard/dashboard.component.scss: -------------------------------------------------------------------------------- 1 | .content { 2 | display: flex; 3 | flex-wrap: wrap; 4 | } 5 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/dashboard/dashboard.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { DashboardComponent } from './dashboard.component'; 4 | 5 | describe('DashboardComponent', () => { 6 | let component: DashboardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ DashboardComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(DashboardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /dashboardPage/src/app/modules/dashboard/dashboard/dashboard.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { BarChartPoint } from '../components/charts/bar/bar.component'; 3 | import { PieChartPoint } from '../components/charts/pie/pie.component'; 4 | import { ScatterChartPoint } from '../components/charts/scatter/scatter.component'; 5 | 6 | @Component({ 7 | selector: 'app-dashboard', 8 | templateUrl: './dashboard.component.html', 9 | styleUrls: ['./dashboard.component.scss'] 10 | }) 11 | export class DashboardComponent implements OnInit { 12 | 13 | constructor() { } 14 | 15 | data: BarChartPoint[] = [ 16 | { label: 'Vue', y: 166443 }, 17 | { label: 'React', y: 150793 }, 18 | { label: 'Angular', y: 62342 }, 19 | { label: 'Backbone', y: 27647 }, 20 | { label: 'Ember', y: 21471 }, 21 | ]; 22 | pieData: PieChartPoint[] = [ 23 | { label: 'Vue', value: 166443 }, 24 | { label: 'React', value: 150793 }, 25 | { label: 'Angular', value: 62342 }, 26 | { label: 'Backbone', value: 27647 }, 27 | { label: 'Ember', value: 21471 }, 28 | ]; 29 | scatterData: ScatterChartPoint[] = [ 30 | {label: 'Vue', y: 166443, x: 2014}, 31 | {label: 'React', y: 150793, x: 2013}, 32 | {label: 'Angular', y: 62342, x: 2016}, 33 | {label: 'Backbone', y: 27647, x: 2010}, 34 | {label: 'Ember', y: 21471, x: 2011}, 35 | ]; 36 | 37 | ngOnInit() { 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /dashboardPage/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/dashboardPage/src/assets/.gitkeep -------------------------------------------------------------------------------- /dashboardPage/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /dashboardPage/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 | -------------------------------------------------------------------------------- /dashboardPage/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/dashboardPage/src/favicon.ico -------------------------------------------------------------------------------- /dashboardPage/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | DashboardPage 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /dashboardPage/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /dashboardPage/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 Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 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 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /dashboardPage/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /dashboardPage/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 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting(), 21 | { teardown: { destroyAfterEach: true }}, 22 | ); 23 | 24 | // Then we find all the tests. 25 | const context = require.context('./', true, /\.spec\.ts$/); 26 | // And load the modules. 27 | context.keys().map(context); 28 | -------------------------------------------------------------------------------- /dashboardPage/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /dashboardPage/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "sourceMap": true, 12 | "declaration": false, 13 | "downlevelIteration": true, 14 | "experimentalDecorators": true, 15 | "moduleResolution": "node", 16 | "importHelpers": true, 17 | "target": "es2017", 18 | "module": "es2020", 19 | "lib": [ 20 | "es2018", 21 | "dom" 22 | ] 23 | }, 24 | "angularCompilerOptions": { 25 | "enableI18nLegacyMessageIdFormat": false, 26 | "strictInjectionParameters": true, 27 | "strictInputAccessModifiers": true, 28 | "strictTemplates": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dashboardPage/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /dashboardPage/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin"); 3 | 4 | module.exports = { 5 | output: { 6 | publicPath: "http://localhost:4204/", 7 | uniqueName: "dashboard", 8 | }, 9 | optimization: { 10 | runtimeChunk: false, 11 | }, 12 | plugins: [ 13 | new ModuleFederationPlugin({ 14 | name: "dashboard", 15 | library: { type: "var", name: "dashboard" }, 16 | filename: "remoteEntry.js", 17 | exposes: { 18 | DashboardModule: 19 | "./src/app/modules/dashboard/dashboard.module.ts", 20 | }, 21 | shared: { 22 | "@angular/core": { singleton: true, requiredVersion:'auto' }, 23 | "@angular/common": { singleton: true, requiredVersion:'auto' }, 24 | "@angular/router": { singleton: true, requiredVersion:'auto' }, 25 | }, 26 | }), 27 | ], 28 | }; 29 | -------------------------------------------------------------------------------- /dashboardPage/webpack.prod.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./webpack.config"); 2 | -------------------------------------------------------------------------------- /layout/.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 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /layout/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /layout/.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 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | 16 | # IDEs and editors 17 | /.idea 18 | .project 19 | .classpath 20 | .c9/ 21 | *.launch 22 | .settings/ 23 | *.sublime-workspace 24 | 25 | # IDE - VSCode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # misc 34 | /.sass-cache 35 | /connect.lock 36 | /coverage 37 | /libpeerconnection.log 38 | npm-debug.log 39 | yarn-error.log 40 | testem.log 41 | /typings 42 | 43 | # System Files 44 | .DS_Store 45 | Thumbs.db 46 | -------------------------------------------------------------------------------- /layout/README.md: -------------------------------------------------------------------------------- 1 | # Layout 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.4. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 28 | -------------------------------------------------------------------------------- /layout/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "layout": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | }, 12 | "@schematics/angular:application": { 13 | "strict": true 14 | } 15 | }, 16 | "root": "", 17 | "sourceRoot": "src", 18 | "prefix": "app", 19 | "architect": { 20 | "build": { 21 | "builder": "ngx-build-plus:browser", 22 | "options": { 23 | "outputPath": "dist/layout", 24 | "index": "src/index.html", 25 | "main": "src/main.ts", 26 | "polyfills": "src/polyfills.ts", 27 | "tsConfig": "tsconfig.app.json", 28 | "inlineStyleLanguage": "scss", 29 | "assets": [ 30 | "src/favicon.ico", 31 | "src/assets" 32 | ], 33 | "styles": [ 34 | "src/styles.scss" 35 | ], 36 | "scripts": [], 37 | "extraWebpackConfig": "webpack.config.js" 38 | }, 39 | "configurations": { 40 | "production": { 41 | "budgets": [ 42 | { 43 | "type": "initial", 44 | "maximumWarning": "500kb", 45 | "maximumError": "1mb" 46 | }, 47 | { 48 | "type": "anyComponentStyle", 49 | "maximumWarning": "2kb", 50 | "maximumError": "4kb" 51 | } 52 | ], 53 | "extraWebpackConfig": "webpack.prod.config.js", 54 | "fileReplacements": [ 55 | { 56 | "replace": "src/environments/environment.ts", 57 | "with": "src/environments/environment.prod.ts" 58 | } 59 | ], 60 | "outputHashing": "all" 61 | }, 62 | "development": { 63 | "buildOptimizer": false, 64 | "optimization": false, 65 | "vendorChunk": true, 66 | "extractLicenses": false, 67 | "sourceMap": true, 68 | "namedChunks": true 69 | } 70 | }, 71 | "defaultConfiguration": "production" 72 | }, 73 | "serve": { 74 | "builder": "ngx-build-plus:dev-server", 75 | "configurations": { 76 | "production": { 77 | "browserTarget": "layout:build:production" 78 | }, 79 | "development": { 80 | "browserTarget": "layout:build:development", 81 | "extraWebpackConfig": "webpack.config.js", 82 | "port": 4205 83 | } 84 | }, 85 | "defaultConfiguration": "development" 86 | }, 87 | "extract-i18n": { 88 | "builder": "@angular-devkit/build-angular:extract-i18n", 89 | "options": { 90 | "browserTarget": "layout:build" 91 | } 92 | }, 93 | "test": { 94 | "builder": "ngx-build-plus:karma", 95 | "options": { 96 | "main": "src/test.ts", 97 | "polyfills": "src/polyfills.ts", 98 | "tsConfig": "tsconfig.spec.json", 99 | "karmaConfig": "karma.conf.js", 100 | "inlineStyleLanguage": "scss", 101 | "assets": [ 102 | "src/favicon.ico", 103 | "src/assets" 104 | ], 105 | "styles": [ 106 | "src/styles.scss" 107 | ], 108 | "scripts": [], 109 | "extraWebpackConfig": "webpack.config.js" 110 | } 111 | } 112 | } 113 | } 114 | }, 115 | "defaultProject": "layout" 116 | } 117 | -------------------------------------------------------------------------------- /layout/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/layout'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /layout/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "layout", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "~12.2.0", 14 | "@angular/common": "~12.2.0", 15 | "@angular/compiler": "~12.2.0", 16 | "@angular/core": "~12.2.0", 17 | "@angular/forms": "~12.2.0", 18 | "@angular/platform-browser": "~12.2.0", 19 | "@angular/platform-browser-dynamic": "~12.2.0", 20 | "@angular/router": "~12.2.0", 21 | "rxjs": "~6.6.0", 22 | "tslib": "^2.3.0", 23 | "zone.js": "~0.11.4" 24 | }, 25 | "devDependencies": { 26 | "@angular-devkit/build-angular": "~12.2.4", 27 | "@angular/cli": "~12.2.4", 28 | "@angular/compiler-cli": "~12.2.0", 29 | "@types/jasmine": "~3.8.0", 30 | "@types/node": "^12.11.1", 31 | "jasmine-core": "~3.8.0", 32 | "karma": "~6.3.0", 33 | "karma-chrome-launcher": "~3.1.0", 34 | "karma-coverage": "~2.0.3", 35 | "karma-jasmine": "~4.0.0", 36 | "karma-jasmine-html-reporter": "~1.7.0", 37 | "ngx-build-plus": "^12.2.0", 38 | "typescript": "~4.3.5" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /layout/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | const routes: Routes = []; 5 | 6 | @NgModule({ 7 | imports: [RouterModule.forRoot(routes)], 8 | exports: [RouterModule] 9 | }) 10 | export class AppRoutingModule { } 11 | -------------------------------------------------------------------------------- /layout/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/layout/src/app/app.component.scss -------------------------------------------------------------------------------- /layout/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 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'layout'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('layout'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement as HTMLElement; 33 | expect(compiled.querySelector('.content span')?.textContent).toContain('layout app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /layout/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 = 'layout'; 10 | } 11 | -------------------------------------------------------------------------------- /layout/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { AppComponent } from './app.component'; 6 | import { LayoutModule } from './modules/layout/layout.module'; 7 | 8 | @NgModule({ 9 | declarations: [ 10 | AppComponent 11 | ], 12 | imports: [ 13 | BrowserModule, 14 | AppRoutingModule, 15 | LayoutModule 16 | ], 17 | providers: [], 18 | bootstrap: [AppComponent] 19 | }) 20 | export class AppModule { } 21 | -------------------------------------------------------------------------------- /layout/src/app/core/services/auth/auth.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthService } from './auth.service'; 4 | 5 | describe('AuthService', () => { 6 | let service: AuthService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(AuthService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /layout/src/app/core/services/auth/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable({ 4 | providedIn: 'root' 5 | }) 6 | export class AuthService { 7 | isLogged = false; 8 | 9 | constructor() { 10 | this.isLogged = Boolean(localStorage.getItem('token')); 11 | } 12 | 13 | logout() { 14 | localStorage.removeItem('token'); 15 | dispatchEvent(new CustomEvent('app-event-bus', { 16 | bubbles: true, 17 | detail: { 18 | eventType: 'auth-register' 19 | } 20 | })); 21 | this.isLogged = false; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/footer/footer.component.html: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/footer/footer.component.scss: -------------------------------------------------------------------------------- 1 | .footer { 2 | min-height: 200px; 3 | background: #1976D2; 4 | color: white; 5 | padding: 40px 20px; 6 | } 7 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/footer/footer.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { FooterComponent } from './footer.component'; 4 | 5 | describe('FooterComponent', () => { 6 | let component: FooterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ FooterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(FooterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/footer/footer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-footer', 5 | templateUrl: './footer.component.html', 6 | styleUrls: ['./footer.component.scss'] 7 | }) 8 | export class FooterComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/header/header.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/header/header.component.scss: -------------------------------------------------------------------------------- 1 | .header { 2 | padding: 5px; 3 | box-shadow: 0 0 3px 1px #80808040; 4 | display: flex; 5 | justify-content: space-between; 6 | } 7 | 8 | button { 9 | padding: 10px; 10 | border-radius: 5px; 11 | border: none; 12 | background: #1976D2; 13 | cursor: pointer; 14 | color: white; 15 | } 16 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/header/header.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HeaderComponent } from './header.component'; 4 | 5 | describe('HeaderComponent', () => { 6 | let component: HeaderComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ HeaderComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(HeaderComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/header/header.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnDestroy, OnInit } from '@angular/core'; 2 | import { fromEvent, Subscription } from 'rxjs'; 3 | import { AuthService } from 'src/app/core/services/auth/auth.service'; 4 | 5 | @Component({ 6 | selector: 'app-header', 7 | templateUrl: './header.component.html', 8 | styleUrls: ['./header.component.scss'] 9 | }) 10 | export class HeaderComponent implements OnInit, OnDestroy { 11 | $eventBus?: Subscription; 12 | 13 | constructor(public auth: AuthService) { } 14 | 15 | onEventHandler(e: CustomEvent) { 16 | if (e.detail.eventType === 'auth-register') { 17 | this.auth.isLogged = Boolean(localStorage.getItem('token')); 18 | } 19 | } 20 | 21 | ngOnInit() { 22 | this.$eventBus = fromEvent(window, 'app-event-bus').subscribe((e) => this.onEventHandler(e)); 23 | } 24 | 25 | ngOnDestroy() { 26 | this.$eventBus?.unsubscribe(); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/layout.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { HeaderComponent } from './header/header.component'; 4 | import { FooterComponent } from './footer/footer.component'; 5 | import { LogoComponent } from './logo/logo.component'; 6 | 7 | 8 | 9 | @NgModule({ 10 | declarations: [ 11 | HeaderComponent, 12 | FooterComponent, 13 | LogoComponent 14 | ], 15 | imports: [ 16 | CommonModule 17 | ], 18 | exports: [ 19 | HeaderComponent, 20 | FooterComponent, 21 | LogoComponent 22 | ] 23 | }) 24 | export class LayoutModule { } 25 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/logo/logo.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/layout/src/app/modules/layout/logo/logo.component.scss -------------------------------------------------------------------------------- /layout/src/app/modules/layout/logo/logo.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LogoComponent } from './logo.component'; 4 | 5 | describe('LogoComponent', () => { 6 | let component: LogoComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LogoComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LogoComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/logo/logo.component.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /layout/src/app/modules/layout/logo/logo.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-logo', 5 | templateUrl: './logo.component.svg', 6 | styleUrls: ['./logo.component.scss'] 7 | }) 8 | export class LogoComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /layout/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/layout/src/assets/.gitkeep -------------------------------------------------------------------------------- /layout/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /layout/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 | -------------------------------------------------------------------------------- /layout/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/layout/src/favicon.ico -------------------------------------------------------------------------------- /layout/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Layout 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /layout/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /layout/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 Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 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 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /layout/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /layout/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 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting(), 21 | { teardown: { destroyAfterEach: true }}, 22 | ); 23 | 24 | // Then we find all the tests. 25 | const context = require.context('./', true, /\.spec\.ts$/); 26 | // And load the modules. 27 | context.keys().map(context); 28 | -------------------------------------------------------------------------------- /layout/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /layout/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "sourceMap": true, 12 | "declaration": false, 13 | "downlevelIteration": true, 14 | "experimentalDecorators": true, 15 | "moduleResolution": "node", 16 | "importHelpers": true, 17 | "target": "es2017", 18 | "module": "es2020", 19 | "lib": [ 20 | "es2018", 21 | "dom" 22 | ] 23 | }, 24 | "angularCompilerOptions": { 25 | "enableI18nLegacyMessageIdFormat": false, 26 | "strictInjectionParameters": true, 27 | "strictInputAccessModifiers": true, 28 | "strictTemplates": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /layout/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /layout/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin"); 3 | 4 | module.exports = { 5 | output: { 6 | publicPath: "http://localhost:4205/", 7 | uniqueName: "layout", 8 | }, 9 | optimization: { 10 | runtimeChunk: false, 11 | }, 12 | plugins: [ 13 | new ModuleFederationPlugin({ 14 | name: "layout", 15 | library: { type: "var", name: "layout" }, 16 | filename: "remoteEntry.js", 17 | exposes: { 18 | LayoutModule: 19 | "./src/app/modules/layout/layout.module.ts", 20 | Header: './src/app/modules/layout/header/header.component.ts', 21 | Footer: './src/app/modules/layout/footer/footer.component.ts' 22 | }, 23 | shared: { 24 | "@angular/core": { singleton: true, requiredVersion:'auto' }, 25 | "@angular/common": { singleton: true, requiredVersion:'auto' }, 26 | "@angular/router": { singleton: true, requiredVersion:'auto' }, 27 | }, 28 | }), 29 | ], 30 | }; 31 | -------------------------------------------------------------------------------- /layout/webpack.prod.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./webpack.config"); 2 | -------------------------------------------------------------------------------- /registerPage/.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 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /registerPage/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /registerPage/.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 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | 16 | # IDEs and editors 17 | /.idea 18 | .project 19 | .classpath 20 | .c9/ 21 | *.launch 22 | .settings/ 23 | *.sublime-workspace 24 | 25 | # IDE - VSCode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # misc 34 | /.sass-cache 35 | /connect.lock 36 | /coverage 37 | /libpeerconnection.log 38 | npm-debug.log 39 | yarn-error.log 40 | testem.log 41 | /typings 42 | 43 | # System Files 44 | .DS_Store 45 | Thumbs.db 46 | -------------------------------------------------------------------------------- /registerPage/README.md: -------------------------------------------------------------------------------- 1 | # RegisterPage 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.4. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 28 | -------------------------------------------------------------------------------- /registerPage/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "registerPage": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | }, 12 | "@schematics/angular:application": { 13 | "strict": true 14 | } 15 | }, 16 | "root": "", 17 | "sourceRoot": "src", 18 | "prefix": "app", 19 | "architect": { 20 | "build": { 21 | "builder": "ngx-build-plus:browser", 22 | "options": { 23 | "outputPath": "dist/registerPage", 24 | "index": "src/index.html", 25 | "main": "src/main.ts", 26 | "polyfills": "src/polyfills.ts", 27 | "tsConfig": "tsconfig.app.json", 28 | "inlineStyleLanguage": "scss", 29 | "assets": [ 30 | "src/favicon.ico", 31 | "src/assets" 32 | ], 33 | "styles": [ 34 | "src/styles.scss" 35 | ], 36 | "scripts": [], 37 | "extraWebpackConfig": "webpack.config.js" 38 | }, 39 | "configurations": { 40 | "production": { 41 | "budgets": [ 42 | { 43 | "type": "initial", 44 | "maximumWarning": "500kb", 45 | "maximumError": "1mb" 46 | }, 47 | { 48 | "type": "anyComponentStyle", 49 | "maximumWarning": "2kb", 50 | "maximumError": "4kb" 51 | } 52 | ], 53 | "fileReplacements": [ 54 | { 55 | "replace": "src/environments/environment.ts", 56 | "with": "src/environments/environment.prod.ts" 57 | } 58 | ], 59 | "outputHashing": "all", 60 | "extraWebpackConfig": "webpack.prod.config.js" 61 | }, 62 | "development": { 63 | "buildOptimizer": false, 64 | "optimization": false, 65 | "vendorChunk": true, 66 | "extractLicenses": false, 67 | "sourceMap": true, 68 | "namedChunks": true 69 | } 70 | }, 71 | "defaultConfiguration": "production" 72 | }, 73 | "serve": { 74 | "builder": "ngx-build-plus:dev-server", 75 | "configurations": { 76 | "production": { 77 | "browserTarget": "registerPage:build:production" 78 | }, 79 | "development": { 80 | "browserTarget": "registerPage:build:development", 81 | "extraWebpackConfig": "webpack.config.js", 82 | "port": 4201 83 | } 84 | }, 85 | "defaultConfiguration": "development" 86 | }, 87 | "extract-i18n": { 88 | "builder": "@angular-devkit/build-angular:extract-i18n", 89 | "options": { 90 | "browserTarget": "registerPage:build" 91 | } 92 | }, 93 | "test": { 94 | "builder": "ngx-build-plus:karma", 95 | "options": { 96 | "main": "src/test.ts", 97 | "polyfills": "src/polyfills.ts", 98 | "tsConfig": "tsconfig.spec.json", 99 | "karmaConfig": "karma.conf.js", 100 | "inlineStyleLanguage": "scss", 101 | "assets": [ 102 | "src/favicon.ico", 103 | "src/assets" 104 | ], 105 | "styles": [ 106 | "src/styles.scss" 107 | ], 108 | "scripts": [], 109 | "extraWebpackConfig": "webpack.config.js" 110 | } 111 | } 112 | } 113 | } 114 | }, 115 | "defaultProject": "registerPage" 116 | } 117 | -------------------------------------------------------------------------------- /registerPage/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/registerPage'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /registerPage/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "register-page", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "~12.2.0", 14 | "@angular/common": "~12.2.0", 15 | "@angular/compiler": "~12.2.0", 16 | "@angular/core": "~12.2.0", 17 | "@angular/forms": "~12.2.0", 18 | "@angular/platform-browser": "~12.2.0", 19 | "@angular/platform-browser-dynamic": "~12.2.0", 20 | "@angular/router": "~12.2.0", 21 | "ngx-common-ui-lib": "0.0.13", 22 | "rxjs": "~6.6.0", 23 | "tslib": "^2.3.0", 24 | "zone.js": "~0.11.4" 25 | }, 26 | "devDependencies": { 27 | "@angular-devkit/build-angular": "~12.2.4", 28 | "@angular/cli": "~12.2.4", 29 | "@angular/compiler-cli": "~12.2.0", 30 | "@tinkoff/shared-library-webpack-plugin": "^1.1.0", 31 | "@types/jasmine": "~3.8.0", 32 | "@types/node": "^12.11.1", 33 | "jasmine-core": "~3.8.0", 34 | "karma": "~6.3.0", 35 | "karma-chrome-launcher": "~3.1.0", 36 | "karma-coverage": "~2.0.3", 37 | "karma-jasmine": "~4.0.0", 38 | "karma-jasmine-html-reporter": "~1.7.0", 39 | "ngx-build-plus": "^12.2.0", 40 | "typescript": "~4.3.5" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /registerPage/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { RegisterPageModule } from './modules/register/register-page.module'; 4 | 5 | const routes: Routes = []; 6 | 7 | @NgModule({ 8 | imports: [RouterModule.forRoot(routes), RegisterPageModule], 9 | exports: [RouterModule] 10 | }) 11 | export class AppRoutingModule { } 12 | -------------------------------------------------------------------------------- /registerPage/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/registerPage/src/app/app.component.scss -------------------------------------------------------------------------------- /registerPage/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 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'registerPage'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('registerPage'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement as HTMLElement; 33 | expect(compiled.querySelector('.content span')?.textContent).toContain('registerPage app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /registerPage/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 = 'registerPage'; 10 | } 11 | -------------------------------------------------------------------------------- /registerPage/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { AppComponent } from './app.component'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | AppRoutingModule 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent] 17 | }) 18 | export class AppModule { } 19 | -------------------------------------------------------------------------------- /registerPage/src/app/core/services/auth/auth.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthService } from './auth.service'; 4 | 5 | describe('AuthService', () => { 6 | let service: AuthService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(AuthService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /registerPage/src/app/core/services/auth/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { RegisterUserData, RegisterUserResponse } from './auth.types'; 4 | import { environment } from 'src/environments/environment'; 5 | import { Observable } from 'rxjs'; 6 | 7 | @Injectable() 8 | export class AuthService { 9 | 10 | constructor(private http: HttpClient) { } 11 | 12 | register(data: RegisterUserData): Observable { 13 | return this.http.post(`${environment.apiUrl}/register`, data); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /registerPage/src/app/core/services/auth/auth.types.ts: -------------------------------------------------------------------------------- 1 | export interface RegisterUserData { 2 | email: string; 3 | password: string; 4 | } 5 | 6 | export interface RegisterUserResponse { 7 | id: number; 8 | token: string; 9 | } 10 | -------------------------------------------------------------------------------- /registerPage/src/app/modules/register/components/register-form/register-form.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | 6 | 7 | 8 | This field is mandatory. 9 | This field is invalid. 10 | 11 |
12 | 13 |
14 | 15 | 16 | 17 | This field is mandatory. 18 | 19 |
20 | 21 | 22 |
23 |
24 |
25 | -------------------------------------------------------------------------------- /registerPage/src/app/modules/register/components/register-form/register-form.component.scss: -------------------------------------------------------------------------------- 1 | fieldset { 2 | border: none; 3 | padding: 10px; 4 | display: flex; 5 | flex-direction: column; 6 | 7 | label { 8 | margin-bottom: 8px; 9 | } 10 | 11 | input { 12 | padding: 10px 10px 10px 0; 13 | border: none; 14 | border-bottom: 1px solid #808080; 15 | outline: none; 16 | } 17 | 18 | .error-text { 19 | color: red; 20 | font-size: 12px; 21 | } 22 | } 23 | 24 | button { 25 | margin: 16px; 26 | padding: 10px 20px; 27 | background: #1975d2; 28 | color: white; 29 | border-radius: 5px; 30 | border: none; 31 | cursor: pointer; 32 | } 33 | -------------------------------------------------------------------------------- /registerPage/src/app/modules/register/components/register-form/register-form.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RegisterComponent } from './register.component'; 4 | 5 | describe('RegisterComponent', () => { 6 | let component: RegisterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RegisterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RegisterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /registerPage/src/app/modules/register/components/register-form/register-form.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, EventEmitter, OnInit, Output } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { NgxCommonUiLibService } from 'ngx-common-ui-lib'; 4 | import { faFilm } from '@fortawesome/free-solid-svg-icons'; 5 | 6 | export interface RegisterFormValues { 7 | email: string; 8 | password: string; 9 | } 10 | @Component({ 11 | selector: 'app-register-form', 12 | templateUrl: './register-form.component.html', 13 | styleUrls: ['./register-form.component.scss'] 14 | }) 15 | export class RegisterFormComponent implements OnInit { 16 | @Output() formSubmitted = new EventEmitter(); 17 | faFilm = faFilm; 18 | 19 | registerForm: FormGroup; 20 | 21 | constructor(private fb: FormBuilder, private service: NgxCommonUiLibService) { 22 | this.registerForm = this.fb.group({ 23 | email: this.fb.control('', [Validators.email, Validators.required]), 24 | password: this.fb.control('', [Validators.required]) 25 | }); 26 | } 27 | 28 | ngOnInit(): void { 29 | this.service.print(); 30 | } 31 | 32 | submit(){ 33 | this.formSubmitted.emit(this.registerForm.value); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /registerPage/src/app/modules/register/pages/register-page/register-page.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /registerPage/src/app/modules/register/pages/register-page/register-page.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/registerPage/src/app/modules/register/pages/register-page/register-page.component.scss -------------------------------------------------------------------------------- /registerPage/src/app/modules/register/pages/register-page/register-page.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RegisterPageComponent } from './register-page.component'; 4 | 5 | describe('RegisterPageComponent', () => { 6 | let component: RegisterPageComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RegisterPageComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RegisterPageComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /registerPage/src/app/modules/register/pages/register-page/register-page.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AuthService } from 'src/app/core/services/auth/auth.service'; 3 | import { RegisterFormValues } from '../../components/register-form/register-form.component'; 4 | 5 | @Component({ 6 | selector: 'app-register-page', 7 | templateUrl: './register-page.component.html', 8 | styleUrls: ['./register-page.component.scss'] 9 | }) 10 | export class RegisterPageComponent implements OnInit { 11 | 12 | constructor(private auth: AuthService) { } 13 | 14 | ngOnInit(): void { 15 | } 16 | 17 | formSubmitted (values: RegisterFormValues) { 18 | this.auth.register(values).subscribe((res) => { 19 | localStorage.setItem('token', res.token); 20 | const busEvent = new CustomEvent('app-event-bus', { 21 | bubbles: true, 22 | detail: { 23 | eventType: 'auth-register' 24 | } 25 | }); 26 | dispatchEvent(busEvent); 27 | }); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /registerPage/src/app/modules/register/register-page-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { Route, RouterModule } from '@angular/router'; 4 | import { RegisterPageComponent } from './pages/register-page/register-page.component'; 5 | 6 | const routes: Route[] = [{ path: '', component: RegisterPageComponent }]; 7 | 8 | @NgModule({ 9 | declarations: [], 10 | imports: [ 11 | CommonModule, 12 | RouterModule.forChild(routes) 13 | ], 14 | exports: [RouterModule] 15 | }) 16 | export class RegisterPageRoutingModule { } 17 | -------------------------------------------------------------------------------- /registerPage/src/app/modules/register/register-page.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { RegisterPageRoutingModule } from './register-page-routing.module'; 4 | import { HttpClientModule } from '@angular/common/http'; 5 | import { RegisterPageComponent } from './pages/register-page/register-page.component'; 6 | import { RegisterFormComponent } from './components/register-form/register-form.component'; 7 | import { AuthService } from 'src/app/core/services/auth/auth.service'; 8 | import { ReactiveFormsModule } from '@angular/forms'; 9 | import { NgxCommonUiLibModule, NgxCommonUiLibService } from 'ngx-common-ui-lib'; 10 | 11 | @NgModule({ 12 | declarations: [ 13 | RegisterPageComponent, 14 | RegisterFormComponent 15 | ], 16 | imports: [ 17 | CommonModule, 18 | RegisterPageRoutingModule, 19 | HttpClientModule, 20 | ReactiveFormsModule, 21 | NgxCommonUiLibModule 22 | ], 23 | providers: [AuthService, NgxCommonUiLibService] 24 | }) 25 | export class RegisterPageModule { } 26 | -------------------------------------------------------------------------------- /registerPage/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/registerPage/src/assets/.gitkeep -------------------------------------------------------------------------------- /registerPage/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | apiUrl: 'https://reqres.in/api' 4 | }; 5 | -------------------------------------------------------------------------------- /registerPage/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 | apiUrl: 'https://reqres.in/api' 8 | }; 9 | 10 | /* 11 | * For easier debugging in development mode, you can import the following file 12 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 13 | * 14 | * This import should be commented out in production mode because it will have a negative impact 15 | * on performance if an error is thrown. 16 | */ 17 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 18 | -------------------------------------------------------------------------------- /registerPage/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/registerPage/src/favicon.ico -------------------------------------------------------------------------------- /registerPage/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RegisterPage 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /registerPage/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /registerPage/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 Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 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 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /registerPage/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /registerPage/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 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting(), 21 | { teardown: { destroyAfterEach: true }}, 22 | ); 23 | 24 | // Then we find all the tests. 25 | const context = require.context('./', true, /\.spec\.ts$/); 26 | // And load the modules. 27 | context.keys().map(context); 28 | -------------------------------------------------------------------------------- /registerPage/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /registerPage/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "sourceMap": true, 12 | "declaration": false, 13 | "downlevelIteration": true, 14 | "experimentalDecorators": true, 15 | "moduleResolution": "node", 16 | "importHelpers": true, 17 | "target": "es2017", 18 | "module": "es2020", 19 | "lib": [ 20 | "es2018", 21 | "dom" 22 | ] 23 | }, 24 | "angularCompilerOptions": { 25 | "enableI18nLegacyMessageIdFormat": false, 26 | "strictInjectionParameters": true, 27 | "strictInputAccessModifiers": true, 28 | "strictTemplates": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /registerPage/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /registerPage/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | 3 | const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin"); 4 | 5 | module.exports = { 6 | output: { 7 | publicPath: "http://localhost:4201/", 8 | uniqueName: "register", 9 | }, 10 | optimization: { 11 | runtimeChunk: false, 12 | }, 13 | plugins: [ 14 | new ModuleFederationPlugin({ 15 | name: "register", 16 | library: { type: "var", name: "register" }, 17 | filename: "remoteEntry.js", 18 | exposes: { 19 | RegisterPageModule: 20 | "./src/app/modules/register/register-page.module.ts", 21 | }, 22 | shared: { 23 | "@angular/core": { singleton: true, requiredVersion: 'auto' }, 24 | "@angular/common": { singleton: true, requiredVersion: 'auto' }, 25 | "@angular/router": { singleton: true, requiredVersion: 'auto' }, 26 | "ngx-common-ui-lib": { singleton: true, requiredVersion: 'auto'}, 27 | // "ngx-common-ui-lib": { singleton: true, requiredVersion: 'auto' }, // async loading (less bundle size if packages already presented in shell) 28 | // "ngx-common-ui-lib": { singleton: true, requiredVersion: '^0.0.13' }, // pass required lib version 29 | // "ngx-common-ui-lib": { eager: true, singleton: true }, // sync loading 30 | }, 31 | }), 32 | ], 33 | }; 34 | -------------------------------------------------------------------------------- /registerPage/webpack.prod.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./webpack.config"); 2 | -------------------------------------------------------------------------------- /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 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /shell/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /shell/.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 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | 16 | # IDEs and editors 17 | /.idea 18 | .project 19 | .classpath 20 | .c9/ 21 | *.launch 22 | .settings/ 23 | *.sublime-workspace 24 | 25 | # IDE - VSCode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # misc 34 | /.sass-cache 35 | /connect.lock 36 | /coverage 37 | /libpeerconnection.log 38 | npm-debug.log 39 | yarn-error.log 40 | testem.log 41 | /typings 42 | 43 | # System Files 44 | .DS_Store 45 | Thumbs.db 46 | -------------------------------------------------------------------------------- /shell/README.md: -------------------------------------------------------------------------------- 1 | # Shell 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.4. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 28 | -------------------------------------------------------------------------------- /shell/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "shell": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | }, 12 | "@schematics/angular:application": { 13 | "strict": true 14 | } 15 | }, 16 | "root": "", 17 | "sourceRoot": "src", 18 | "prefix": "app", 19 | "architect": { 20 | "build": { 21 | "builder": "ngx-build-plus:browser", 22 | "options": { 23 | "outputPath": "dist/shell", 24 | "index": "src/index.html", 25 | "main": "src/main.ts", 26 | "polyfills": "src/polyfills.ts", 27 | "tsConfig": "tsconfig.app.json", 28 | "inlineStyleLanguage": "scss", 29 | "assets": [ 30 | "src/favicon.ico", 31 | "src/assets" 32 | ], 33 | "styles": [ 34 | "src/styles.scss" 35 | ], 36 | "scripts": [], 37 | "extraWebpackConfig": "webpack.config.js" 38 | }, 39 | "configurations": { 40 | "production": { 41 | "budgets": [ 42 | { 43 | "type": "initial", 44 | "maximumWarning": "500kb", 45 | "maximumError": "1mb" 46 | }, 47 | { 48 | "type": "anyComponentStyle", 49 | "maximumWarning": "2kb", 50 | "maximumError": "4kb" 51 | } 52 | ], 53 | "extraWebpackConfig": "webpack.config.js", 54 | "fileReplacements": [ 55 | { 56 | "replace": "src/environments/environment.ts", 57 | "with": "src/environments/environment.prod.ts" 58 | } 59 | ], 60 | "outputHashing": "all" 61 | }, 62 | "development": { 63 | "buildOptimizer": false, 64 | "optimization": false, 65 | "vendorChunk": true, 66 | "extractLicenses": false, 67 | "sourceMap": true, 68 | "namedChunks": true 69 | } 70 | }, 71 | "defaultConfiguration": "production" 72 | }, 73 | "serve": { 74 | "builder": "ngx-build-plus:dev-server", 75 | "configurations": { 76 | "production": { 77 | "browserTarget": "shell:build:production", 78 | "extraWebpackConfig": "webpack.prod.config.js" 79 | }, 80 | "development": { 81 | "browserTarget": "shell:build:development", 82 | "extraWebpackConfig": "webpack.config.js", 83 | "port": 4200 84 | } 85 | }, 86 | "defaultConfiguration": "development" 87 | }, 88 | "extract-i18n": { 89 | "builder": "@angular-devkit/build-angular:extract-i18n", 90 | "options": { 91 | "browserTarget": "shell:build" 92 | } 93 | }, 94 | "test": { 95 | "builder": "@angular-devkit/build-angular:karma", 96 | "options": { 97 | "main": "src/test.ts", 98 | "polyfills": "src/polyfills.ts", 99 | "tsConfig": "tsconfig.spec.json", 100 | "karmaConfig": "karma.conf.js", 101 | "inlineStyleLanguage": "scss", 102 | "assets": [ 103 | "src/favicon.ico", 104 | "src/assets" 105 | ], 106 | "styles": [ 107 | "src/styles.scss" 108 | ], 109 | "scripts": [] 110 | } 111 | } 112 | } 113 | } 114 | }, 115 | "defaultProject": "shell" 116 | } 117 | -------------------------------------------------------------------------------- /shell/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/shell'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /shell/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shell", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "~12.2.0", 14 | "@angular/common": "~12.2.0", 15 | "@angular/compiler": "~12.2.0", 16 | "@angular/core": "~12.2.0", 17 | "@angular/forms": "~12.2.0", 18 | "@angular/platform-browser": "~12.2.0", 19 | "@angular/platform-browser-dynamic": "~12.2.0", 20 | "@angular/router": "~12.2.0", 21 | "rxjs": "~6.6.0", 22 | "tslib": "^2.3.0", 23 | "zone.js": "~0.11.4" 24 | }, 25 | "devDependencies": { 26 | "@angular-devkit/build-angular": "~12.2.4", 27 | "@angular/cli": "~12.2.4", 28 | "@angular/compiler-cli": "~12.2.0", 29 | "@types/jasmine": "~3.8.0", 30 | "@types/node": "^12.11.1", 31 | "jasmine-core": "~3.8.0", 32 | "karma": "~6.3.0", 33 | "karma-chrome-launcher": "~3.1.0", 34 | "karma-coverage": "~2.0.3", 35 | "karma-jasmine": "~4.0.0", 36 | "karma-jasmine-html-reporter": "~1.7.0", 37 | "ngx-build-plus": "^12.2.0", 38 | "typescript": "~4.3.5" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /shell/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | const routes: Routes = []; 5 | 6 | @NgModule({ 7 | imports: [RouterModule.forRoot(routes)], 8 | exports: [RouterModule] 9 | }) 10 | export class AppRoutingModule { } 11 | -------------------------------------------------------------------------------- /shell/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 | 7 | 8 | 9 | 10 |
11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /shell/src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | main { 2 | display: flex; 3 | justify-content: space-between; 4 | flex-direction: column; 5 | margin: 0; 6 | min-height: 100vh; 7 | height: 100vh; 8 | } 9 | 10 | .content { 11 | display: flex; 12 | height: 100%; 13 | } 14 | 15 | app-navbar { 16 | width: 160px; 17 | min-width: 160px; 18 | border-right: 1px solid rgba(128, 128, 128, 0.562); 19 | } 20 | 21 | .page-content { 22 | padding: 20px; 23 | width: 100%; 24 | } 25 | -------------------------------------------------------------------------------- /shell/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 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'shell'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('shell'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement as HTMLElement; 33 | expect(compiled.querySelector('.content span')?.textContent).toContain('shell app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /shell/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ViewContainerRef, 3 | Component, 4 | ComponentFactoryResolver, 5 | OnInit, 6 | AfterViewInit, 7 | Injector, 8 | ViewChild, 9 | OnDestroy 10 | } from '@angular/core'; 11 | import { RouteConfigLoadEnd, RouteConfigLoadStart, Router } from '@angular/router'; 12 | import { fromEvent, Subscription } from 'rxjs'; 13 | import { AuthService } from './core/services/auth/auth.service'; 14 | import { loadRemoteModule } from './utils/federation-utils'; 15 | import { environment } from 'src/environments/environment'; 16 | 17 | @Component({ 18 | selector: 'app-root', 19 | templateUrl: './app.component.html', 20 | styleUrls: ['./app.component.scss'] 21 | }) 22 | export class AppComponent implements AfterViewInit, OnInit, OnDestroy { 23 | @ViewChild('header', { read: ViewContainerRef, static: true }) 24 | headerContainer!: ViewContainerRef; 25 | 26 | @ViewChild('footer', { read: ViewContainerRef, static: true }) 27 | footerContainer!: ViewContainerRef; 28 | 29 | $eventBus: Subscription | undefined; 30 | loadingRouteConfig = false; 31 | 32 | constructor(private injector: Injector, 33 | private resolver: ComponentFactoryResolver, 34 | public auth: AuthService, 35 | private router: Router 36 | ) {} 37 | 38 | onEventHandler(e: CustomEvent) { 39 | if (e.detail.eventType === 'auth-register') { 40 | const isLogged = Boolean(localStorage.getItem('token')); 41 | this.auth.isLogged = isLogged; 42 | if (isLogged) { 43 | this.router.navigate(['/']); 44 | } else { 45 | this.router.navigate(['/signup']); 46 | } 47 | } 48 | } 49 | 50 | ngOnInit() { 51 | this.$eventBus = fromEvent(window, 'app-event-bus').subscribe((e) => this.onEventHandler(e)); 52 | this.router.events.subscribe(event => { 53 | if (event instanceof RouteConfigLoadStart) { 54 | this.loadingRouteConfig = true; 55 | } else if (event instanceof RouteConfigLoadEnd) { 56 | this.loadingRouteConfig = false; 57 | } 58 | }); 59 | } 60 | 61 | ngAfterViewInit(): void { 62 | // load header 63 | loadRemoteModule({ 64 | ...environment.microfrontends.layout, 65 | exposedModule: environment.microfrontends.layout.exposedModule[0], 66 | }) 67 | .then(module => { 68 | const factory = this.resolver.resolveComponentFactory(module.HeaderComponent); 69 | this.headerContainer?.createComponent(factory, undefined, this.injector); 70 | }); 71 | 72 | // load footer 73 | loadRemoteModule({ 74 | ...environment.microfrontends.layout, 75 | exposedModule: environment.microfrontends.layout.exposedModule[1], 76 | }) 77 | .then(module => { 78 | const factory = this.resolver.resolveComponentFactory(module.FooterComponent); 79 | this.footerContainer?.createComponent(factory, undefined, this.injector); 80 | }); 81 | } 82 | 83 | ngOnDestroy(): void { 84 | this.$eventBus?.unsubscribe(); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /shell/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { APP_INITIALIZER, NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { RouterModule } from '@angular/router'; 4 | 5 | import { AppRoutingModule } from './app-routing.module'; 6 | import { AppComponent } from './app.component'; 7 | import { APP_ROUTES } from './app.routes'; 8 | import { LoaderComponent } from './core/components/loader/loader.component'; 9 | import { NavbarComponent } from './core/components/navbar/navbar.component'; 10 | import { MicrofrontendService } from './core/services/microfrontends/microfrontend.service'; 11 | 12 | export function initializeApp( 13 | mfService: MicrofrontendService 14 | ): () => Promise { 15 | return () => mfService.initialise(); 16 | } 17 | 18 | @NgModule({ 19 | declarations: [ 20 | AppComponent, 21 | NavbarComponent, 22 | LoaderComponent 23 | ], 24 | imports: [ 25 | BrowserModule, 26 | AppRoutingModule, 27 | RouterModule.forRoot(APP_ROUTES, { relativeLinkResolution: 'legacy' }), 28 | ], 29 | providers: [ 30 | MicrofrontendService, 31 | { 32 | provide: APP_INITIALIZER, 33 | useFactory: initializeApp, 34 | multi: true, 35 | deps: [MicrofrontendService], 36 | }, 37 | ], 38 | bootstrap: [AppComponent] 39 | }) 40 | export class AppModule { } 41 | -------------------------------------------------------------------------------- /shell/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | import { LoggedOnlyGuard } from './core/guards/logged-only.guard'; 3 | import { UnloggedOnlyGuard } from './core/guards/unlogged-only.guard'; 4 | import { Microfrontend } from './core/services/microfrontends/microfrontend.types'; 5 | import { environment } from 'src/environments/environment'; 6 | 7 | export const APP_ROUTES: Routes = []; 8 | 9 | export const MICROFRONTEND_ROUTES: Microfrontend[] = [ 10 | { 11 | ...environment.microfrontends.dashboard, 12 | exposedModule: environment.microfrontends.dashboard.exposedModule[0], 13 | 14 | // For Routing, enabling us to ngFor over the microfrontends and dynamically create links for the routes 15 | displayName: 'Dashboard', 16 | routePath: '', 17 | ngModuleName: 'DashboardModule', 18 | canActivate: [LoggedOnlyGuard] 19 | }, 20 | { 21 | ...environment.microfrontends.tablePage, 22 | exposedModule: environment.microfrontends.tablePage.exposedModule[0], 23 | displayName: 'Table', 24 | routePath: 'table', 25 | ngModuleName: 'TablePageModule', 26 | }, 27 | { 28 | ...environment.microfrontends.registerPage, 29 | exposedModule: environment.microfrontends.registerPage.exposedModule[0], 30 | 31 | displayName: 'Register', 32 | routePath: 'signup', 33 | ngModuleName: 'RegisterPageModule', 34 | canActivate: [UnloggedOnlyGuard] 35 | }, 36 | { 37 | ...environment.microfrontends.staticPage, 38 | exposedModule: environment.microfrontends.staticPage.exposedModule[0], 39 | displayName: 'Static page', 40 | routePath: 'static', 41 | ngModuleName: 'StaticPageModule', 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /shell/src/app/core/components/loader/loader.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 | -------------------------------------------------------------------------------- /shell/src/app/core/components/loader/loader.component.scss: -------------------------------------------------------------------------------- 1 | .lds-ring { 2 | position: relative; 3 | height: 80px; 4 | width: 100%; 5 | display: flex; 6 | justify-content: center; 7 | } 8 | .lds-ring div { 9 | box-sizing: border-box; 10 | display: block; 11 | position: absolute; 12 | width: 64px; 13 | height: 64px; 14 | margin: 8px; 15 | border: 8px solid #fcf; 16 | border-radius: 50%; 17 | animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; 18 | border-color: #fcf transparent transparent transparent; 19 | } 20 | .lds-ring div:nth-child(1) { 21 | animation-delay: -0.45s; 22 | } 23 | .lds-ring div:nth-child(2) { 24 | animation-delay: -0.3s; 25 | } 26 | .lds-ring div:nth-child(3) { 27 | animation-delay: -0.15s; 28 | } 29 | @keyframes lds-ring { 30 | 0% { 31 | transform: rotate(0deg); 32 | } 33 | 100% { 34 | transform: rotate(360deg); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /shell/src/app/core/components/loader/loader.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoaderComponent } from './loader.component'; 4 | 5 | describe('LoaderComponent', () => { 6 | let component: LoaderComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LoaderComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoaderComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /shell/src/app/core/components/loader/loader.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-loader', 5 | templateUrl: './loader.component.html', 6 | styleUrls: ['./loader.component.scss'] 7 | }) 8 | export class LoaderComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /shell/src/app/core/components/navbar/navbar.component.html: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /shell/src/app/core/components/navbar/navbar.component.scss: -------------------------------------------------------------------------------- 1 | nav { 2 | display: flex; 3 | flex-direction: column; 4 | background: #F2F2F2; 5 | height: 100%; 6 | 7 | a { 8 | padding: 10px; 9 | text-decoration: none; 10 | color: black; 11 | 12 | &:hover { 13 | background: grey; 14 | } 15 | } 16 | } 17 | 18 | .active-link { 19 | background: grey; 20 | } 21 | -------------------------------------------------------------------------------- /shell/src/app/core/components/navbar/navbar.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { NavbarComponent } from './navbar.component'; 4 | 5 | describe('NavbarComponent', () => { 6 | let component: NavbarComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ NavbarComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(NavbarComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /shell/src/app/core/components/navbar/navbar.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-navbar', 5 | templateUrl: './navbar.component.html', 6 | styleUrls: ['./navbar.component.scss'] 7 | }) 8 | export class NavbarComponent implements OnInit { 9 | @Input() isLogged = false; 10 | 11 | constructor() { } 12 | 13 | ngOnInit(): void { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /shell/src/app/core/guards/logged-only.guard.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { LoggedOnlyGuard } from './logged-only.guard'; 4 | 5 | describe('LoggedOnlyGuard', () => { 6 | let guard: LoggedOnlyGuard; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | guard = TestBed.inject(LoggedOnlyGuard); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(guard).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /shell/src/app/core/guards/logged-only.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree } from '@angular/router'; 3 | import { Observable } from 'rxjs'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class LoggedOnlyGuard implements CanActivate { 9 | canActivate( 10 | route: ActivatedRouteSnapshot, 11 | state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { 12 | const token = localStorage.getItem('token'); 13 | if (token) { 14 | return true; 15 | } 16 | return false; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /shell/src/app/core/guards/unlogged-only.guard.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { UnloggedOnlyGuard } from './unlogged-only.guard'; 4 | 5 | describe('UnloggedOnlyGuard', () => { 6 | let guard: UnloggedOnlyGuard; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | guard = TestBed.inject(UnloggedOnlyGuard); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(guard).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /shell/src/app/core/guards/unlogged-only.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree } from '@angular/router'; 3 | import { Observable } from 'rxjs'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class UnloggedOnlyGuard implements CanActivate { 9 | canActivate( 10 | route: ActivatedRouteSnapshot, 11 | state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { 12 | const token = localStorage.getItem('token'); 13 | if (token) { 14 | return false; 15 | } 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /shell/src/app/core/services/auth/auth.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthService } from './auth.service'; 4 | 5 | describe('AuthService', () => { 6 | let service: AuthService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(AuthService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /shell/src/app/core/services/auth/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable({ 4 | providedIn: 'root' 5 | }) 6 | export class AuthService { 7 | 8 | isLogged: boolean; 9 | 10 | constructor() { 11 | this.isLogged = Boolean(localStorage.getItem('token')); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /shell/src/app/core/services/microfrontends/microfrontend.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { MICROFRONTEND_ROUTES } from 'src/app/app.routes'; 4 | import { buildRoutes } from 'src/app/utils/route-utils'; 5 | 6 | @Injectable({ providedIn: 'root' }) 7 | export class MicrofrontendService { 8 | constructor(private router: Router) {} 9 | 10 | /* 11 | * Initialize is called on app startup to load the initial list of 12 | * remote microfrontends and configure them within the router 13 | */ 14 | initialise(): Promise { 15 | return new Promise((resolve) => { 16 | this.router.resetConfig(buildRoutes(MICROFRONTEND_ROUTES)); 17 | 18 | return resolve(); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /shell/src/app/core/services/microfrontends/microfrontend.types.ts: -------------------------------------------------------------------------------- 1 | import { LoadRemoteModuleOptions } from "src/app/utils/federation-utils"; 2 | 3 | export type Microfrontend = LoadRemoteModuleOptions & { 4 | displayName: string; 5 | routePath: string; 6 | ngModuleName: string; 7 | canActivate?: any[] 8 | }; 9 | -------------------------------------------------------------------------------- /shell/src/app/utils/federation-utils.ts: -------------------------------------------------------------------------------- 1 | type Scope = unknown; 2 | type Factory = () => any; 3 | 4 | interface Container { 5 | init(shareScope: Scope): void; 6 | get(module: string): Factory; 7 | } 8 | 9 | declare const __webpack_init_sharing__: (shareScope: string) => Promise; 10 | declare const __webpack_share_scopes__: { default: Scope }; 11 | 12 | const moduleMap: Record = {}; 13 | 14 | function loadRemoteEntry(remoteEntry: string): Promise { 15 | return new Promise((resolve, reject) => { 16 | if (moduleMap[remoteEntry]) { 17 | return resolve(); 18 | } 19 | 20 | const script = document.createElement('script'); 21 | script.src = remoteEntry; 22 | 23 | script.onerror = reject; 24 | 25 | script.onload = () => { 26 | moduleMap[remoteEntry] = true; 27 | resolve(); // window is the global namespace 28 | }; 29 | 30 | document.body.append(script); 31 | }); 32 | } 33 | 34 | async function lookupExposedModule( 35 | remoteName: string, 36 | exposedModule: string 37 | ): Promise { 38 | // Initializes the share scope. This fills it with known provided modules from this build and all remotes 39 | await __webpack_init_sharing__('default'); 40 | const container = window[remoteName] as Container; // or get the container somewhere else 41 | // Initialize the container, it may provide shared modules 42 | 43 | await container.init(__webpack_share_scopes__.default); 44 | const factory = await container.get(exposedModule); 45 | const Module = factory(); 46 | return Module as T; 47 | } 48 | 49 | export interface LoadRemoteModuleOptions { 50 | remoteEntry: string; 51 | remoteName: string; 52 | exposedModule: string; 53 | } 54 | 55 | export async function loadRemoteModule( 56 | options: LoadRemoteModuleOptions 57 | ): Promise { 58 | await loadRemoteEntry(options.remoteEntry); 59 | return lookupExposedModule( 60 | options.remoteName, 61 | options.exposedModule 62 | ); 63 | } 64 | -------------------------------------------------------------------------------- /shell/src/app/utils/route-utils.ts: -------------------------------------------------------------------------------- 1 | import { loadRemoteModule } from './federation-utils'; 2 | import { Routes } from '@angular/router'; 3 | import { APP_ROUTES } from '../app.routes'; 4 | import { Microfrontend } from '../core/services/microfrontends/microfrontend.types'; 5 | 6 | export function buildRoutes(options: Microfrontend[]): Routes { 7 | const lazyRoutes: Routes = options.map((o) => ({ 8 | path: o.routePath, 9 | loadChildren: () => loadRemoteModule(o).then((m) => m[o.ngModuleName]), 10 | canActivate: o.canActivate, 11 | pathMatch: 'full' 12 | })); 13 | 14 | return [ 15 | ...APP_ROUTES, 16 | ...lazyRoutes 17 | ]; 18 | } 19 | -------------------------------------------------------------------------------- /shell/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/shell/src/assets/.gitkeep -------------------------------------------------------------------------------- /shell/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | 4 | microfrontends: { 5 | dashboard: { 6 | remoteEntry: 'http://localhost:4204/remoteEntry.js', 7 | remoteName: 'dashboard', 8 | exposedModule: ['DashboardModule'], 9 | }, 10 | tablePage: { 11 | remoteEntry: 'http://localhost:4202/remoteEntry.js', 12 | remoteName: 'table', 13 | exposedModule: ['TablePageModule'], 14 | }, 15 | registerPage : { 16 | remoteEntry: 'http://localhost:4201/remoteEntry.js', 17 | remoteName: 'register', 18 | exposedModule: ['RegisterPageModule'], 19 | }, 20 | staticPage: { 21 | remoteEntry: 'http://localhost:4203/remoteEntry.js', 22 | remoteName: 'staticPage', 23 | exposedModule: ['StaticPageModule'], 24 | }, 25 | layout: { 26 | remoteEntry: 'http://localhost:4205/remoteEntry.js', 27 | remoteName: 'layout', 28 | exposedModule: ['Header', 'Footer', 'LayoutModule'], 29 | } 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /shell/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 | microfrontends: { 9 | dashboard: { 10 | remoteEntry: 'http://localhost:4204/remoteEntry.js', 11 | remoteName: 'dashboard', 12 | exposedModule: ['DashboardModule'], 13 | }, 14 | tablePage: { 15 | remoteEntry: 'http://localhost:4202/remoteEntry.js', 16 | remoteName: 'table', 17 | exposedModule: ['TablePageModule'], 18 | }, 19 | registerPage : { 20 | remoteEntry: 'http://localhost:4201/remoteEntry.js', 21 | remoteName: 'register', 22 | exposedModule: ['RegisterPageModule'], 23 | }, 24 | staticPage: { 25 | remoteEntry: 'http://localhost:4203/remoteEntry.js', 26 | remoteName: 'staticPage', 27 | exposedModule: ['StaticPageModule'], 28 | }, 29 | layout: { 30 | remoteEntry: 'http://localhost:4205/remoteEntry.js', 31 | remoteName: 'layout', 32 | exposedModule: ['Header', 'Footer', 'LayoutModule'], 33 | } 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /shell/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/shell/src/favicon.ico -------------------------------------------------------------------------------- /shell/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Shell 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /shell/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /shell/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 Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 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 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /shell/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body { 3 | margin: 0; 4 | } 5 | -------------------------------------------------------------------------------- /shell/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 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting(), 21 | { teardown: { destroyAfterEach: true }}, 22 | ); 23 | 24 | // Then we find all the tests. 25 | const context = require.context('./', true, /\.spec\.ts$/); 26 | // And load the modules. 27 | context.keys().map(context); 28 | -------------------------------------------------------------------------------- /shell/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /shell/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "suppressImplicitAnyIndexErrors": true, 6 | "baseUrl": "./", 7 | "outDir": "./dist/out-tsc", 8 | "forceConsistentCasingInFileNames": true, 9 | "strict": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "sourceMap": true, 13 | "declaration": false, 14 | "downlevelIteration": true, 15 | "experimentalDecorators": true, 16 | "moduleResolution": "node", 17 | "importHelpers": true, 18 | "target": "es2017", 19 | "module": "es2020", 20 | "lib": [ 21 | "es2018", 22 | "dom" 23 | ] 24 | }, 25 | "angularCompilerOptions": { 26 | "enableI18nLegacyMessageIdFormat": false, 27 | "strictInjectionParameters": true, 28 | "strictInputAccessModifiers": true, 29 | "strictTemplates": true 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /shell/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /shell/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin"); 3 | 4 | module.exports = { 5 | output: { 6 | publicPath: "http://localhost:4200/", 7 | uniqueName: "shell", 8 | }, 9 | optimization: { 10 | runtimeChunk: false, 11 | }, 12 | plugins: [ 13 | new ModuleFederationPlugin({ 14 | shared: { 15 | "@angular/core": { eager: true, singleton: true }, 16 | "@angular/common": { eager: true, singleton: true }, 17 | "@angular/router": { eager: true, singleton: true }, 18 | }, 19 | }), 20 | ], 21 | }; 22 | -------------------------------------------------------------------------------- /shell/webpack.prod.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./webpack.config"); 2 | -------------------------------------------------------------------------------- /staticPage/.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 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /staticPage/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /staticPage/.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 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | 16 | # IDEs and editors 17 | /.idea 18 | .project 19 | .classpath 20 | .c9/ 21 | *.launch 22 | .settings/ 23 | *.sublime-workspace 24 | 25 | # IDE - VSCode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # misc 34 | /.sass-cache 35 | /connect.lock 36 | /coverage 37 | /libpeerconnection.log 38 | npm-debug.log 39 | yarn-error.log 40 | testem.log 41 | /typings 42 | 43 | # System Files 44 | .DS_Store 45 | Thumbs.db 46 | -------------------------------------------------------------------------------- /staticPage/README.md: -------------------------------------------------------------------------------- 1 | # StaticPage 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.4. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 28 | -------------------------------------------------------------------------------- /staticPage/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "staticPage": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | }, 12 | "@schematics/angular:application": { 13 | "strict": true 14 | } 15 | }, 16 | "root": "", 17 | "sourceRoot": "src", 18 | "prefix": "app", 19 | "architect": { 20 | "build": { 21 | "builder": "ngx-build-plus:browser", 22 | "options": { 23 | "outputPath": "dist/staticPage", 24 | "index": "src/index.html", 25 | "main": "src/main.ts", 26 | "polyfills": "src/polyfills.ts", 27 | "tsConfig": "tsconfig.app.json", 28 | "inlineStyleLanguage": "scss", 29 | "assets": [ 30 | "src/favicon.ico", 31 | "src/assets" 32 | ], 33 | "styles": [ 34 | "src/styles.scss" 35 | ], 36 | "scripts": [], 37 | "extraWebpackConfig": "webpack.config.js" 38 | }, 39 | "configurations": { 40 | "production": { 41 | "budgets": [ 42 | { 43 | "type": "initial", 44 | "maximumWarning": "500kb", 45 | "maximumError": "2mb" 46 | }, 47 | { 48 | "type": "anyComponentStyle", 49 | "maximumWarning": "2kb", 50 | "maximumError": "4kb" 51 | } 52 | ], 53 | "fileReplacements": [ 54 | { 55 | "replace": "src/environments/environment.ts", 56 | "with": "src/environments/environment.prod.ts" 57 | } 58 | ], 59 | "outputHashing": "all", 60 | "extraWebpackConfig": "webpack.prod.config.js" 61 | }, 62 | "development": { 63 | "buildOptimizer": false, 64 | "optimization": false, 65 | "vendorChunk": true, 66 | "extractLicenses": false, 67 | "sourceMap": true, 68 | "namedChunks": true 69 | } 70 | }, 71 | "defaultConfiguration": "production" 72 | }, 73 | "serve": { 74 | "builder": "ngx-build-plus:dev-server", 75 | "configurations": { 76 | "production": { 77 | "browserTarget": "staticPage:build:production" 78 | }, 79 | "development": { 80 | "browserTarget": "staticPage:build:development", 81 | "extraWebpackConfig": "webpack.config.js", 82 | "port": 4203 83 | } 84 | }, 85 | "defaultConfiguration": "development" 86 | }, 87 | "extract-i18n": { 88 | "builder": "@angular-devkit/build-angular:extract-i18n", 89 | "options": { 90 | "browserTarget": "staticPage:build" 91 | } 92 | }, 93 | "test": { 94 | "builder": "ngx-build-plus:karma", 95 | "options": { 96 | "main": "src/test.ts", 97 | "polyfills": "src/polyfills.ts", 98 | "tsConfig": "tsconfig.spec.json", 99 | "karmaConfig": "karma.conf.js", 100 | "inlineStyleLanguage": "scss", 101 | "assets": [ 102 | "src/favicon.ico", 103 | "src/assets" 104 | ], 105 | "styles": [ 106 | "src/styles.scss" 107 | ], 108 | "scripts": [], 109 | "extraWebpackConfig": "webpack.config.js" 110 | } 111 | } 112 | } 113 | } 114 | }, 115 | "defaultProject": "staticPage" 116 | } 117 | -------------------------------------------------------------------------------- /staticPage/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/staticPage'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /staticPage/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "static-page", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "~12.2.0", 14 | "@angular/common": "~12.2.0", 15 | "@angular/compiler": "~12.2.0", 16 | "@angular/core": "~12.2.0", 17 | "@angular/forms": "~12.2.0", 18 | "@angular/platform-browser": "~12.2.0", 19 | "@angular/platform-browser-dynamic": "~12.2.0", 20 | "@angular/router": "~12.2.0", 21 | "ngx-common-ui-lib": "0.0.12", 22 | "rxjs": "~6.6.0", 23 | "tslib": "^2.3.0", 24 | "zone.js": "~0.11.4" 25 | }, 26 | "devDependencies": { 27 | "@angular-devkit/build-angular": "~12.2.4", 28 | "@angular/cli": "~12.2.4", 29 | "@angular/compiler-cli": "~12.2.0", 30 | "@types/jasmine": "~3.8.0", 31 | "@types/node": "^12.11.1", 32 | "jasmine-core": "~3.8.0", 33 | "karma": "~6.3.0", 34 | "karma-chrome-launcher": "~3.1.0", 35 | "karma-coverage": "~2.0.3", 36 | "karma-jasmine": "~4.0.0", 37 | "karma-jasmine-html-reporter": "~1.7.0", 38 | "ngx-build-plus": "^12.2.0", 39 | "typescript": "~4.3.5" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /staticPage/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { StaticModule } from './modules/static/static.module'; 4 | 5 | const routes: Routes = []; 6 | 7 | @NgModule({ 8 | imports: [RouterModule.forRoot(routes), StaticModule], 9 | exports: [RouterModule] 10 | }) 11 | export class AppRoutingModule { } 12 | -------------------------------------------------------------------------------- /staticPage/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/staticPage/src/app/app.component.scss -------------------------------------------------------------------------------- /staticPage/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 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'staticPage'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('staticPage'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement as HTMLElement; 33 | expect(compiled.querySelector('.content span')?.textContent).toContain('staticPage app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /staticPage/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 = 'staticPage'; 10 | } 11 | -------------------------------------------------------------------------------- /staticPage/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { AppComponent } from './app.component'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | AppRoutingModule 14 | ], 15 | providers: [], 16 | bootstrap: [AppComponent] 17 | }) 18 | export class AppModule { } 19 | -------------------------------------------------------------------------------- /staticPage/src/app/modules/static/pages/static-page/static-page.component.html: -------------------------------------------------------------------------------- 1 |

static-page works!

2 | 3 |

4 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Velit officiis modi ex sapiente numquam, facilis voluptatem, in quo accusamus ab repellat accusantium porro! At necessitatibus, obcaecati eius quo voluptatibus molestiae? 5 |

6 |

7 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Velit officiis modi ex sapiente numquam, facilis voluptatem, in quo accusamus ab repellat accusantium porro! At necessitatibus, obcaecati eius quo voluptatibus molestiae? 8 |

9 |

10 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Velit officiis modi ex sapiente numquam, facilis voluptatem, in quo accusamus ab repellat accusantium porro! At necessitatibus, obcaecati eius quo voluptatibus molestiae? 11 |

12 |

13 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Velit officiis modi ex sapiente numquam, facilis voluptatem, in quo accusamus ab repellat accusantium porro! At necessitatibus, obcaecati eius quo voluptatibus molestiae? 14 |

15 |

16 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Velit officiis modi ex sapiente numquam, facilis voluptatem, in quo accusamus ab repellat accusantium porro! At necessitatibus, obcaecati eius quo voluptatibus molestiae? 17 |

18 |

19 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Velit officiis modi ex sapiente numquam, facilis voluptatem, in quo accusamus ab repellat accusantium porro! At necessitatibus, obcaecati eius quo voluptatibus molestiae? 20 |

21 |

22 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Velit officiis modi ex sapiente numquam, facilis voluptatem, in quo accusamus ab repellat accusantium porro! At necessitatibus, obcaecati eius quo voluptatibus molestiae? 23 |

24 |

25 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Velit officiis modi ex sapiente numquam, facilis voluptatem, in quo accusamus ab repellat accusantium porro! At necessitatibus, obcaecati eius quo voluptatibus molestiae? 26 |

27 |

28 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Velit officiis modi ex sapiente numquam, facilis voluptatem, in quo accusamus ab repellat accusantium porro! At necessitatibus, obcaecati eius quo voluptatibus molestiae? 29 |

30 | -------------------------------------------------------------------------------- /staticPage/src/app/modules/static/pages/static-page/static-page.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/staticPage/src/app/modules/static/pages/static-page/static-page.component.scss -------------------------------------------------------------------------------- /staticPage/src/app/modules/static/pages/static-page/static-page.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { StaticPageComponent } from './static-page.component'; 4 | 5 | describe('StaticPageComponent', () => { 6 | let component: StaticPageComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ StaticPageComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(StaticPageComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /staticPage/src/app/modules/static/pages/static-page/static-page.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { NgxCommonUiLibService } from 'ngx-common-ui-lib'; 3 | 4 | @Component({ 5 | selector: 'app-static-page', 6 | templateUrl: './static-page.component.html', 7 | styleUrls: ['./static-page.component.scss'] 8 | }) 9 | export class StaticPageComponent implements OnInit { 10 | 11 | constructor(private service: NgxCommonUiLibService) { 12 | service.print(); 13 | } 14 | 15 | ngOnInit(): void { 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /staticPage/src/app/modules/static/static.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { StaticPageComponent } from './pages/static-page/static-page.component'; 4 | import { StaticRoutingModule } from './static.routing.module'; 5 | import { NgxCommonUiLibModule } from 'ngx-common-ui-lib'; 6 | 7 | 8 | 9 | @NgModule({ 10 | declarations: [StaticPageComponent], 11 | imports: [ 12 | CommonModule, 13 | StaticRoutingModule, 14 | NgxCommonUiLibModule 15 | ] 16 | }) 17 | export class StaticModule { } 18 | -------------------------------------------------------------------------------- /staticPage/src/app/modules/static/static.routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { Route, RouterModule } from '@angular/router'; 4 | import { StaticPageComponent } from './pages/static-page/static-page.component'; 5 | 6 | const routes: Route[] = [{ path: '', component: StaticPageComponent }] 7 | 8 | @NgModule({ 9 | declarations: [], 10 | imports: [ 11 | CommonModule, 12 | RouterModule.forChild(routes) 13 | ], 14 | exports: [RouterModule] 15 | }) 16 | export class StaticRoutingModule { } 17 | -------------------------------------------------------------------------------- /staticPage/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/staticPage/src/assets/.gitkeep -------------------------------------------------------------------------------- /staticPage/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /staticPage/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 | -------------------------------------------------------------------------------- /staticPage/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/staticPage/src/favicon.ico -------------------------------------------------------------------------------- /staticPage/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | StaticPage 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /staticPage/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /staticPage/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 Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 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 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /staticPage/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /staticPage/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 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting(), 21 | { teardown: { destroyAfterEach: true }}, 22 | ); 23 | 24 | // Then we find all the tests. 25 | const context = require.context('./', true, /\.spec\.ts$/); 26 | // And load the modules. 27 | context.keys().map(context); 28 | -------------------------------------------------------------------------------- /staticPage/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /staticPage/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "sourceMap": true, 12 | "declaration": false, 13 | "downlevelIteration": true, 14 | "experimentalDecorators": true, 15 | "moduleResolution": "node", 16 | "importHelpers": true, 17 | "target": "es2017", 18 | "module": "es2020", 19 | "lib": [ 20 | "es2018", 21 | "dom" 22 | ] 23 | }, 24 | "angularCompilerOptions": { 25 | "enableI18nLegacyMessageIdFormat": false, 26 | "strictInjectionParameters": true, 27 | "strictInputAccessModifiers": true, 28 | "strictTemplates": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /staticPage/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /staticPage/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin"); 3 | 4 | module.exports = { 5 | output: { 6 | publicPath: "http://localhost:4203/", 7 | uniqueName: "staticPage", 8 | }, 9 | optimization: { 10 | runtimeChunk: false, 11 | }, 12 | plugins: [ 13 | new ModuleFederationPlugin({ 14 | name: "staticPage", 15 | library: { type: "var", name: "staticPage" }, 16 | filename: "remoteEntry.js", 17 | exposes: { 18 | StaticPageModule: 19 | "./src/app/modules/static/static.module.ts", 20 | }, 21 | shared: { 22 | "@angular/core": { singleton: true, requiredVersion:'auto' }, 23 | "@angular/common": { singleton: true, requiredVersion:'auto' }, 24 | "@angular/router": { singleton: true, requiredVersion:'auto' }, 25 | "ngx-common-ui-lib": { singleton: true, requiredVersion:'auto' }, 26 | }, 27 | }), 28 | ], 29 | }; 30 | -------------------------------------------------------------------------------- /staticPage/webpack.prod.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./webpack.config"); 2 | -------------------------------------------------------------------------------- /tablePage/.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 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /tablePage/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://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 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /tablePage/.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 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | 16 | # IDEs and editors 17 | /.idea 18 | .project 19 | .classpath 20 | .c9/ 21 | *.launch 22 | .settings/ 23 | *.sublime-workspace 24 | 25 | # IDE - VSCode 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | .history/* 32 | 33 | # misc 34 | /.sass-cache 35 | /connect.lock 36 | /coverage 37 | /libpeerconnection.log 38 | npm-debug.log 39 | yarn-error.log 40 | testem.log 41 | /typings 42 | 43 | # System Files 44 | .DS_Store 45 | Thumbs.db 46 | -------------------------------------------------------------------------------- /tablePage/README.md: -------------------------------------------------------------------------------- 1 | # TablePage 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.4. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 28 | -------------------------------------------------------------------------------- /tablePage/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "tablePage": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | }, 12 | "@schematics/angular:application": { 13 | "strict": true 14 | } 15 | }, 16 | "root": "", 17 | "sourceRoot": "src", 18 | "prefix": "app", 19 | "architect": { 20 | "build": { 21 | "builder": "ngx-build-plus:browser", 22 | "options": { 23 | "outputPath": "dist/tablePage", 24 | "index": "src/index.html", 25 | "main": "src/main.ts", 26 | "polyfills": "src/polyfills.ts", 27 | "tsConfig": "tsconfig.app.json", 28 | "inlineStyleLanguage": "scss", 29 | "assets": [ 30 | "src/favicon.ico", 31 | "src/assets" 32 | ], 33 | "styles": [ 34 | "./node_modules/@angular/material/prebuilt-themes/purple-green.css", 35 | "src/styles.scss" 36 | ], 37 | "scripts": [], 38 | "extraWebpackConfig": "webpack.config.js" 39 | }, 40 | "configurations": { 41 | "production": { 42 | "budgets": [ 43 | { 44 | "type": "initial", 45 | "maximumWarning": "500kb", 46 | "maximumError": "1mb" 47 | }, 48 | { 49 | "type": "anyComponentStyle", 50 | "maximumWarning": "2kb", 51 | "maximumError": "100kb" 52 | } 53 | ], 54 | "fileReplacements": [ 55 | { 56 | "replace": "src/environments/environment.ts", 57 | "with": "src/environments/environment.prod.ts" 58 | } 59 | ], 60 | "outputHashing": "all", 61 | "extraWebpackConfig": "webpack.prod.config.js" 62 | }, 63 | "development": { 64 | "buildOptimizer": false, 65 | "optimization": false, 66 | "vendorChunk": true, 67 | "extractLicenses": false, 68 | "sourceMap": true, 69 | "namedChunks": true 70 | } 71 | }, 72 | "defaultConfiguration": "production" 73 | }, 74 | "serve": { 75 | "builder": "ngx-build-plus:dev-server", 76 | "configurations": { 77 | "production": { 78 | "browserTarget": "tablePage:build:production" 79 | }, 80 | "development": { 81 | "browserTarget": "tablePage:build:development", 82 | "extraWebpackConfig": "webpack.config.js", 83 | "port": 4202 84 | } 85 | }, 86 | "defaultConfiguration": "development" 87 | }, 88 | "extract-i18n": { 89 | "builder": "@angular-devkit/build-angular:extract-i18n", 90 | "options": { 91 | "browserTarget": "tablePage:build" 92 | } 93 | }, 94 | "test": { 95 | "builder": "ngx-build-plus:karma", 96 | "options": { 97 | "main": "src/test.ts", 98 | "polyfills": "src/polyfills.ts", 99 | "tsConfig": "tsconfig.spec.json", 100 | "karmaConfig": "karma.conf.js", 101 | "inlineStyleLanguage": "scss", 102 | "assets": [ 103 | "src/favicon.ico", 104 | "src/assets" 105 | ], 106 | "styles": [ 107 | "./node_modules/@angular/material/prebuilt-themes/purple-green.css", 108 | "src/styles.scss" 109 | ], 110 | "scripts": [], 111 | "extraWebpackConfig": "webpack.config.js" 112 | } 113 | } 114 | } 115 | } 116 | }, 117 | "defaultProject": "tablePage" 118 | } 119 | -------------------------------------------------------------------------------- /tablePage/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/tablePage'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /tablePage/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "table-page", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "~12.2.0", 14 | "@angular/cdk": "^12.2.5", 15 | "@angular/common": "~12.2.0", 16 | "@angular/compiler": "~12.2.0", 17 | "@angular/core": "~12.2.0", 18 | "@angular/forms": "~12.2.0", 19 | "@angular/material": "^12.2.5", 20 | "@angular/platform-browser": "~12.2.0", 21 | "@angular/platform-browser-dynamic": "~12.2.0", 22 | "@angular/router": "~12.2.0", 23 | "rxjs": "~6.6.0", 24 | "tslib": "^2.3.0", 25 | "zone.js": "~0.11.4" 26 | }, 27 | "devDependencies": { 28 | "@angular-devkit/build-angular": "~12.2.4", 29 | "@angular/cli": "~12.2.4", 30 | "@angular/compiler-cli": "~12.2.0", 31 | "@types/jasmine": "~3.8.0", 32 | "@types/node": "^12.11.1", 33 | "jasmine-core": "~3.8.0", 34 | "karma": "~6.3.0", 35 | "karma-chrome-launcher": "~3.1.0", 36 | "karma-coverage": "~2.0.3", 37 | "karma-jasmine": "~4.0.0", 38 | "karma-jasmine-html-reporter": "~1.7.0", 39 | "ngx-build-plus": "^12.2.0", 40 | "typescript": "~4.3.5" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tablePage/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { TableModule } from './modules/table/table.module'; 4 | 5 | const routes: Routes = []; 6 | 7 | @NgModule({ 8 | imports: [RouterModule.forRoot(routes), TableModule], 9 | exports: [RouterModule] 10 | }) 11 | export class AppRoutingModule { } 12 | -------------------------------------------------------------------------------- /tablePage/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /tablePage/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/tablePage/src/app/app.component.scss -------------------------------------------------------------------------------- /tablePage/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 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'tablePage'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('tablePage'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement as HTMLElement; 33 | expect(compiled.querySelector('.content span')?.textContent).toContain('tablePage app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /tablePage/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 = 'tablePage'; 10 | } 11 | -------------------------------------------------------------------------------- /tablePage/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { AppComponent } from './app.component'; 6 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 7 | 8 | @NgModule({ 9 | declarations: [ 10 | AppComponent 11 | ], 12 | imports: [ 13 | BrowserModule, 14 | AppRoutingModule, 15 | BrowserAnimationsModule 16 | ], 17 | providers: [], 18 | bootstrap: [AppComponent] 19 | }) 20 | export class AppModule { } 21 | -------------------------------------------------------------------------------- /tablePage/src/app/modules/table/components/paginated-table/paginated-table.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
No. {{element.position}} Name {{element.name}} Weight {{element.weight}} Symbol {{element.symbol}}
31 | 32 | 35 | 36 |
37 | -------------------------------------------------------------------------------- /tablePage/src/app/modules/table/components/paginated-table/paginated-table.component.scss: -------------------------------------------------------------------------------- 1 | @import "~@angular/material/prebuilt-themes/indigo-pink.css"; 2 | 3 | table { 4 | width: 100%; 5 | } 6 | -------------------------------------------------------------------------------- /tablePage/src/app/modules/table/components/paginated-table/paginated-table.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PaginatedTableComponent } from './paginated-table.component'; 4 | 5 | describe('PaginatedTableComponent', () => { 6 | let component: PaginatedTableComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PaginatedTableComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PaginatedTableComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /tablePage/src/app/modules/table/components/paginated-table/paginated-table.component.ts: -------------------------------------------------------------------------------- 1 | import { AfterViewInit, Component, ViewChild } from '@angular/core'; 2 | import {MatPaginator} from '@angular/material/paginator'; 3 | import {MatTableDataSource} from '@angular/material/table'; 4 | 5 | @Component({ 6 | selector: 'app-paginated-table', 7 | templateUrl: './paginated-table.component.html', 8 | styleUrls: ['./paginated-table.component.scss'] 9 | }) 10 | export class PaginatedTableComponent implements AfterViewInit { 11 | displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; 12 | dataSource = new MatTableDataSource(ELEMENT_DATA); 13 | 14 | @ViewChild(MatPaginator) paginator?: MatPaginator; 15 | 16 | ngAfterViewInit() { 17 | this.dataSource.paginator = this.paginator!; 18 | } 19 | } 20 | 21 | export interface PeriodicElement { 22 | name: string; 23 | position: number; 24 | weight: number; 25 | symbol: string; 26 | } 27 | 28 | const ELEMENT_DATA: PeriodicElement[] = [ 29 | {position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H'}, 30 | {position: 2, name: 'Helium', weight: 4.0026, symbol: 'He'}, 31 | {position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li'}, 32 | {position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be'}, 33 | {position: 5, name: 'Boron', weight: 10.811, symbol: 'B'}, 34 | ]; 35 | -------------------------------------------------------------------------------- /tablePage/src/app/modules/table/pages/table-page/table-page.component.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tablePage/src/app/modules/table/pages/table-page/table-page.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/tablePage/src/app/modules/table/pages/table-page/table-page.component.scss -------------------------------------------------------------------------------- /tablePage/src/app/modules/table/pages/table-page/table-page.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { TablePageComponent } from './table-page.component'; 4 | 5 | describe('TablePageComponent', () => { 6 | let component: TablePageComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ TablePageComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TablePageComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /tablePage/src/app/modules/table/pages/table-page/table-page.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-table-page', 5 | templateUrl: './table-page.component.html', 6 | styleUrls: ['./table-page.component.scss'] 7 | }) 8 | export class TablePageComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /tablePage/src/app/modules/table/table-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { RouterModule, Routes } from '@angular/router'; 4 | import { TablePageComponent } from './pages/table-page/table-page.component'; 5 | 6 | const routes: Routes = [{ path: '', component: TablePageComponent }]; 7 | 8 | @NgModule({ 9 | declarations: [], 10 | imports: [ 11 | CommonModule, 12 | RouterModule.forChild(routes) 13 | ], 14 | exports: [RouterModule] 15 | }) 16 | export class TableRoutingModule { } 17 | -------------------------------------------------------------------------------- /tablePage/src/app/modules/table/table.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { TablePageComponent } from './pages/table-page/table-page.component'; 4 | import { PaginatedTableComponent } from './components/paginated-table/paginated-table.component'; 5 | import { MatTableModule } from '@angular/material/table'; 6 | import { MatPaginatorModule } from '@angular/material/paginator'; 7 | import { TableRoutingModule } from './table-routing.module'; 8 | 9 | 10 | @NgModule({ 11 | declarations: [ 12 | PaginatedTableComponent, 13 | TablePageComponent 14 | ], 15 | imports: [ 16 | CommonModule, 17 | TableRoutingModule, 18 | MatTableModule, 19 | MatPaginatorModule 20 | ] 21 | }) 22 | export class TableModule { } 23 | -------------------------------------------------------------------------------- /tablePage/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/tablePage/src/assets/.gitkeep -------------------------------------------------------------------------------- /tablePage/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /tablePage/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 | -------------------------------------------------------------------------------- /tablePage/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/incora-dev/Microfrontend-Angular/f51525d676d7de9c85e6812fb4867c718070d833/tablePage/src/favicon.ico -------------------------------------------------------------------------------- /tablePage/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TablePage 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tablePage/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /tablePage/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 Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 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 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /tablePage/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | html, body { height: 100%; } 4 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 5 | -------------------------------------------------------------------------------- /tablePage/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 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting(), 21 | { teardown: { destroyAfterEach: true }}, 22 | ); 23 | 24 | // Then we find all the tests. 25 | const context = require.context('./', true, /\.spec\.ts$/); 26 | // And load the modules. 27 | context.keys().map(context); 28 | -------------------------------------------------------------------------------- /tablePage/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tablePage/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "sourceMap": true, 12 | "declaration": false, 13 | "downlevelIteration": true, 14 | "experimentalDecorators": true, 15 | "moduleResolution": "node", 16 | "importHelpers": true, 17 | "target": "es2017", 18 | "module": "es2020", 19 | "lib": [ 20 | "es2018", 21 | "dom" 22 | ] 23 | }, 24 | "angularCompilerOptions": { 25 | "enableI18nLegacyMessageIdFormat": false, 26 | "strictInjectionParameters": true, 27 | "strictInputAccessModifiers": true, 28 | "strictTemplates": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tablePage/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tablePage/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin"); 3 | 4 | module.exports = { 5 | output: { 6 | publicPath: "http://localhost:4202/", 7 | uniqueName: "table", 8 | }, 9 | optimization: { 10 | runtimeChunk: false, 11 | }, 12 | plugins: [ 13 | new ModuleFederationPlugin({ 14 | name: "table", 15 | library: { type: "var", name: "table" }, 16 | filename: "remoteEntry.js", 17 | exposes: { 18 | TablePageModule: 19 | "./src/app/modules/table/table.module.ts", 20 | }, 21 | shared: { 22 | "@angular/core": { singleton: true, requiredVersion:'auto' }, 23 | "@angular/common": { singleton: true, requiredVersion:'auto' }, 24 | "@angular/router": { singleton: true, requiredVersion:'auto' }, 25 | "@angular/material": { singleton: true, requiredVersion:'auto' }, 26 | }, 27 | }), 28 | ], 29 | }; 30 | -------------------------------------------------------------------------------- /tablePage/webpack.prod.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./webpack.config"); 2 | --------------------------------------------------------------------------------