Skip to content

Commit

Permalink
chore: migrate clans-roster
Browse files Browse the repository at this point in the history
  • Loading branch information
WorthyD committed Apr 23, 2024
1 parent 34fe82e commit 8fc3644
Show file tree
Hide file tree
Showing 65 changed files with 711 additions and 57 deletions.
2 changes: 1 addition & 1 deletion apps/destiny-clan-dashboard/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const appRoutes: Route[] = [
path: 'roster',
//loadChildren: () => import('./views/roster/roster.module').then((module) => module.RosterModule)

loadChildren: () => import('./features/clans-roster/clans-roster-shell/clans-roster.module').then((module) => module.ClansRosterModule)
loadChildren: () => import('@dcd/clans-roster/shell').then((module) => module.ClansRosterModule)
},
{
path: 'seals',
Expand Down

This file was deleted.

33 changes: 33 additions & 0 deletions libs/dcd/clans-roster/clans-roster-list/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": ["../../../../.eslintrc.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 libs/dcd/clans-roster/clans-roster-list/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# clans-roster-clans-roster-list

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

## Running unit tests

Run `nx test clans-roster-clans-roster-list` to execute the unit tests.
22 changes: 22 additions & 0 deletions libs/dcd/clans-roster/clans-roster-list/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'clans-roster-clans-roster-list',
preset: '../../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../../../coverage/libs/dcd/clans-roster/clans-roster-list',
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'
]
};
20 changes: 20 additions & 0 deletions libs/dcd/clans-roster/clans-roster-list/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "clans-roster-clans-roster-list",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/dcd/clans-roster/clans-roster-list/src",
"prefix": "lib",
"tags": ["type:feature"],
"projectType": "library",
"targets": {
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/dcd/clans-roster/clans-roster-list/jest.config.ts"
}
},
"lint": {
"executor": "@nx/eslint:lint"
}
}
}
1 change: 1 addition & 0 deletions libs/dcd/clans-roster/clans-roster-list/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/clans-roster.module';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import { SorterMetadata } from '../data/sorter';

import { SorterMetadata } from '@destiny-clan-dashboard/shared/data';
import { ClanRosterItem } from '@features/clans-roster/models/ClanRosterItem';
import { ClanRosterItem } from '@dcd/clans-roster/models';
import { ClanMemberProfile } from '@shared/models/ClanMemberProfile';

// import { MockListItem } from './ListItems';
Expand Down Expand Up @@ -38,18 +38,15 @@ export const CLAN_ROSTER_SORTER_METADATA = new Map<string, SorterMetadata<ClanRo
'platform',
{
label: 'Platform',
comparator: (a, b) => (a.member?.destinyUserInfo?.membershipType < b.member?.destinyUserInfo?.membershipType ? -1 : 1)
comparator: (a, b) =>
a.member?.destinyUserInfo?.membershipType < b.member?.destinyUserInfo?.membershipType ? -1 : 1
}
],
[
'bungieUnique',
{
label: 'Bungie Unique Name',
comparator: (a, b) =>
a.bungieInfo?.uniqueName?.toLowerCase() <
b.bungieInfo?.uniqueName?.toLowerCase()
? -1
: 1
comparator: (a, b) => (a.bungieInfo?.uniqueName?.toLowerCase() < b.bungieInfo?.uniqueName?.toLowerCase() ? -1 : 1)
}
],
// ----
Expand All @@ -58,32 +55,23 @@ export const CLAN_ROSTER_SORTER_METADATA = new Map<string, SorterMetadata<ClanRo
{
label: 'PSN Name',
comparator: (a, b) =>
a.bungieInfo?.psnDisplayName?.toLowerCase() <
b.bungieInfo?.psnDisplayName?.toLowerCase()
? -1
: 1
a.bungieInfo?.psnDisplayName?.toLowerCase() < b.bungieInfo?.psnDisplayName?.toLowerCase() ? -1 : 1
}
],
[
'xboxDisplayName',
{
label: 'XBox Name',
comparator: (a, b) =>
a.bungieInfo?.xboxDisplayName?.toLowerCase() <
b.bungieInfo?.xboxDisplayName?.toLowerCase()
? -1
: 1
a.bungieInfo?.xboxDisplayName?.toLowerCase() < b.bungieInfo?.xboxDisplayName?.toLowerCase() ? -1 : 1
}
],
[
'steamDisplayName',
{
label: 'Steam Name',
comparator: (a, b) =>
a.bungieInfo?.steamDisplayName?.toLowerCase() <
b.bungieInfo?.steamDisplayName?.toLowerCase()
? -1
: 1
a.bungieInfo?.steamDisplayName?.toLowerCase() < b.bungieInfo?.steamDisplayName?.toLowerCase() ? -1 : 1
}
],

Expand All @@ -92,10 +80,7 @@ export const CLAN_ROSTER_SORTER_METADATA = new Map<string, SorterMetadata<ClanRo
{
label: 'Twitch Name',
comparator: (a, b) =>
a.bungieInfo?.twitchDisplayName?.toLowerCase() <
b.bungieInfo?.twitchDisplayName?.toLowerCase()
? -1
: 1
a.bungieInfo?.twitchDisplayName?.toLowerCase() < b.bungieInfo?.twitchDisplayName?.toLowerCase() ? -1 : 1
}
],

