Skip to content

Commit

Permalink
Merge pull request #20 from FelipeDuarteLuna/22-01-24
Browse files Browse the repository at this point in the history
feat(auth-form): add lib
  • Loading branch information
FelipeDuarteLuna authored Jan 28, 2024
2 parents 5ebc2ed + 974bbd7 commit 14a24b1
Show file tree
Hide file tree
Showing 16 changed files with 209 additions and 0 deletions.
36 changes: 36 additions & 0 deletions modules/feature/auth/form/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"extends": ["../../../../.eslintrc.base.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "lib",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "lib",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions modules/feature/auth/form/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# auth-form

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

## Running unit tests

Run `nx test auth-form` to execute the unit tests.
22 changes: 22 additions & 0 deletions modules/feature/auth/form/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'auth-form',
preset: '../../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../../../coverage/modules/feature/auth/form',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
27 changes: 27 additions & 0 deletions modules/feature/auth/form/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "auth-form",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "modules/feature/auth/form/src",
"prefix": "lib",
"tags": ["type:feature"],
"projectType": "library",
"targets": {
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "modules/feature/auth/form/jest.config.ts"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"modules/feature/auth/form/**/*.ts",
"modules/feature/auth/form/**/*.html"
]
}
}
}
}
3 changes: 3 additions & 0 deletions modules/feature/auth/form/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './lib/lib.routes';

export * from './lib/auth-form/auth-form.component';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>auth-form works!</p>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AuthFormComponent } from './auth-form.component';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AuthFormComponent],
}).compileComponents();

fixture = TestBed.createComponent(AuthFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
11 changes: 11 additions & 0 deletions modules/feature/auth/form/src/lib/auth-form/auth-form.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';

@Component({
selector: 'lib-auth-form',
standalone: true,
imports: [CommonModule],
templateUrl: './auth-form.component.html',
styleUrl: './auth-form.component.scss',
})
export class AuthFormComponent {}
6 changes: 6 additions & 0 deletions modules/feature/auth/form/src/lib/lib.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Route } from '@angular/router';
import { AuthFormComponent } from './auth-form/auth-form.component';

export const authFormRoutes: Route[] = [
{ path: '', component: AuthFormComponent },
];
8 changes: 8 additions & 0 deletions modules/feature/auth/form/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};
import 'jest-preset-angular/setup-jest';
29 changes: 29 additions & 0 deletions modules/feature/auth/form/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "es2022",
"useDefineForClassFields": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../../../../tsconfig.base.json",
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
17 changes: 17 additions & 0 deletions modules/feature/auth/form/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"exclude": [
"src/**/*.spec.ts",
"src/test-setup.ts",
"jest.config.ts",
"src/**/*.test.ts"
],
"include": ["src/**/*.ts"]
}
16 changes: 16 additions & 0 deletions modules/feature/auth/form/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"module": "commonjs",
"target": "es2016",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
4 changes: 4 additions & 0 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ export const appRoutes: Route[] = [
loadChildren: () =>
import('product-detail').then((m) => m.productDetailRoutes),
},
{
path: 'auth',
loadComponent: () => import('auth-form').then((m) => m.AuthFormComponent),
},
];
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"auth-form": ["modules/feature/auth/form/src/index.ts"],
"home": ["modules/feature/home/src/index.ts"],
"modules/layout": ["modules/feature/src/index.ts"],
"product-data-access": ["modules/data-access/product/src/index.ts"],
Expand Down

0 comments on commit 14a24b1

Please sign in to comment.