mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 04:43:03 -05:00
feat(challengestandalone): challenge standalone
This commit is contained in:
36
apps/module-to-standalone/.eslintrc.json
Normal file
36
apps/module-to-standalone/.eslintrc.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"extends": ["../../.eslintrc.json"],
|
||||
"ignorePatterns": ["!**/*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts"],
|
||||
"rules": {
|
||||
"@angular-eslint/directive-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "attribute",
|
||||
"prefix": "app",
|
||||
"style": "camelCase"
|
||||
}
|
||||
],
|
||||
"@angular-eslint/component-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "element",
|
||||
"prefix": "app",
|
||||
"style": "kebab-case"
|
||||
}
|
||||
]
|
||||
},
|
||||
"extends": [
|
||||
"plugin:@nx/angular",
|
||||
"plugin:@angular-eslint/template/process-inline-templates"
|
||||
]
|
||||
},
|
||||
{
|
||||
"files": ["*.html"],
|
||||
"extends": ["plugin:@nx/angular-template"],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
32
apps/module-to-standalone/README.md
Normal file
32
apps/module-to-standalone/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
<h1>refactor module to standalone</h1>
|
||||
|
||||
> Author: Thomas Laforge
|
||||
|
||||
<!-- TODO: add Information/Statement/Rules/Constraint/Steps -->
|
||||
|
||||
### Information
|
||||
|
||||
### Statement
|
||||
|
||||
### Step 1
|
||||
|
||||
### Step 2
|
||||
|
||||
### Constraints:
|
||||
|
||||
### Submitting your work
|
||||
|
||||
1. Fork the project
|
||||
2. clone it
|
||||
3. npm install
|
||||
4. `npx nx serve module-to-standalone`
|
||||
5. _...work on it_
|
||||
6. Commit your work
|
||||
7. Submit a PR with a title beginning with **Answer:26** that I will review and other dev can review.
|
||||
|
||||
<a href="https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A26+label%3Aanswer"><img src="https://img.shields.io/badge/-Solutions-green" alt="module-to-standalone"/></a>
|
||||
<a href='https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A26+label%3A"answer+author"'><img src="https://img.shields.io/badge/-Author solution-important" alt="module-to-standalone solution author"/></a>
|
||||
|
||||
<!-- <a href="{Blog post url}" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/-Blog post explanation-blue" alt="module-to-standalone blog article"/></a> -->
|
||||
|
||||
_You can ask any question on_ <a href="https://twitter.com/laforge_toma" target="_blank" rel="noopener noreferrer"><img src="./../../logo/twitter.svg" height=20px alt="twitter"/></a>
|
||||
81
apps/module-to-standalone/project.json
Normal file
81
apps/module-to-standalone/project.json
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "module-to-standalone",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"projectType": "application",
|
||||
"prefix": "app",
|
||||
"sourceRoot": "apps/module-to-standalone/src",
|
||||
"tags": [],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@angular-devkit/build-angular:browser",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/apps/module-to-standalone",
|
||||
"index": "apps/module-to-standalone/src/index.html",
|
||||
"main": "apps/module-to-standalone/src/main.ts",
|
||||
"polyfills": ["zone.js"],
|
||||
"tsConfig": "apps/module-to-standalone/tsconfig.app.json",
|
||||
"assets": [
|
||||
"apps/module-to-standalone/src/favicon.ico",
|
||||
"apps/module-to-standalone/src/assets"
|
||||
],
|
||||
"styles": ["apps/module-to-standalone/src/styles.scss"],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "500kb",
|
||||
"maximumError": "1mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"executor": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "module-to-standalone:build:production"
|
||||
},
|
||||
"development": {
|
||||
"browserTarget": "module-to-standalone:build:development"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"executor": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "module-to-standalone:build"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nx/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": [
|
||||
"apps/module-to-standalone/**/*.ts",
|
||||
"apps/module-to-standalone/**/*.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
apps/module-to-standalone/src/app/app.component.ts
Normal file
27
apps/module-to-standalone/src/app/app.component.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
template: ` <div class="flex gap-2">
|
||||
<button
|
||||
routerLink="home"
|
||||
class="border px-4 py-2 border-blue-400 rounded-md">
|
||||
Home
|
||||
</button>
|
||||
<button
|
||||
routerLink="admin"
|
||||
class="border px-4 py-2 border-blue-400 rounded-md">
|
||||
Admin
|
||||
</button>
|
||||
<button
|
||||
routerLink="user"
|
||||
class="border px-4 py-2 border-blue-400 rounded-md">
|
||||
User
|
||||
</button>
|
||||
</div>
|
||||
<router-outlet></router-outlet>`,
|
||||
host: {
|
||||
class: 'flex flex-col p-4 gap-3',
|
||||
},
|
||||
})
|
||||
export class AppComponent {}
|
||||
11
apps/module-to-standalone/src/app/app.module.ts
Normal file
11
apps/module-to-standalone/src/app/app.module.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { MainShellModule } from '@angular-challenges/module-to-standalone/shell';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
imports: [BrowserModule, MainShellModule],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
export class AppModule {}
|
||||
0
apps/module-to-standalone/src/assets/.gitkeep
Normal file
0
apps/module-to-standalone/src/assets/.gitkeep
Normal file
BIN
apps/module-to-standalone/src/favicon.ico
Normal file
BIN
apps/module-to-standalone/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
13
apps/module-to-standalone/src/index.html
Normal file
13
apps/module-to-standalone/src/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>module-to-standalone</title>
|
||||
<base href="/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
6
apps/module-to-standalone/src/main.ts
Normal file
6
apps/module-to-standalone/src/main.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { AppModule } from './app/app.module';
|
||||
|
||||
platformBrowserDynamic()
|
||||
.bootstrapModule(AppModule)
|
||||
.catch((err) => console.error(err));
|
||||
5
apps/module-to-standalone/src/styles.scss
Normal file
5
apps/module-to-standalone/src/styles.scss
Normal file
@@ -0,0 +1,5 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
14
apps/module-to-standalone/tailwind.config.js
Normal file
14
apps/module-to-standalone/tailwind.config.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind');
|
||||
const { join } = require('path');
|
||||
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [
|
||||
'apps/module-to-standalone/**/*.{ts,html}',
|
||||
'libs/module-to-standalone/**/*.{ts,html}',
|
||||
],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
};
|
||||
10
apps/module-to-standalone/tsconfig.app.json
Normal file
10
apps/module-to-standalone/tsconfig.app.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"types": []
|
||||
},
|
||||
"files": ["src/main.ts"],
|
||||
"include": ["src/**/*.d.ts"],
|
||||
"exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
|
||||
}
|
||||
11
apps/module-to-standalone/tsconfig.editor.json
Normal file
11
apps/module-to-standalone/tsconfig.editor.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"../../libs/module-to-standalone/shell/src/lib/main-shell.routes.ts",
|
||||
"../../libs/module-to-standalone/shell/src/lib/main-shell.component.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
}
|
||||
}
|
||||
29
apps/module-to-standalone/tsconfig.json
Normal file
29
apps/module-to-standalone/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.app.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.editor.json"
|
||||
}
|
||||
],
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"projectType": "application",
|
||||
"sourceRoot": "apps/projection/src",
|
||||
"prefix": "angular-challenges",
|
||||
"prefix": "app",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@angular-devkit/build-angular:browser",
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Component } from '@angular/core';
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [],
|
||||
selector: 'app-root',
|
||||
selector: 'lib-root',
|
||||
template: ``,
|
||||
styles: [''],
|
||||
})
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
7. Submit a PR with a title beginning with **Answer:<%= challengeNumber %>** that I will review and other dev can review.
|
||||
|
||||
<a href="https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A<%= challengeNumber %>+label%3Aanswer"><img src="https://img.shields.io/badge/-Solutions-green" alt="<%= projectName %>"/></a>
|
||||
|
||||
<a href='https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A<%= challengeNumber %>+label%3A"answer+author"'><img src="https://img.shields.io/badge/-Author solution-important" alt="<%= projectName %> solution author"/></a>
|
||||
|
||||
<!-- <a href="{Blog post url}" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/-Blog post explanation-blue" alt="<%= projectName %> blog article"/></a> -->
|
||||
|
||||
36
libs/module-to-standalone/admin/feature/.eslintrc.json
Normal file
36
libs/module-to-standalone/admin/feature/.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/admin/feature/README.md
Normal file
7
libs/module-to-standalone/admin/feature/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# module-to-standalone-admin-feature
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test module-to-standalone-admin-feature` to execute the unit tests.
|
||||
23
libs/module-to-standalone/admin/feature/jest.config.ts
Normal file
23
libs/module-to-standalone/admin/feature/jest.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'module-to-standalone-admin-feature',
|
||||
preset: '../../../../jest.preset.js',
|
||||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
||||
coverageDirectory:
|
||||
'../../../../coverage/libs/module-to-standalone/admin/feature',
|
||||
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',
|
||||
],
|
||||
};
|
||||
34
libs/module-to-standalone/admin/feature/project.json
Normal file
34
libs/module-to-standalone/admin/feature/project.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "module-to-standalone-admin-feature",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/module-to-standalone/admin/feature/src",
|
||||
"prefix": "lib",
|
||||
"tags": [],
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/module-to-standalone/admin/feature/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/admin/feature/**/*.ts",
|
||||
"libs/module-to-standalone/admin/feature/**/*.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
libs/module-to-standalone/admin/feature/src/index.ts
Normal file
1
libs/module-to-standalone/admin/feature/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/admin-feature.module';
|
||||
@@ -0,0 +1,34 @@
|
||||
import { IsAuthorizedGuard } from '@angular-challenges/module-to-standalone/admin/shared';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@NgModule({
|
||||
declarations: [],
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: '',
|
||||
canActivate: [IsAuthorizedGuard],
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () =>
|
||||
import('./dashboard/dashboard.component').then(
|
||||
(m) => m.DashboardModule
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'create-user',
|
||||
loadChildren: () =>
|
||||
import('./create-user/create-user.component').then(
|
||||
(m) => m.CreateUserModule
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class AdminFeatureModule {}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'lib-create-user',
|
||||
template: `Create User Form
|
||||
|
||||
<button
|
||||
routerLink=".."
|
||||
class="border bg-gray-700 rounded-lg p-2 text-white ml-5">
|
||||
Back
|
||||
</button> `,
|
||||
})
|
||||
export class CreateUserComponent {}
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([{ path: '', component: CreateUserComponent }]),
|
||||
],
|
||||
declarations: [CreateUserComponent],
|
||||
})
|
||||
export class CreateUserModule {}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'lib-dashboard',
|
||||
template: `Dashboard
|
||||
|
||||
<button
|
||||
routerLink="create-user"
|
||||
class="border bg-gray-700 rounded-lg p-2 text-white ml-10">
|
||||
Create User
|
||||
</button> `,
|
||||
})
|
||||
export class DashboardComponent {}
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([{ path: '', component: DashboardComponent }]),
|
||||
],
|
||||
declarations: [DashboardComponent],
|
||||
})
|
||||
export class DashboardModule {}
|
||||
@@ -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/admin/feature/tsconfig.json
Normal file
29
libs/module-to-standalone/admin/feature/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/admin/feature/tsconfig.lib.json
Normal file
17
libs/module-to-standalone/admin/feature/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"]
|
||||
}
|
||||
16
libs/module-to-standalone/admin/feature/tsconfig.spec.json
Normal file
16
libs/module-to-standalone/admin/feature/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"
|
||||
]
|
||||
}
|
||||
36
libs/module-to-standalone/admin/shared/.eslintrc.json
Normal file
36
libs/module-to-standalone/admin/shared/.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/admin/shared/README.md
Normal file
7
libs/module-to-standalone/admin/shared/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# module-to-standalone-admin-shared
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test module-to-standalone-admin-shared` to execute the unit tests.
|
||||
23
libs/module-to-standalone/admin/shared/jest.config.ts
Normal file
23
libs/module-to-standalone/admin/shared/jest.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'module-to-standalone-admin-shared',
|
||||
preset: '../../../../jest.preset.js',
|
||||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
||||
coverageDirectory:
|
||||
'../../../../coverage/libs/module-to-standalone/admin/shared',
|
||||
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',
|
||||
],
|
||||
};
|
||||
34
libs/module-to-standalone/admin/shared/project.json
Normal file
34
libs/module-to-standalone/admin/shared/project.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "module-to-standalone-admin-shared",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/module-to-standalone/admin/shared/src",
|
||||
"prefix": "lib",
|
||||
"tags": [],
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/module-to-standalone/admin/shared/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/admin/shared/**/*.ts",
|
||||
"libs/module-to-standalone/admin/shared/**/*.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
libs/module-to-standalone/admin/shared/src/index.ts
Normal file
1
libs/module-to-standalone/admin/shared/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/authorized.guard';
|
||||
@@ -0,0 +1,23 @@
|
||||
import { CanActivate, Router, UrlTree } from '@angular/router';
|
||||
|
||||
import { AuthorizationService } from '@angular-challenges/module-to-standalone/core/service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, map } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class IsAuthorizedGuard implements CanActivate {
|
||||
constructor(
|
||||
private authorizationService: AuthorizationService,
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
canActivate(): Observable<boolean | UrlTree> {
|
||||
return this.authorizationService.isAuthorized$.pipe(
|
||||
map((isAuthorized) =>
|
||||
isAuthorized ? true : this.router.createUrlTree(['forbidden'])
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
8
libs/module-to-standalone/admin/shared/src/test-setup.ts
Normal file
8
libs/module-to-standalone/admin/shared/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/admin/shared/tsconfig.json
Normal file
29
libs/module-to-standalone/admin/shared/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/admin/shared/tsconfig.lib.json
Normal file
17
libs/module-to-standalone/admin/shared/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"]
|
||||
}
|
||||
16
libs/module-to-standalone/admin/shared/tsconfig.spec.json
Normal file
16
libs/module-to-standalone/admin/shared/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"
|
||||
]
|
||||
}
|
||||
36
libs/module-to-standalone/core/providers/.eslintrc.json
Normal file
36
libs/module-to-standalone/core/providers/.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/core/providers/README.md
Normal file
7
libs/module-to-standalone/core/providers/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# module-to-standalone-core-providers
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test module-to-standalone-core-providers` to execute the unit tests.
|
||||
23
libs/module-to-standalone/core/providers/jest.config.ts
Normal file
23
libs/module-to-standalone/core/providers/jest.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'module-to-standalone-core-providers',
|
||||
preset: '../../../../jest.preset.js',
|
||||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
||||
coverageDirectory:
|
||||
'../../../../coverage/libs/module-to-standalone/core/providers',
|
||||
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/core/providers/ng-package.json
Normal file
7
libs/module-to-standalone/core/providers/ng-package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../../../dist/libs/module-to-standalone/core/providers",
|
||||
"lib": {
|
||||
"entryFile": "src/index.ts"
|
||||
}
|
||||
}
|
||||
12
libs/module-to-standalone/core/providers/package.json
Normal file
12
libs/module-to-standalone/core/providers/package.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@angular-challenges/module-to-standalone/core/providers",
|
||||
"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/core/providers/project.json
Normal file
50
libs/module-to-standalone/core/providers/project.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "module-to-standalone-core-providers",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/module-to-standalone/core/providers/src",
|
||||
"prefix": "lib",
|
||||
"tags": [],
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/angular:ng-packagr-lite",
|
||||
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
|
||||
"options": {
|
||||
"project": "libs/module-to-standalone/core/providers/ng-package.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"tsConfig": "libs/module-to-standalone/core/providers/tsconfig.lib.prod.json"
|
||||
},
|
||||
"development": {
|
||||
"tsConfig": "libs/module-to-standalone/core/providers/tsconfig.lib.json"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/module-to-standalone/core/providers/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/core/providers/**/*.ts",
|
||||
"libs/module-to-standalone/core/providers/**/*.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
libs/module-to-standalone/core/providers/src/index.ts
Normal file
1
libs/module-to-standalone/core/providers/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/token.provider';
|
||||
@@ -0,0 +1,16 @@
|
||||
import {
|
||||
EnvironmentProviders,
|
||||
InjectionToken,
|
||||
makeEnvironmentProviders,
|
||||
} from '@angular/core';
|
||||
|
||||
export const TOKEN = new InjectionToken<string[]>('token');
|
||||
|
||||
export const provideToken = (token: string): EnvironmentProviders => {
|
||||
return makeEnvironmentProviders([
|
||||
{
|
||||
provide: TOKEN,
|
||||
useValue: token,
|
||||
},
|
||||
]);
|
||||
};
|
||||
@@ -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/core/providers/tsconfig.json
Normal file
29
libs/module-to-standalone/core/providers/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/core/providers/tsconfig.lib.json
Normal file
17
libs/module-to-standalone/core/providers/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/core/providers/tsconfig.spec.json
Normal file
16
libs/module-to-standalone/core/providers/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"
|
||||
]
|
||||
}
|
||||
36
libs/module-to-standalone/core/service/.eslintrc.json
Normal file
36
libs/module-to-standalone/core/service/.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/core/service/README.md
Normal file
7
libs/module-to-standalone/core/service/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# module-to-standalone-core-service
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test module-to-standalone-core-service` to execute the unit tests.
|
||||
23
libs/module-to-standalone/core/service/jest.config.ts
Normal file
23
libs/module-to-standalone/core/service/jest.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'module-to-standalone-core-service',
|
||||
preset: '../../../../jest.preset.js',
|
||||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
||||
coverageDirectory:
|
||||
'../../../../coverage/libs/module-to-standalone/core/service',
|
||||
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',
|
||||
],
|
||||
};
|
||||
34
libs/module-to-standalone/core/service/project.json
Normal file
34
libs/module-to-standalone/core/service/project.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "module-to-standalone-core-service",
|
||||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/module-to-standalone/core/service/src",
|
||||
"prefix": "lib",
|
||||
"tags": [],
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/module-to-standalone/core/service/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/core/service/**/*.ts",
|
||||
"libs/module-to-standalone/core/service/**/*.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
libs/module-to-standalone/core/service/src/index.ts
Normal file
1
libs/module-to-standalone/core/service/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/authorization.service';
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AuthorizationService {
|
||||
private isAuthorized = new BehaviorSubject<boolean>(true);
|
||||
isAuthorized$ = this.isAuthorized.asObservable();
|
||||
|
||||
authorize() {
|
||||
this.isAuthorized.next(true);
|
||||
}
|
||||
|
||||
forbid() {
|
||||
this.isAuthorized.next(false);
|
||||
}
|
||||
}
|
||||
8
libs/module-to-standalone/core/service/src/test-setup.ts
Normal file
8
libs/module-to-standalone/core/service/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/core/service/tsconfig.json
Normal file
29
libs/module-to-standalone/core/service/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/core/service/tsconfig.lib.json
Normal file
17
libs/module-to-standalone/core/service/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"]
|
||||
}
|
||||
16
libs/module-to-standalone/core/service/tsconfig.spec.json
Normal file
16
libs/module-to-standalone/core/service/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"
|
||||
]
|
||||
}
|
||||
36
libs/module-to-standalone/forbidden/.eslintrc.json
Normal file
36
libs/module-to-standalone/forbidden/.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/forbidden/README.md
Normal file
7
libs/module-to-standalone/forbidden/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# module-to-standalone-forbidden
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test module-to-standalone-forbidden` to execute the unit tests.
|
||||
22
libs/module-to-standalone/forbidden/jest.config.ts
Normal file
22
libs/module-to-standalone/forbidden/jest.config.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'module-to-standalone-forbidden',
|
||||
preset: '../../../jest.preset.js',
|
||||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
||||
coverageDirectory: '../../../coverage/libs/module-to-standalone/forbidden',
|
||||
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',
|
||||
],
|
||||
};
|
||||
34
libs/module-to-standalone/forbidden/project.json
Normal file
34
libs/module-to-standalone/forbidden/project.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "module-to-standalone-forbidden",
|
||||
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/module-to-standalone/forbidden/src",
|
||||
"prefix": "lib",
|
||||
"tags": [],
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/module-to-standalone/forbidden/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/forbidden/**/*.ts",
|
||||
"libs/module-to-standalone/forbidden/**/*.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
libs/module-to-standalone/forbidden/src/index.ts
Normal file
1
libs/module-to-standalone/forbidden/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/forbidden.module';
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'lib-home',
|
||||
template: `Forbidden component`,
|
||||
})
|
||||
export class ForbiddenComponent {}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { ForbiddenComponent } from './forbidden.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [ForbiddenComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild([{ path: '', component: ForbiddenComponent }]),
|
||||
],
|
||||
})
|
||||
export class ForbiddenModule {}
|
||||
8
libs/module-to-standalone/forbidden/src/test-setup.ts
Normal file
8
libs/module-to-standalone/forbidden/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/forbidden/tsconfig.json
Normal file
29
libs/module-to-standalone/forbidden/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/forbidden/tsconfig.lib.json
Normal file
17
libs/module-to-standalone/forbidden/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"]
|
||||
}
|
||||
16
libs/module-to-standalone/forbidden/tsconfig.spec.json
Normal file
16
libs/module-to-standalone/forbidden/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"
|
||||
]
|
||||
}
|
||||
36
libs/module-to-standalone/home/.eslintrc.json
Normal file
36
libs/module-to-standalone/home/.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/home/README.md
Normal file
7
libs/module-to-standalone/home/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# module-to-standalone-home
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test module-to-standalone-home` to execute the unit tests.
|
||||
22
libs/module-to-standalone/home/jest.config.ts
Normal file
22
libs/module-to-standalone/home/jest.config.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'module-to-standalone-home',
|
||||
preset: '../../../jest.preset.js',
|
||||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
||||
coverageDirectory: '../../../coverage/libs/module-to-standalone/home',
|
||||
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',
|
||||
],
|
||||
};
|
||||
34
libs/module-to-standalone/home/project.json
Normal file
34
libs/module-to-standalone/home/project.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "module-to-standalone-home",
|
||||
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/module-to-standalone/home/src",
|
||||
"prefix": "lib",
|
||||
"tags": [],
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/module-to-standalone/home/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/home/**/*.ts",
|
||||
"libs/module-to-standalone/home/**/*.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
libs/module-to-standalone/home/src/index.ts
Normal file
1
libs/module-to-standalone/home/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/home.module';
|
||||
27
libs/module-to-standalone/home/src/lib/home.component.ts
Normal file
27
libs/module-to-standalone/home/src/lib/home.component.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { TOKEN } from '@angular-challenges/module-to-standalone/core/providers';
|
||||
import { AuthorizationService } from '@angular-challenges/module-to-standalone/core/service';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'lib-home',
|
||||
template: `Home component
|
||||
|
||||
<section class="flex gap-5 items-center">
|
||||
Authorization :
|
||||
<button class="border p-2 " (click)="authorizeService.authorize()">
|
||||
Authorize
|
||||
</button>
|
||||
<button class="border p-2 " (click)="authorizeService.forbid()">
|
||||
Forbid
|
||||
</button>
|
||||
(isAuthorized: {{ authorizeService.isAuthorized$ | async }})
|
||||
</section>
|
||||
|
||||
<section>LoadedToken {{ token }}</section> `,
|
||||
})
|
||||
export class HomeComponent {
|
||||
constructor(
|
||||
public authorizeService: AuthorizationService,
|
||||
@Inject(TOKEN) public token: string
|
||||
) {}
|
||||
}
|
||||
13
libs/module-to-standalone/home/src/lib/home.module.ts
Normal file
13
libs/module-to-standalone/home/src/lib/home.module.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { HomeComponent } from './home.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [HomeComponent],
|
||||
imports: [
|
||||
RouterModule.forChild([{ path: '', component: HomeComponent }]),
|
||||
CommonModule,
|
||||
],
|
||||
})
|
||||
export class ModuleToStandaloneHomeModule {}
|
||||
8
libs/module-to-standalone/home/src/test-setup.ts
Normal file
8
libs/module-to-standalone/home/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/home/tsconfig.json
Normal file
29
libs/module-to-standalone/home/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/home/tsconfig.lib.json
Normal file
17
libs/module-to-standalone/home/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"]
|
||||
}
|
||||
16
libs/module-to-standalone/home/tsconfig.spec.json
Normal file
16
libs/module-to-standalone/home/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"
|
||||
]
|
||||
}
|
||||
36
libs/module-to-standalone/shell/.eslintrc.json
Normal file
36
libs/module-to-standalone/shell/.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/shell/README.md
Normal file
7
libs/module-to-standalone/shell/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# module-to-standalone-shell
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test module-to-standalone-shell` to execute the unit tests.
|
||||
22
libs/module-to-standalone/shell/jest.config.ts
Normal file
22
libs/module-to-standalone/shell/jest.config.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'module-to-standalone-shell',
|
||||
preset: '../../../jest.preset.js',
|
||||
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
||||
coverageDirectory: '../../../coverage/libs/module-to-standalone/shell',
|
||||
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',
|
||||
],
|
||||
};
|
||||
34
libs/module-to-standalone/shell/project.json
Normal file
34
libs/module-to-standalone/shell/project.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "module-to-standalone-shell",
|
||||
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/module-to-standalone/shell/src",
|
||||
"prefix": "lib",
|
||||
"tags": [],
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"test": {
|
||||
"executor": "@nx/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "libs/module-to-standalone/shell/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/shell/**/*.ts",
|
||||
"libs/module-to-standalone/shell/**/*.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
libs/module-to-standalone/shell/src/index.ts
Normal file
1
libs/module-to-standalone/shell/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/main-shell.module';
|
||||
11
libs/module-to-standalone/shell/src/lib/main-shell.module.ts
Normal file
11
libs/module-to-standalone/shell/src/lib/main-shell.module.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { provideToken } from '@angular-challenges/module-to-standalone/core/providers';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { appRoutes } from './main-shell.routes';
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(appRoutes)],
|
||||
exports: [RouterModule],
|
||||
providers: [provideToken('main-shell-token')],
|
||||
})
|
||||
export class MainShellModule {}
|
||||
34
libs/module-to-standalone/shell/src/lib/main-shell.routes.ts
Normal file
34
libs/module-to-standalone/shell/src/lib/main-shell.routes.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Route } from '@angular/router';
|
||||
|
||||
export const appRoutes: Route[] = [
|
||||
{ path: '', redirectTo: 'home', pathMatch: 'full' },
|
||||
{
|
||||
path: 'home',
|
||||
loadChildren: () =>
|
||||
import('@angular-challenges/module-to-standalone/home').then(
|
||||
(m) => m.ModuleToStandaloneHomeModule
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'admin',
|
||||
loadChildren: () =>
|
||||
import('@angular-challenges/module-to-standalone/admin/feature').then(
|
||||
(m) => m.AdminFeatureModule
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'user',
|
||||
loadChildren: () =>
|
||||
import('@angular-challenges/module-to-standalone/user/shell').then(
|
||||
(m) => m.UserShellModule
|
||||
),
|
||||
},
|
||||
|
||||
{
|
||||
path: 'forbidden',
|
||||
loadChildren: () =>
|
||||
import('@angular-challenges/module-to-standalone/forbidden').then(
|
||||
(m) => m.ForbiddenModule
|
||||
),
|
||||
},
|
||||
];
|
||||
8
libs/module-to-standalone/shell/src/test-setup.ts
Normal file
8
libs/module-to-standalone/shell/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/shell/tsconfig.json
Normal file
29
libs/module-to-standalone/shell/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/shell/tsconfig.lib.json
Normal file
17
libs/module-to-standalone/shell/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"]
|
||||
}
|
||||
16
libs/module-to-standalone/shell/tsconfig.spec.json
Normal file
16
libs/module-to-standalone/shell/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"
|
||||
]
|
||||
}
|
||||
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
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user