Expand Down Expand Up @@ -124,7 +109,9 @@ export const CLAN_ROSTER_SORTER_METADATA = new Map<string, SorterMetadata<ClanRo
{
label: 'Lifetime Guardian Rank',
comparator: (a, b) =>
a.profile?.profile?.data?.lifetimeHighestGuardianRank < b.profile?.profile?.data?.lifetimeHighestGuardianRank ? -1 : 1
a.profile?.profile?.data?.lifetimeHighestGuardianRank < b.profile?.profile?.data?.lifetimeHighestGuardianRank
? -1
: 1
}
],
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ViewerMetadata } from '@destiny-clan-dashboard/shared/data';

import { MemberTypeComponent } from '@destiny-clan-dashboard/components/icons';
import { ClassCellComponent } from '../../components/class-cell/class-cell.component';
import { ClassCellComponent } from '../../../../ui/src/lib/class-cell/class-cell.component';
import { MembershipTypes } from '@destiny-clan-dashboard/data/models';
import { ClanRosterItem } from '@features/clans-roster/models/ClanRosterItem';
import { ClanRosterItem } from '@dcd/clans-roster/models';
import { ProfileLinkComponent } from '@destiny-clan-dashboard/components/shared/profile-link';
import { BungieDatePipe, BungieDateTimePipe } from '@destiny-clan-dashboard/shared/pipes/bungie-date-pipe';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/
import { DataSource, Exporter, Filterer, Sorter, Viewer } from '@destiny-clan-dashboard/shared/data';
import { map, Observable, of, tap } from 'rxjs';

import { ClansRosterService } from '../data-access/clans-roster.service';
import { ClansRosterService } from '@dcd/clans-roster/data-access';
import { CLAN_ROSTER_VIEWER_METADATA } from './clan-roster-metadata';
import { CLAN_ROSTER_FILTERER_METADATA } from './clan-roster-metadata/ClanRosterFilterer';
import { CLAN_ROSTER_SORTER_METADATA } from './clan-roster-metadata/ClanRosterSorter';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ClansRosterComponent } from './clans-roster.component';
import { ClansRosterService } from '../data-access/clans-roster.service';
import { ClansRosterService } from '@dcd/clans-roster/data-access';
import { TableViewComponent } from '@destiny-clan-dashboard/components/shared/table-view';
import { PipesModule } from '@destiny-clan-dashboard/components/pipes';

import { ClassCellComponent, ClassIconPipe } from '../components/class-cell/class-cell.component';
import { ClassCellComponent, ClassIconPipe } from '@dcd/clans-roster/ui';
import { ClansRosterRoutingModule } from './clan-roster-routing.module.ts';
import { BungieDatePipe, BungieDateTimePipe } from '@destiny-clan-dashboard/shared/pipes/bungie-date-pipe';

@NgModule({
declarations: [ClansRosterComponent, ClassCellComponent, ClassIconPipe],
declarations: [ClansRosterComponent],
providers: [ClansRosterService, BungieDatePipe, BungieDateTimePipe],
exports: [ClansRosterComponent],
imports: [CommonModule, TableViewComponent, PipesModule, ClansRosterRoutingModule]
imports: [CommonModule, TableViewComponent, PipesModule, ClansRosterRoutingModule, ClassCellComponent, ClassIconPipe]
})
export class ClansRosterModule {}
8 changes: 8 additions & 0 deletions libs/dcd/clans-roster/clans-roster-list/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 libs/dcd/clans-roster/clans-roster-list/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
}
}
12 changes: 12 additions & 0 deletions libs/dcd/clans-roster/clans-roster-list/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"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"]
}
11 changes: 11 additions & 0 deletions libs/dcd/clans-roster/clans-roster-list/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"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"]
}
33 changes: 33 additions & 0 deletions libs/dcd/clans-roster/data-access/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": ["../../../../.eslintrc.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 libs/dcd/clans-roster/data-access/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# clans-roster-data-access

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

## Running unit tests

Run `nx test clans-roster-data-access` to execute the unit tests.
22 changes: 22 additions & 0 deletions libs/dcd/clans-roster/data-access/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'clans-roster-data-access',
preset: '../../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../../../coverage/libs/dcd/clans-roster/data-access',
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'
]
};
20 changes: 20 additions & 0 deletions libs/dcd/clans-roster/data-access/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "clans-roster-data-access",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/dcd/clans-roster/data-access/src",
"prefix": "lib",
"tags": ["type:data-access"],
"projectType": "library",
"targets": {
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/dcd/clans-roster/data-access/jest.config.ts"
}
},
"lint": {
"executor": "@nx/eslint:lint"
}
}
}
1 change: 1 addition & 0 deletions libs/dcd/clans-roster/data-access/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/clans-roster.service';
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { selectAllClansMembersProfiles, selectClanMemberProfileStateLoading } fr

import { ClanMemberProfile } from '@shared/models/ClanMemberProfile';
import { ClanBungieInfoService } from 'libs/data/src/lib/clan/bungie-info/bungie-info.service';
import { ClanRosterItem } from '../models/ClanRosterItem';
import { ClanRosterItem } from '@dcd/clans-roster/models';
import { BungieInfo } from '@destiny-clan-dashboard/data/models';

@Injectable()
Expand Down
Loading

0 comments on commit 8fc3644

Please sign in to comment.