mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 12:53:03 -05:00
feat(challengestandalone): challenge standalone
This commit is contained in:
36
libs/module-to-standalone/user/contact/.eslintrc.json
Normal file
36
libs/module-to-standalone/user/contact/.eslintrc.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"extends": ["../../../../.eslintrc.json"],
|
||||
"ignorePatterns": ["!**/*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts"],
|
||||
"rules": {
|
||||
"@angular-eslint/directive-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "attribute",
|
||||
"prefix": "lib",
|
||||
"style": "camelCase"
|
||||
}
|
||||
],
|
||||
"@angular-eslint/component-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "element",
|
||||
"prefix": "lib",
|
||||
"style": "kebab-case"
|
||||
}
|
||||
]
|
||||
},
|
||||
"extends": [
|
||||
"plugin:@nx/angular",
|
||||
"plugin:@angular-eslint/template/process-inline-templates"
|
||||
]
|
||||
},
|
||||
{
|
||||
"files": ["*.html"],
|
||||
"extends": ["plugin:@nx/angular-template"],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
7
libs/module-to-standalone/user/contact/README.md
Normal file
7
libs/module-to-standalone/user/contact/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# module-to-standalone-user-contact
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test module-to-standalone-user-contact` to execute the unit tests.
|
||||
23
libs/module-to-standalone/user/contact/jest.config.ts
Normal file
23
libs/module-to-standalone/user/contact/jest.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'module-to-standalone-user-contact',
|
||||
preset: '../../../../jest.preset.js',
|
||||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
||||
coverageDirectory:
|
||||
'../../../../coverage/libs/module-to-standalone/user/contact',
|
||||
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',
|
||||
],
|
||||
};
|
||||
7
libs/module-to-standalone/user/contact/ng-package.json
Normal file
7
libs/module-to-standalone/user/contact/ng-package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../../../dist/libs/module-to-standalone/user/contact",
|
||||
"lib": {
|
||||
"entryFile": "src/index.ts"
|
||||
}
|
||||
}
|
||||
12
libs/module-to-standalone/user/contact/package.json
Normal file
12
libs/module-to-standalone/user/contact/package.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@angular-challenges/module-to-standalone/user/contact",
|
||||
"version": "0.0.1",
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^16.0.0",
|
||||
"@angular/core": "^16.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"sideEffects": false
|
||||
}
|
||||
50
libs/module-to-standalone/user/contact/project.json
Normal file
50
libs/module-to-standalone/user/contact/project.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "module-to-standalone-user-contact",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/module-to-standalone/user/contact/src",
|
||||
"prefix": "lib",
|
||||
"tags": [],
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/angular:ng-packagr-lite",
|
||||
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
|
||||
"options": {
|
||||
"project": "libs/module-to-standalone/user/contact/ng-package.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"tsConfig": "libs/module-to-standalone/user/contact/tsconfig.lib.prod.json"
|
||||
},
|
||||
"development": {
|
||||
"tsConfig": "libs/module-to-standalone/user/contact/tsconfig.lib.json"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/module-to-standalone/user/contact/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
},
|
||||
"configurations": {
|
||||
"ci": {
|
||||
"ci": true,
|
||||
"codeCoverage": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": [
|
||||
"libs/module-to-standalone/user/contact/**/*.ts",
|
||||
"libs/module-to-standalone/user/contact/**/*.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
libs/module-to-standalone/user/contact/src/index.ts
Normal file
1
libs/module-to-standalone/user/contact/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/contact-feature.module';
|
||||
@@ -0,0 +1,27 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@NgModule({
|
||||
declarations: [],
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () =>
|
||||
import('./dashboard/dashboard.component').then(
|
||||
(m) => m.ContactDashboardModule
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'create-contact',
|
||||
loadChildren: () =>
|
||||
import('./create-contact/create-contact.component').then(
|
||||
(m) => m.CreateContactModule
|
||||
),
|
||||
},
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class ContactFeatureModule {}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'lib-create-contact',
|
||||
template: `Create Contact Form
|
||||
|
||||
<button
|
||||
routerLink=".."
|
||||
class="border bg-gray-700 rounded-lg p-2 text-white ml-5">
|
||||
Back
|
||||
</button> `,
|
||||
})
|
||||
export class CreateContactComponent {}
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([{ path: '', component: CreateContactComponent }]),
|
||||
],
|
||||
declarations: [CreateContactComponent],
|
||||
})
|
||||
export class CreateContactModule {}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'lib-contact-dashboard',
|
||||
template: `Contact Dashboard
|
||||
|
||||
<button
|
||||
routerLink="create-contact"
|
||||
class="border bg-gray-700 rounded-lg p-2 text-white ml-10">
|
||||
Create contact
|
||||
</button> `,
|
||||
})
|
||||
export class ContactDashboardComponent {}
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([{ path: '', component: ContactDashboardComponent }]),
|
||||
],
|
||||
declarations: [ContactDashboardComponent],
|
||||
})
|
||||
export class ContactDashboardModule {}
|
||||
8
libs/module-to-standalone/user/contact/src/test-setup.ts
Normal file
8
libs/module-to-standalone/user/contact/src/test-setup.ts
Normal file
@@ -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
libs/module-to-standalone/user/contact/tsconfig.json
Normal file
29
libs/module-to-standalone/user/contact/tsconfig.json
Normal file
@@ -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
libs/module-to-standalone/user/contact/tsconfig.lib.json
Normal file
17
libs/module-to-standalone/user/contact/tsconfig.lib.json
Normal file
@@ -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"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"declarationMap": false
|
||||
},
|
||||
"angularCompilerOptions": {}
|
||||
}
|
||||
16
libs/module-to-standalone/user/contact/tsconfig.spec.json
Normal file
16
libs/module-to-standalone/user/contact/tsconfig.spec.json
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user