Skip to content

Commit

Permalink
router basic setup.
Browse files Browse the repository at this point in the history
dashboard page component.
  • Loading branch information
mevratm committed Mar 12, 2021
1 parent 86d9cb0 commit e84875a
Show file tree
Hide file tree
Showing 19 changed files with 244 additions and 31 deletions.
75 changes: 50 additions & 25 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,56 @@
}
}
},
"assets": {
"projectType": "library",
"root": "libs/assets",
"sourceRoot": "libs/assets/src",
"prefix": "seedx",
"architect": {
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/assets/src/**/*.ts",
"libs/assets/src/**/*.html"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/libs/assets"],
"options": {
"jestConfig": "libs/assets/jest.config.js",
"passWithNoTests": true
}
}
}
},
"features-classification": {
"projectType": "library",
"root": "libs/features/classification",
"sourceRoot": "libs/features/classification/src",
"prefix": "seedx",
"architect": {
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/features/classification/src/**/*.ts",
"libs/features/classification/src/**/*.html"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/libs/features/classification"],
"options": {
"jestConfig": "libs/features/classification/jest.config.js",
"passWithNoTests": true
}
}
}
},
"green-api": {
"projectType": "application",
"root": "apps/green/api",
Expand Down Expand Up @@ -219,31 +269,6 @@
"builder": "@nx-go/nx-go:lint"
}
}
},
"assets": {
"projectType": "library",
"root": "libs/assets",
"sourceRoot": "libs/assets/src",
"prefix": "seedx",
"architect": {
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/assets/src/**/*.ts",
"libs/assets/src/**/*.html"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/libs/assets"],
"options": {
"jestConfig": "libs/assets/jest.config.js",
"passWithNoTests": true
}
}
}
}
},
"defaultProject": "green-client"
Expand Down
21 changes: 18 additions & 3 deletions apps/green/client/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ExtraOptions, Route, RouterModule } from '@angular/router';
import * as cf from '@features/classification';
import { AppComponent } from './app.component';
import { RouterModule } from '@angular/router';

const routerOpts: ExtraOptions = {
initialNavigation: 'enabled',
};

export const routes: Route[] = [
{
path: '',
children: cf.routes,
},
{ path: '**', redirectTo: '/', pathMatch: 'full' },
];

@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
RouterModule.forRoot([], { initialNavigation: 'enabled' }),
BrowserAnimationsModule,
cf.FeaturesClassificationModule,
RouterModule.forRoot(routes, routerOpts),
],
providers: [],
bootstrap: [AppComponent],
Expand Down
6 changes: 5 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
module.exports = {
projects: ['<rootDir>/apps/green/client', '<rootDir>/libs/assets'],
projects: [
'<rootDir>/apps/green/client',
'<rootDir>/libs/assets',
'<rootDir>/libs/features/classification',
],
};
31 changes: 31 additions & 0 deletions libs/features/classification/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"parserOptions": {
"project": ["libs/features/classification/tsconfig.*?.json"]
},
"rules": {
"@angular-eslint/directive-selector": [
"error",
{ "type": "attribute", "prefix": "seedx", "style": "camelCase" }
],
"@angular-eslint/component-selector": [
"error",
{ "type": "element", "prefix": "seedx", "style": "kebab-case" }
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions libs/features/classification/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# features-classification

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test features-classification` to execute the unit tests.
23 changes: 23 additions & 0 deletions libs/features/classification/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
displayName: 'features-classification',
preset: '../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
astTransformers: {
before: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},
},
},
coverageDirectory: '../../../coverage/libs/features/classification',
snapshotSerializers: [
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
'jest-preset-angular/build/AngularSnapshotSerializer.js',
'jest-preset-angular/build/HTMLCommentSerializer.js',
],
};
1 change: 1 addition & 0 deletions libs/features/classification/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/features-classification.module';
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { Route } from '@angular/router';
import { DashboardComponent } from './pages';

export const routes: Route[] = [{ path: '', component: DashboardComponent }];

@NgModule({
declarations: [DashboardComponent],
imports: [
CommonModule,
HttpClientModule,
ReactiveFormsModule,
BrowserAnimationsModule,
],
})
export class FeaturesClassificationModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>dashboard works!</p>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { DashboardComponent } from './dashboard.component';

describe('DashboardComponent', () => {
let component: DashboardComponent;
let fixture: ComponentFixture<DashboardComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ DashboardComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(DashboardComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'seedx-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}
1 change: 1 addition & 0 deletions libs/features/classification/src/lib/pages/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './dashboard/dashboard.component';
1 change: 1 addition & 0 deletions libs/features/classification/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'jest-preset-angular';
13 changes: 13 additions & 0 deletions libs/features/classification/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
19 changes: 19 additions & 0 deletions libs/features/classification/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"target": "es2015",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"include": ["**/*.ts"]
}
10 changes: 10 additions & 0 deletions libs/features/classification/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"clients-classification": { "tags": [] },
"http-server": { "tags": [] },
"http-client": { "tags": [] },
"assets": { "tags": [] }
"assets": { "tags": [] },
"features-classification": { "tags": [] }
}
}
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@assets": ["libs/assets/src/index.ts"]
"@assets": ["libs/assets/src/index.ts"],
"@features/classification": ["libs/features/classification/src/index.ts"]
}
},
"exclude": ["node_modules", "tmp"]
Expand Down

0 comments on commit e84875a

Please sign in to comment.