diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 4db124c..0000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -**/dist -**/node_modules -**/documentation -**/prisma \ No newline at end of file diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 4212ddc..0000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,134 +0,0 @@ -root: true - -parser: '@typescript-eslint/parser' - -parserOptions: - project: ./tsconfig.json - sourceType: module - -plugins: - - '@typescript-eslint/eslint-plugin' - - prettier - - import - - jest - -extends: - - eslint:recommended - - plugin:@typescript-eslint/recommended - - plugin:prettier/recommended - - plugin:import/typescript - - plugin:jest/recommended - - plugin:jest/style - -env: - jest: true - node: true - -rules: - '@typescript-eslint/await-thenable': error - '@typescript-eslint/explicit-module-boundary-types': off - '@typescript-eslint/explicit-function-return-type': error - '@typescript-eslint/explicit-member-accessibility': off - '@typescript-eslint/indent': off - '@typescript-eslint/interface-name-prefix': off - '@typescript-eslint/member-delimiter-style': off - '@typescript-eslint/member-ordering': error - '@typescript-eslint/no-confusing-non-null-assertion': error - '@typescript-eslint/no-empty-interface': off - '@typescript-eslint/no-explicit-any': error - '@typescript-eslint/no-extra-non-null-assertion': error - '@typescript-eslint/no-floating-promises': - - error - - ignoreVoid: true - '@typescript-eslint/no-non-null-assertion': error - '@typescript-eslint/no-use-before-define': off - '@typescript-eslint/no-unused-vars': - - error - - argsIgnorePattern: '^_' - '@typescript-eslint/no-var-requires': off - '@typescript-eslint/switch-exhaustiveness-check': error - array-bracket-newline: - - error - - consistent - array-bracket-spacing: - - error - - never - array-callback-return: error - block-spacing: - - error - brace-style: error - camelcase: - - off - - properties: never - complexity: error - computed-property-spacing: - - error - - never - curly: - - error - - all - default-case: off - default-case-last: off - dot-location: - - error - - property - dot-notation: error - eqeqeq: error - eol-last: error - func-call-spacing: - - error - - never - func-style: error - import/no-unresolved: off - import/order: - - error - - newlines-between: always - groups: - - builtin - - external - - internal - - [parent, sibling, index] - alphabetize: - order: 'asc' - pathGroups: - - pattern: '@nestjs/**' - group: external - - pattern: '{@apps/**,@libs/**}' - group: internal - position: before - pathGroupsExcludedImportTypes: - - builtin - jest/no-conditional-expect: off - key-spacing: error - keyword-spacing: error - lines-between-class-members: error - newline-per-chained-call: off - no-console: - - error - - allow: - - warn - - error - no-dupe-keys: error - no-else-return: error - no-implicit-coercion: error - no-invalid-this: error - no-lonely-if: error - no-multi-spaces: error - no-return-await: error - no-trailing-spaces: error - no-useless-return: error - no-unneeded-ternary: error - prefer-arrow-callback: - - error - prefer-const: error - prettier/prettier: - - error - template-curly-spacing: - - error - - never - valid-typeof: error - jest/expect-expect: - - error - - assertFunctionNames: - - expect - - request.**.expect diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index dcb7279..0000000 --- a/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "singleQuote": true, - "trailingComma": "all" -} \ No newline at end of file diff --git a/.swcrc b/.swcrc index e72ce12..51cc5bd 100644 --- a/.swcrc +++ b/.swcrc @@ -1,19 +1,19 @@ { - "jsc": { - "parser": { - "syntax": "typescript", - "tsx": false, - "decorators": true - }, - "transform": { - "legacyDecorator": true, - "decoratorMetadata": true - }, - "target": "es2020", - "keepClassNames": true - }, - "module": { - "type": "commonjs", - "noInterop": false - } + "jsc": { + "parser": { + "syntax": "typescript", + "tsx": false, + "decorators": true + }, + "transform": { + "legacyDecorator": true, + "decoratorMetadata": true + }, + "target": "es2020", + "keepClassNames": true + }, + "module": { + "type": "commonjs", + "noInterop": false + } } diff --git a/.vscode/launch.json b/.vscode/launch.json index 3fb7433..dae945f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,70 +1,70 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "request": "launch", - "runtimeVersion": "14.17.0", - "name": "Launch hiking app", - "args": ["${workspaceFolder}/apps/hiking-app/src/main.ts"], - "runtimeArgs": [ - "--nolazy", - "-r", - "ts-node/register", - "-r", - "tsconfig-paths/register" - ], - "sourceMaps": true, - "cwd": "${workspaceRoot}/apps/hiking-app", - "protocol": "inspector", - "envFile": "${workspaceFolder}/.env" - }, - { - "type": "node", - "request": "launch", - "runtimeVersion": "14.17.0", - "name": "Launch projects app", - "args": ["${workspaceFolder}/apps/projects-app/src/main.ts"], - "runtimeArgs": [ - "--nolazy", - "-r", - "ts-node/register", - "-r", - "tsconfig-paths/register" - ], - "sourceMaps": true, - "cwd": "${workspaceRoot}/apps/projects-app", - "protocol": "inspector", - "envFile": "${workspaceFolder}/.env" - }, - { - "name": "Jest", - "type": "node", - "request": "launch", - "runtimeArgs": [ - "--inspect-brk", - "${workspaceRoot}/node_modules/.bin/jest", - "--runInBand" - ], - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen", - "port": 9229 - }, - { - "name": "Jest Current File", - "type": "node", - "request": "launch", - "program": "${workspaceFolder}/node_modules/.bin/jest", - "args": ["${fileBasenameNoExtension}", "--config", "jest.config.js"], - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen", - "disableOptimisticBPs": true, - "windows": { - "program": "${workspaceFolder}/node_modules/jest/bin/jest" - } - } - ] + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "runtimeVersion": "14.17.0", + "name": "Launch hiking app", + "args": ["${workspaceFolder}/apps/hiking-app/src/main.ts"], + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register", + "-r", + "tsconfig-paths/register" + ], + "sourceMaps": true, + "cwd": "${workspaceRoot}/apps/hiking-app", + "protocol": "inspector", + "envFile": "${workspaceFolder}/.env" + }, + { + "type": "node", + "request": "launch", + "runtimeVersion": "14.17.0", + "name": "Launch projects app", + "args": ["${workspaceFolder}/apps/projects-app/src/main.ts"], + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register", + "-r", + "tsconfig-paths/register" + ], + "sourceMaps": true, + "cwd": "${workspaceRoot}/apps/projects-app", + "protocol": "inspector", + "envFile": "${workspaceFolder}/.env" + }, + { + "name": "Jest", + "type": "node", + "request": "launch", + "runtimeArgs": [ + "--inspect-brk", + "${workspaceRoot}/node_modules/.bin/jest", + "--runInBand" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "port": 9229 + }, + { + "name": "Jest Current File", + "type": "node", + "request": "launch", + "program": "${workspaceFolder}/node_modules/.bin/jest", + "args": ["${fileBasenameNoExtension}", "--config", "jest.config.js"], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "disableOptimisticBPs": true, + "windows": { + "program": "${workspaceFolder}/node_modules/jest/bin/jest" + } + } + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index ac19436..ba8676d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,13 +1,26 @@ { - "[prisma]": { - "editor.defaultFormatter": "Prisma.prisma" - }, - "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode", - - "editor.codeActionsOnSave": { - "source.fixAll": "explicit" - }, - - "editor.tabSize": 2 + "biome.enabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports.biome": "explicit", + "source.fixAll.biome": "always" + }, + "editor.tabSize": 2, + "editor.defaultFormatter": "biomejs.biome", + "[prisma]": { + "editor.defaultFormatter": "Prisma.prisma" + }, + "[shellscript]": { + "editor.defaultFormatter": "foxundermoon.shell-format" + }, + "[dotenv]": { + "editor.defaultFormatter": "foxundermoon.shell-format" + }, + "[ignore]": { + "editor.defaultFormatter": "foxundermoon.shell-format" + }, + "[properties]": { + "editor.defaultFormatter": "foxundermoon.shell-format" + }, + "typescript.preferences.importModuleSpecifier": "relative" } diff --git a/README.md b/README.md index 5caccce..8055cc1 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Here is the POC of a monorepo built with nestjs and prisma used to expose severa -

                 

+

                

diff --git a/apps/hiking-app/src/main.ts b/apps/hiking-app/src/main.ts index 586ae49..037db7a 100644 --- a/apps/hiking-app/src/main.ts +++ b/apps/hiking-app/src/main.ts @@ -5,7 +5,7 @@ import { bootstrap } from '@libs/boostraper'; import { AppModule } from './modules/app.module'; import { externalDatabasesClients } from './modules/databases/external-databases-clients'; -void (async (): Promise => { +(async (): Promise => { const app = await bootstrap( AppModule, process.env.HIKING_APP_PORT || process.env.PORT || 5001, @@ -13,8 +13,8 @@ void (async (): Promise => { 'Everything related with hiking', ); - externalDatabasesClients.forEach(async (el) => { - const service = app.get(el as never); + for (const clients of externalDatabasesClients) { + const service = app.get(clients as never); await service.enableShutdownHooks(app); - }); + } })(); diff --git a/apps/hiking-app/src/modules/databases/repositories/hiking-repository.service.ts b/apps/hiking-app/src/modules/databases/repositories/hiking-repository.service.ts index 94c161a..e118b45 100644 --- a/apps/hiking-app/src/modules/databases/repositories/hiking-repository.service.ts +++ b/apps/hiking-app/src/modules/databases/repositories/hiking-repository.service.ts @@ -8,15 +8,14 @@ import { SessionSelectType, sessionsSelect } from '../selects/sessions.select'; @Injectable() export class HikingRepositoryService extends HikingDatabaseService { - getSessions = (): Observable> => + getSessions = (): Observable => from( this.hikingDB.session.findMany({ select: sessionsSelect, }), ); - getTrails = (): Observable> => - from(this.hikingDB.trail.findMany({})); + getTrails = (): Observable => from(this.hikingDB.trail.findMany({})); getTrailSessionBy = (id: number): Observable => from( diff --git a/apps/hiking-app/src/modules/databases/repositories/users-repository.service.ts b/apps/hiking-app/src/modules/databases/repositories/users-repository.service.ts index 753ee63..583788c 100644 --- a/apps/hiking-app/src/modules/databases/repositories/users-repository.service.ts +++ b/apps/hiking-app/src/modules/databases/repositories/users-repository.service.ts @@ -6,5 +6,5 @@ import { UsersDatabaseService } from '@libs/databases'; @Injectable() export class UsersRepositoryService extends UsersDatabaseService { - getAll = (): Observable> => from(this.usersDB.user.findMany()); + getAll = (): Observable => from(this.usersDB.user.findMany()); } diff --git a/apps/hiking-app/src/modules/trails-sessions/dto/trail-session.response.dto.ts b/apps/hiking-app/src/modules/trails-sessions/dto/trail-session.response.dto.ts index 90dd478..6888130 100644 --- a/apps/hiking-app/src/modules/trails-sessions/dto/trail-session.response.dto.ts +++ b/apps/hiking-app/src/modules/trails-sessions/dto/trail-session.response.dto.ts @@ -22,5 +22,5 @@ export class TrailSessionResponseDto { @Expose() @ApiProperty({ isArray: true, type: UserDto }) @Type(() => UserDto) - hikers: Array; + hikers: UserDto[]; } diff --git a/apps/hiking-app/src/modules/trails-sessions/mocks/sessions.mock-data.ts b/apps/hiking-app/src/modules/trails-sessions/mocks/sessions.mock-data.ts index cf50fa7..31cf42a 100644 --- a/apps/hiking-app/src/modules/trails-sessions/mocks/sessions.mock-data.ts +++ b/apps/hiking-app/src/modules/trails-sessions/mocks/sessions.mock-data.ts @@ -1,6 +1,6 @@ import { SessionSelectType } from '../../databases/selects/sessions.select'; -export const mockedsessions: Array = [ +export const mockedsessions: SessionSelectType[] = [ { id: 1, date: new Date(2022, 2, 20), diff --git a/apps/hiking-app/src/modules/trails-sessions/mocks/users.mock-data.ts b/apps/hiking-app/src/modules/trails-sessions/mocks/users.mock-data.ts index a17c910..571712a 100644 --- a/apps/hiking-app/src/modules/trails-sessions/mocks/users.mock-data.ts +++ b/apps/hiking-app/src/modules/trails-sessions/mocks/users.mock-data.ts @@ -1,6 +1,6 @@ import { User } from '@prisma/db-users'; -export const mockedUsers: Array = [ +export const mockedUsers: User[] = [ { id: 1, name: 'Yolo Bro', diff --git a/apps/hiking-app/src/modules/trails-sessions/services/join-trail-session.service.ts b/apps/hiking-app/src/modules/trails-sessions/services/join-trail-session.service.ts index fad822c..1c650ce 100644 --- a/apps/hiking-app/src/modules/trails-sessions/services/join-trail-session.service.ts +++ b/apps/hiking-app/src/modules/trails-sessions/services/join-trail-session.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { User } from '@prisma/db-users'; import { plainToInstance } from 'class-transformer'; -import { catchError, map, mergeMap, Observable, of } from 'rxjs'; +import { Observable, catchError, map, mergeMap, of } from 'rxjs'; import { conflictError, @@ -9,10 +9,10 @@ import { notFoundError, } from '@libs/rxjs/exceptions'; -import { UsersService } from './users.service'; import { HikingRepositoryService } from '../../databases/repositories/hiking-repository.service'; import { SessionSelectType } from '../../databases/selects/sessions.select'; import { TrailSessionResponseDto } from '../dto/trail-session.response.dto'; +import { UsersService } from './users.service'; @Injectable() export class JoinTrailSessionService { @@ -37,15 +37,15 @@ export class JoinTrailSessionService { ), ); - private throwNotFoundIfNo = ( + private readonly throwNotFoundIfNo = ( session: SessionSelectType | null, ): Observable => session === null ? notFoundError('Session not found') : of(session); - private throwIfUserDoesNotExist = ( + private readonly throwIfUserDoesNotExist = ( idDev: number, session: SessionSelectType, - ): Observable<{ session: SessionSelectType; users: Array }> => + ): Observable<{ session: SessionSelectType; users: User[] }> => this.users .getAll() .pipe( @@ -56,7 +56,7 @@ export class JoinTrailSessionService { ), ); - private throwIfAlreadyInSession = ( + private readonly throwIfAlreadyInSession = ( idDev: number, session: SessionSelectType, ): Observable => @@ -64,7 +64,7 @@ export class JoinTrailSessionService { ? conflictError('User already in session') : of(session); - private addUserToSession = ( + private readonly addUserToSession = ( session: SessionSelectType, idDev: number, ): Observable => diff --git a/apps/hiking-app/src/modules/trails-sessions/services/trail-sessions.service.ts b/apps/hiking-app/src/modules/trails-sessions/services/trail-sessions.service.ts index 7790914..cb79990 100644 --- a/apps/hiking-app/src/modules/trails-sessions/services/trail-sessions.service.ts +++ b/apps/hiking-app/src/modules/trails-sessions/services/trail-sessions.service.ts @@ -13,7 +13,7 @@ export class TrailsSessionsService { private readonly users: UsersService, ) {} - getSessions = (): Observable> => { + getSessions = (): Observable => { const sessions$ = this.hiking.getSessions(); return sessions$.pipe( diff --git a/apps/hiking-app/src/modules/trails-sessions/services/users.service.ts b/apps/hiking-app/src/modules/trails-sessions/services/users.service.ts index 02332a3..044999f 100644 --- a/apps/hiking-app/src/modules/trails-sessions/services/users.service.ts +++ b/apps/hiking-app/src/modules/trails-sessions/services/users.service.ts @@ -8,10 +8,8 @@ import { SessionSelectType } from '../../databases/selects/sessions.select'; @Injectable() export class UsersService extends UsersRepositoryService { - getDistinctUsersin = ( - sessions: SessionSelectType[], - ): Observable> => - of(sessions.map((e) => e.Participants.map((p) => p.idDev)).flat()).pipe( + getDistinctUsersin = (sessions: SessionSelectType[]): Observable => + of(sessions.flatMap((e) => e.Participants.map((p) => p.idDev))).pipe( distinct(), mergeMap(this.getBy), ); @@ -19,9 +17,7 @@ export class UsersService extends UsersRepositoryService { applyUsersTo = ( session: SessionSelectType, users$: Observable, - ): Observable< - Partial & { trail: Trail | null; hikers: Array } - > => + ): Observable & { trail: Trail | null; hikers: User[] }> => users$.pipe( mergeMap((l) => l), filter((u) => session.Participants.some((p) => p.idDev === u.id)), diff --git a/apps/hiking-app/src/modules/trails-sessions/trail-sessions.controller.ts b/apps/hiking-app/src/modules/trails-sessions/trail-sessions.controller.ts index 1272672..aed3fca 100644 --- a/apps/hiking-app/src/modules/trails-sessions/trail-sessions.controller.ts +++ b/apps/hiking-app/src/modules/trails-sessions/trail-sessions.controller.ts @@ -25,7 +25,7 @@ export class TrailsSessionsController { type: [TrailSessionResponseDto], }, }) - getSessions(): Observable> { + getSessions(): Observable { return this.trailsSessions.getSessions(); } diff --git a/apps/hiking-app/src/modules/trails-sessions/trails-sessions.spec.ts b/apps/hiking-app/src/modules/trails-sessions/trails-sessions.spec.ts index 97a6716..01beae2 100644 --- a/apps/hiking-app/src/modules/trails-sessions/trails-sessions.spec.ts +++ b/apps/hiking-app/src/modules/trails-sessions/trails-sessions.spec.ts @@ -3,7 +3,7 @@ import { Session } from '@prisma/db-hiking'; import { User } from '@prisma/db-users'; import request from 'supertest'; -import { getTestingModule, asDateString } from '@libs/tests'; +import { asDateString, getTestingModule } from '@libs/tests'; import { mockApiResponse } from '@libs/tests/mocks/api-response.mock'; import { mockedsessions } from './mocks/sessions.mock-data'; @@ -87,7 +87,7 @@ describe('TrailsSessionsController (e2e)', () => { const idUser = mockedUsers[0].id; const { body } = await request(app.getHttpServer()) - .post(`/trails/sessions/1000/join`) + .post('/trails/sessions/1000/join') .send({ idDev: idUser }) .expect(404); diff --git a/apps/hiking-app/src/modules/trails/mocks/trails.mock-data.ts b/apps/hiking-app/src/modules/trails/mocks/trails.mock-data.ts index 909438c..1d8b69a 100644 --- a/apps/hiking-app/src/modules/trails/mocks/trails.mock-data.ts +++ b/apps/hiking-app/src/modules/trails/mocks/trails.mock-data.ts @@ -1,6 +1,6 @@ import { Trail } from '@prisma/db-hiking'; -export const mockedTrails: Array = [ +export const mockedTrails: Trail[] = [ { id: 1, name: 'Grand mounier', diff --git a/apps/hiking-app/src/modules/trails/trails.controller.ts b/apps/hiking-app/src/modules/trails/trails.controller.ts index 3638da0..27332a3 100644 --- a/apps/hiking-app/src/modules/trails/trails.controller.ts +++ b/apps/hiking-app/src/modules/trails/trails.controller.ts @@ -19,7 +19,7 @@ export class TrailController { type: [TrailDto], }, }) - getTrails(): Observable> { + getTrails(): Observable { return this.service.getTrails(); } } diff --git a/apps/hiking-app/src/modules/trails/trails.service.ts b/apps/hiking-app/src/modules/trails/trails.service.ts index 1cc4321..46669cc 100644 --- a/apps/hiking-app/src/modules/trails/trails.service.ts +++ b/apps/hiking-app/src/modules/trails/trails.service.ts @@ -9,6 +9,6 @@ import { HikingRepositoryService } from '../databases/repositories/hiking-reposi export class TrailsService { constructor(private readonly hiking: HikingRepositoryService) {} - getTrails = (): Observable> => + getTrails = (): Observable => this.hiking.getTrails().pipe(map((o) => plainToInstance(TrailDto, o))); } diff --git a/apps/hiking-app/tsconfig.app.json b/apps/hiking-app/tsconfig.app.json index 12a3149..dd10bf1 100644 --- a/apps/hiking-app/tsconfig.app.json +++ b/apps/hiking-app/tsconfig.app.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "declaration": false, - "outDir": "../../dist/apps/hiking-app" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": false, + "outDir": "../../dist/apps/hiking-app" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] } diff --git a/apps/projects-app/src/main.ts b/apps/projects-app/src/main.ts index 89a7b90..2802764 100644 --- a/apps/projects-app/src/main.ts +++ b/apps/projects-app/src/main.ts @@ -5,7 +5,7 @@ import { bootstrap } from '@libs/boostraper'; import { AppModule } from './modules/app.module'; import { externalDatabasesClients } from './modules/databases/external-databases-clients'; -void (async (): Promise => { +(async (): Promise => { const app = await bootstrap( AppModule, process.env.PROJECTS_APP_PORT || process.env.PORT || 5002, @@ -13,8 +13,8 @@ void (async (): Promise => { 'Everything related with projects', ); - externalDatabasesClients.forEach(async (el) => { - const service = app.get(el as never); + for (const clients of externalDatabasesClients) { + const service = app.get(clients as never); await service.enableShutdownHooks(app); - }); + } })(); diff --git a/apps/projects-app/src/modules/databases/repositories/projects-repository.service.ts b/apps/projects-app/src/modules/databases/repositories/projects-repository.service.ts index 178895e..5627a13 100644 --- a/apps/projects-app/src/modules/databases/repositories/projects-repository.service.ts +++ b/apps/projects-app/src/modules/databases/repositories/projects-repository.service.ts @@ -12,7 +12,7 @@ import { export class ProjectsRepositoryService extends ProjectsDatabaseService { getProjectContributions = ( idProject: number, - ): Observable> => + ): Observable => from( this.projectsDB.contribution.findMany({ select: contributionsSelect, diff --git a/apps/projects-app/src/modules/projects-contributions/dto/project-contributions.response.dto.ts b/apps/projects-app/src/modules/projects-contributions/dto/project-contributions.response.dto.ts index 692aa06..510c0bf 100644 --- a/apps/projects-app/src/modules/projects-contributions/dto/project-contributions.response.dto.ts +++ b/apps/projects-app/src/modules/projects-contributions/dto/project-contributions.response.dto.ts @@ -18,7 +18,7 @@ export class ProjectContributionsDto { @Expose() @ApiProperty({ isArray: true, type: UserDto }) @Type(() => UserDto) - dev: Array; + dev: UserDto[]; @Expose() @ApiProperty() diff --git a/apps/projects-app/src/modules/projects-contributions/projects-contributions.controller.ts b/apps/projects-app/src/modules/projects-contributions/projects-contributions.controller.ts index dfda1a6..49023a4 100644 --- a/apps/projects-app/src/modules/projects-contributions/projects-contributions.controller.ts +++ b/apps/projects-app/src/modules/projects-contributions/projects-contributions.controller.ts @@ -27,7 +27,7 @@ export class ProjectsContributionsController { new ParseIdPipe('Expecting an integer as param for trail session id'), ) id: number, - ): Observable> { + ): Observable { return this.service.getProjectContributions(id); } } diff --git a/apps/projects-app/src/modules/projects-contributions/projects-contributions.service.ts b/apps/projects-app/src/modules/projects-contributions/projects-contributions.service.ts index 23c484a..df929dc 100644 --- a/apps/projects-app/src/modules/projects-contributions/projects-contributions.service.ts +++ b/apps/projects-app/src/modules/projects-contributions/projects-contributions.service.ts @@ -2,21 +2,21 @@ import { Injectable } from '@nestjs/common'; import { User } from '@prisma/db-users'; import { plainToInstance } from 'class-transformer'; import { + Observable, distinct, from, map, mergeAll, mergeMap, - Observable, of, single, toArray, } from 'rxjs'; -import { ProjectContributionsDto } from './dto/project-contributions.response.dto'; import { ProjectsRepositoryService } from '../databases/repositories/projects-repository.service'; import { UsersRepositoryService } from '../databases/repositories/users-repository.service'; import { ContributionSelectType } from '../databases/selects/contributions.select'; +import { ProjectContributionsDto } from './dto/project-contributions.response.dto'; @Injectable() export class ProjectsContributionsService { @@ -27,7 +27,7 @@ export class ProjectsContributionsService { getProjectContributions = ( idProject: number, - ): Observable> => { + ): Observable => { const contributions$ = this.projects.getProjectContributions(idProject); return contributions$.pipe( @@ -55,9 +55,9 @@ export class ProjectsContributionsService { ); }; - private getUsersFor = ( + private readonly getUsersFor = ( contributions: ContributionSelectType[], - ): Observable> => + ): Observable => of(contributions.map((el) => el.idDev)) .pipe(distinct()) .pipe(mergeMap(this.users.getBy)); diff --git a/apps/projects-app/tsconfig.app.json b/apps/projects-app/tsconfig.app.json index 60e35ca..c5e479d 100644 --- a/apps/projects-app/tsconfig.app.json +++ b/apps/projects-app/tsconfig.app.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "declaration": false, - "outDir": "../../dist/apps/projects-app" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": false, + "outDir": "../../dist/apps/projects-app" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] } diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..335589a --- /dev/null +++ b/biome.json @@ -0,0 +1,233 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", + "organizeImports": { "enabled": true }, + "files": { + "ignore": ["./coverage", "./dist", "./node_modules"] + }, + "linter": { + "enabled": true, + "rules": { + "recommended": false, + "complexity": { + "noBannedTypes": "error", + "noExtraBooleanCast": "error", + "noMultipleSpacesInRegularExpressionLiterals": "error", + "noStaticOnlyClass": "error", + "noUselessCatch": "error", + "noUselessConstructor": "error", + "noUselessLoneBlockStatements": "error", + "noUselessSwitchCase": "error", + "noUselessRename": "error", + "noUselessTernary": "error", + "noUselessTypeConstraint": "error", + "noVoid": "error", + "noWith": "error", + "useLiteralKeys": "error", + "useOptionalChain": "error", + "useRegexLiterals": "error", + "noEmptyTypeParameters": "error", + "noExcessiveCognitiveComplexity": { + "level": "error", + "options": { + "maxAllowedComplexity": 25 + } + }, + "noExcessiveNestedTestSuites": "error", + "noForEach": "error", + "noThisInStatic": "error", + "noUselessEmptyExport": "error", + "noUselessFragments": "error", + "noUselessLabel": "error", + "noUselessThisAlias": "error", + "useArrowFunction": "error", + "useFlatMap": "error", + "useSimpleNumberKeys": "error", + "useSimplifiedLogicExpression": "error" + }, + "correctness": { + "noConstAssign": "error", + "noConstantCondition": "error", + "noEmptyCharacterClassInRegex": "error", + "noEmptyPattern": "error", + "noGlobalObjectCalls": "error", + "noInvalidConstructorSuper": "error", + "noInvalidUseBeforeDeclaration": "error", + "noNewSymbol": "error", + "noPrecisionLoss": "error", + "noSelfAssign": "error", + "noSwitchDeclarations": "error", + "noUndeclaredVariables": "error", + "noUnreachable": "error", + "noUnreachableSuper": "error", + "noUnsafeFinally": "error", + "noUnusedVariables": "error", + "useArrayLiterals": "error", + "useIsNan": "error", + "noInnerDeclarations": "error", + "noInvalidNewBuiltin": "error", + "noSetterReturn": "error", + "noUnnecessaryContinue": "error", + "noStringCaseMismatch": "error", + "noUnsafeOptionalChaining": "error", + "noUnusedImports": "error", + "noUnusedPrivateClassMembers": "error", + "noVoidTypeReturn": "error", + "useExhaustiveDependencies": "error", + "useHookAtTopLevel": "error", + "useJsxKeyInIterable": "error", + "useValidForDirection": "error", + "useYield": "error", + "noChildrenProp": "error", + "noConstructorReturn": "error", + "noFlatMapIdentity": "error", + "noRenderReturnValue": "error", + "noUnusedLabels": "error", + "noVoidElementsWithChildren": "error" + }, + "security": { + "noGlobalEval": "error", + "noDangerouslySetInnerHtml": "error", + "noDangerouslySetInnerHtmlWithChildren": "error" + }, + "style": { + "noCommaOperator": "error", + "noNamespace": "error", + "noUselessElse": "error", + "noImplicitBoolean": "error", + "noNonNullAssertion": "off", + "noVar": "error", + "useAsConstAssertion": "error", + "useBlockStatements": "error", + "useConsistentArrayType": { + "level": "error", + "options": { "syntax": "shorthand" }, + "fix": "safe" + }, + "useConst": "error", + "useShorthandFunctionType": "error", + "useSingleVarDeclarator": "error", + "noArguments": "error", + "noDefaultExport": "error", + "noInferrableTypes": "error", + "noNamespaceImport": "error", + "noNegationElse": "error", + "noParameterAssign": "error", + "noParameterProperties": "off", + "noShoutyConstants": "error", + "noUnusedTemplateLiteral": "error", + "useCollapsedElseIf": "error", + "useDefaultParameterLast": "error", + "useEnumInitializers": "error", + "useExponentiationOperator": "error", + "useExportType": "error", + "useFilenamingConvention": { + "level": "error", + "options": { + "requireAscii": true, + "filenameCases": ["kebab-case"] + } + }, + "useForOf": "error", + "useFragmentSyntax": "error", + "useLiteralEnumMembers": "error", + "useNodejsImportProtocol": "error", + "useNumericLiterals": "error", + "useSelfClosingElements": "error", + "useShorthandArrayType": "error", + "useShorthandAssign": "error", + "useSingleCaseStatement": "error", + "useTemplate": { + "level": "warn", + "fix": "none" + }, + "useWhile": "error" + }, + "suspicious": { + "noAsyncPromiseExecutor": "error", + "noCatchAssign": "error", + "noClassAssign": "error", + "noCompareNegZero": "error", + "noConfusingVoidType": "error", + "noControlCharactersInRegex": "error", + "noDebugger": "error", + "noDoubleEquals": "error", + "noDuplicateCase": "error", + "noDuplicateClassMembers": "error", + "noDuplicateObjectKeys": "error", + "noDuplicateParameters": "error", + "noEmptyBlockStatements": "error", + "noExplicitAny": "error", + "noExtraNonNullAssertion": "error", + "noFallthroughSwitchClause": "error", + "noFunctionAssign": "error", + "noGlobalAssign": "error", + "noImportAssign": "error", + "noMisleadingCharacterClass": "error", + "noMisleadingInstantiator": "error", + "noPrototypeBuiltins": "error", + "noRedeclare": "error", + "noSelfCompare": "error", + "noShadowRestrictedNames": "error", + "noUnsafeDeclarationMerging": "error", + "noUnsafeNegation": "error", + "useDefaultSwitchClauseLast": "error", + "useNamespaceKeyword": "error", + "useValidTypeof": "error", + "noApproximativeNumericConstant": "error", + "noArrayIndexKey": "error", + "noAssignInExpressions": "error", + "noCommentText": "error", + "noConfusingLabels": "error", + "noConsoleLog": "error", + "noConstEnum": "error", + "noDuplicateJsxProps": "error", + "noDuplicateTestHooks": "error", + "noEmptyInterface": "error", + "noExportsInTest": "error", + "noFocusedTests": "error", + "noGlobalIsFinite": "error", + "noGlobalIsNan": "error", + "noImplicitAnyLet": "error", + "noLabelVar": "error", + "noMisrefactoredShorthandAssign": "error", + "noRedundantUseStrict": "error", + "noSkippedTests": "error", + "noSparseArray": "error", + "noSuspiciousSemicolonInJsx": "error", + "noThenProperty": "error", + "useAwait": "error", + "useGetterReturn": "error", + "useIsArray": "error" + } + }, + "ignore": [ + "**/dist", + "**/node_modules", + "**/coverage", + "src/tests/bundle/*", + "src/examples/bundling/*" + ] + }, + "javascript": { + "globals": [ + "document", + "navigator", + "window", + "exports", + "describe", + "it", + "beforeEach", + "afterEach", + "expect", + "jest" + ], + "formatter": { + "quoteStyle": "single", + "semicolons": "always", + "indentStyle": "space" + }, + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/bun.lockb b/bun.lockb index 1335dd5..d62a5d1 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/libs/boostraper/tsconfig.lib.json b/libs/boostraper/tsconfig.lib.json index 9467647..ed52dda 100644 --- a/libs/boostraper/tsconfig.lib.json +++ b/libs/boostraper/tsconfig.lib.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "../../dist/libs/boostraper" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "../../dist/libs/boostraper" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] } diff --git a/libs/databases/src/hiking/hiking-database.client.ts b/libs/databases/src/hiking/hiking-database.client.ts index 404dedb..073cf5e 100644 --- a/libs/databases/src/hiking/hiking-database.client.ts +++ b/libs/databases/src/hiking/hiking-database.client.ts @@ -8,7 +8,7 @@ export class HikingDatabaseClient extends PrismaClient implements OnModuleInit { await this.$connect(); } - async enableShutdownHooks(app: INestApplication): Promise { + enableShutdownHooks(app: INestApplication): void { process.on('beforeExit', async () => { await app.close(); }); diff --git a/libs/databases/src/projects/projects-database.client.ts b/libs/databases/src/projects/projects-database.client.ts index 63559e3..5895d45 100644 --- a/libs/databases/src/projects/projects-database.client.ts +++ b/libs/databases/src/projects/projects-database.client.ts @@ -11,7 +11,7 @@ export class ProjectsDatabaseClient await this.$connect(); } - async enableShutdownHooks(app: INestApplication): Promise { + enableShutdownHooks(app: INestApplication): void { process.on('beforeExit', async () => { await app.close(); }); diff --git a/libs/databases/src/users/users-database.client.ts b/libs/databases/src/users/users-database.client.ts index 5d0affa..6e48493 100644 --- a/libs/databases/src/users/users-database.client.ts +++ b/libs/databases/src/users/users-database.client.ts @@ -7,7 +7,7 @@ export class UsersDatabaseClient extends PrismaClient implements OnModuleInit { await this.$connect(); } - async enableShutdownHooks(app: INestApplication): Promise { + enableShutdownHooks(app: INestApplication): void { process.on('beforeExit', async () => { await app.close(); }); diff --git a/libs/databases/src/users/users-database.service.ts b/libs/databases/src/users/users-database.service.ts index a7583c1..3df89cd 100644 --- a/libs/databases/src/users/users-database.service.ts +++ b/libs/databases/src/users/users-database.service.ts @@ -8,7 +8,7 @@ import { UsersDatabaseClient } from './users-database.client'; export class UsersDatabaseService { constructor(protected readonly usersDB: UsersDatabaseClient) {} - getBy = (ids: Array): Observable => + getBy = (ids: number[]): Observable => from( this.usersDB.user.findMany({ where: { diff --git a/libs/databases/tsconfig.lib.json b/libs/databases/tsconfig.lib.json index c0e0168..1ae4dca 100644 --- a/libs/databases/tsconfig.lib.json +++ b/libs/databases/tsconfig.lib.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "../../dist/libs/databases" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "../../dist/libs/databases" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] } diff --git a/libs/decorators/src/dto/api-response.dto.ts b/libs/decorators/src/dto/api-response.dto.ts index 93a6f7c..de49975 100644 --- a/libs/decorators/src/dto/api-response.dto.ts +++ b/libs/decorators/src/dto/api-response.dto.ts @@ -5,5 +5,5 @@ export class ApiResponseDto { statusCode: number; @ApiProperty() - message: Array | string; + message: string[] | string; } diff --git a/libs/decorators/tsconfig.lib.json b/libs/decorators/tsconfig.lib.json index 7ea1c9c..cb0eba8 100644 --- a/libs/decorators/tsconfig.lib.json +++ b/libs/decorators/tsconfig.lib.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "../../dist/libs/decorators" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "../../dist/libs/decorators" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] } diff --git a/libs/filters/tsconfig.lib.json b/libs/filters/tsconfig.lib.json index 8cf7f2e..dff7a36 100644 --- a/libs/filters/tsconfig.lib.json +++ b/libs/filters/tsconfig.lib.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "../../dist/libs/filters" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "../../dist/libs/filters" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] } diff --git a/libs/pipes/src/parse-id/parse-id.pipe.ts b/libs/pipes/src/parse-id/parse-id.pipe.ts index f78eaf5..eb5fc79 100644 --- a/libs/pipes/src/parse-id/parse-id.pipe.ts +++ b/libs/pipes/src/parse-id/parse-id.pipe.ts @@ -1,13 +1,13 @@ import { - Injectable, ArgumentMetadata, - ParseIntPipe, BadRequestException, + Injectable, + ParseIntPipe, } from '@nestjs/common'; @Injectable() export class ParseIdPipe extends ParseIntPipe { - constructor(private message: string | Array) { + constructor(private readonly message: string | string[]) { super(); } @@ -22,7 +22,7 @@ export class ParseIdPipe extends ParseIntPipe { }); } return transformed; - } catch (err) { + } catch (_err) { throw new BadRequestException({ error: 'Bad Request', message: this.message, diff --git a/libs/pipes/tsconfig.lib.json b/libs/pipes/tsconfig.lib.json index 2dbdf8d..c50e709 100644 --- a/libs/pipes/tsconfig.lib.json +++ b/libs/pipes/tsconfig.lib.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "../../dist/libs/pipes" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "../../dist/libs/pipes" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] } diff --git a/libs/rxjs/tsconfig.lib.json b/libs/rxjs/tsconfig.lib.json index 6317557..eef11b0 100644 --- a/libs/rxjs/tsconfig.lib.json +++ b/libs/rxjs/tsconfig.lib.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "../../dist/libs/rxjs" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "../../dist/libs/rxjs" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] } diff --git a/libs/tests/src/mocks/api-response.mock.ts b/libs/tests/src/mocks/api-response.mock.ts index 064a1c9..b3b37ee 100644 --- a/libs/tests/src/mocks/api-response.mock.ts +++ b/libs/tests/src/mocks/api-response.mock.ts @@ -1,7 +1,7 @@ export const mockApiResponse = ( statusCode: number, error: string, - message: Array | string, + message: string[] | string, ): unknown => ({ error, message, diff --git a/libs/tests/tsconfig.lib.json b/libs/tests/tsconfig.lib.json index da3c4e5..036f079 100644 --- a/libs/tests/tsconfig.lib.json +++ b/libs/tests/tsconfig.lib.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "../../dist/libs/tests" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] + "extends": "../../tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "../../dist/libs/tests" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] } diff --git a/nest-cli.json b/nest-cli.json index c5a6788..92ef0fd 100644 --- a/nest-cli.json +++ b/nest-cli.json @@ -1,72 +1,72 @@ { - "collection": "@nestjs/schematics", - "monorepo": true, - "compilerOptions": { - "webpack": true - }, - "projects": { - "hiking-app": { - "type": "application", - "root": "apps/hiking-app", - "entryFile": "main", - "sourceRoot": "apps/hiking-app/src", - "compilerOptions": { - "tsConfigPath": "apps/hiking-app/tsconfig.app.json" - } - }, - "projects-app": { - "type": "application", - "root": "apps/projects-app", - "entryFile": "main", - "sourceRoot": "apps/projects-app/src", - "compilerOptions": { - "tsConfigPath": "apps/projects-app/tsconfig.app.json" - } - }, - "boostraper": { - "type": "library", - "root": "libs/boostraper", - "entryFile": "index", - "sourceRoot": "libs/boostraper/src", - "compilerOptions": { - "tsConfigPath": "libs/boostraper/tsconfig.lib.json" - } - }, - "databases": { - "type": "library", - "root": "libs/databases", - "entryFile": "index", - "sourceRoot": "libs/databases/src", - "compilerOptions": { - "tsConfigPath": "libs/databases/tsconfig.lib.json" - } - }, - "decorators": { - "type": "library", - "root": "libs/decorators", - "entryFile": "index", - "sourceRoot": "libs/decorators/src", - "compilerOptions": { - "tsConfigPath": "libs/decorators/tsconfig.lib.json" - } - }, - "rxjs": { - "type": "library", - "root": "libs/rxjs", - "entryFile": "index", - "sourceRoot": "libs/rxjs/src", - "compilerOptions": { - "tsConfigPath": "libs/rxjs/tsconfig.lib.json" - } - }, - "tests": { - "type": "library", - "root": "libs/tests", - "entryFile": "index", - "sourceRoot": "libs/tests/src", - "compilerOptions": { - "tsConfigPath": "libs/tests/tsconfig.lib.json" - } - } - } -} \ No newline at end of file + "collection": "@nestjs/schematics", + "monorepo": true, + "compilerOptions": { + "webpack": true + }, + "projects": { + "hiking-app": { + "type": "application", + "root": "apps/hiking-app", + "entryFile": "main", + "sourceRoot": "apps/hiking-app/src", + "compilerOptions": { + "tsConfigPath": "apps/hiking-app/tsconfig.app.json" + } + }, + "projects-app": { + "type": "application", + "root": "apps/projects-app", + "entryFile": "main", + "sourceRoot": "apps/projects-app/src", + "compilerOptions": { + "tsConfigPath": "apps/projects-app/tsconfig.app.json" + } + }, + "boostraper": { + "type": "library", + "root": "libs/boostraper", + "entryFile": "index", + "sourceRoot": "libs/boostraper/src", + "compilerOptions": { + "tsConfigPath": "libs/boostraper/tsconfig.lib.json" + } + }, + "databases": { + "type": "library", + "root": "libs/databases", + "entryFile": "index", + "sourceRoot": "libs/databases/src", + "compilerOptions": { + "tsConfigPath": "libs/databases/tsconfig.lib.json" + } + }, + "decorators": { + "type": "library", + "root": "libs/decorators", + "entryFile": "index", + "sourceRoot": "libs/decorators/src", + "compilerOptions": { + "tsConfigPath": "libs/decorators/tsconfig.lib.json" + } + }, + "rxjs": { + "type": "library", + "root": "libs/rxjs", + "entryFile": "index", + "sourceRoot": "libs/rxjs/src", + "compilerOptions": { + "tsConfigPath": "libs/rxjs/tsconfig.lib.json" + } + }, + "tests": { + "type": "library", + "root": "libs/tests", + "entryFile": "index", + "sourceRoot": "libs/tests/src", + "compilerOptions": { + "tsConfigPath": "libs/tests/tsconfig.lib.json" + } + } + } +} diff --git a/package.json b/package.json index 1aa0775..47a325e 100644 --- a/package.json +++ b/package.json @@ -1,97 +1,92 @@ { - "name": "nest-prisma-monorepo", - "version": "0.0.1", - "description": "", - "private": true, - "repository": "https://github.com/jpb06/nest-prisma-monorepo.git", - "author": "jpb06 ", - "license": "MIT", - "scripts": { - "update-deps": "bunx npm-check-updates --root --format group -i", - "prebuild": "rimraf dist", - "build": "bun build:hiking-app && bun build:projects-app", - "build:hiking-app": "nest build hiking-app ", - "build:projects-app": "nest build projects-app", - "prisma:gen": "bun prisma:gen:users && bun prisma:gen:projects && bun prisma:gen:hiking", - "prisma:migrate": "bun prisma:migrate:users && bun prisma:migrate:projects && bun prisma:migrate:hiking", - "prisma:gen:users": "prisma generate --schema prisma/users/users-schema.prisma", - "prisma:gen:projects": "prisma generate --schema prisma/projects/projects-schema.prisma", - "prisma:gen:hiking": "prisma generate --schema prisma/hiking/hiking-schema.prisma", - "prisma:migrate:users": "prisma migrate dev --schema prisma/users/users-schema.prisma", - "prisma:migrate:projects": "prisma migrate dev --schema prisma/projects/projects-schema.prisma", - "prisma:migrate:hiking": "prisma migrate dev --schema prisma/hiking/hiking-schema.prisma", - "postinstall": "bun prisma:gen", - "docker": "docker compose down && docker compose up postgres", - "db:seed": "prisma db seed", - "dev": "nest start --watch", - "dev:db": "bun prisma:migrate && bun db:seed", - "start": "nest start", - "start:debug": "nest start --debug --watch", - "start:prod": "node dist/main", - "test": "jest", - "test:dev": "jest --watch", - "test:dev:cov": "jest --watchAll --coverage", - "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", - "test:e2e": "jest --config ./apps/nest-prisma-monorepo/test/jest-e2e.json", - "test:ci": "jest --ci --coverage", - "format": "prettier --write \"apps/**/*.ts\" \"libs/**/*.ts\"", - "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", - "type-check": "tsc --noEmit", - "sync-icons": "bun generateReadmeIcons -h 50" - }, - "dependencies": { - "@nestjs/common": "^10.3.10", - "@nestjs/core": "^10.3.10", - "@nestjs/platform-express": "^10.3.10", - "@nestjs/swagger": "^7.4.0", - "@prisma/client": "^5.16.2", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.1", - "dotenv-flow": "^4.1.0", - "reflect-metadata": "^0.2.2", - "rxjs": "^7.8.1", - "swagger-ui-express": "^5.0.1" - }, - "devDependencies": { - "@nestjs/cli": "^10.4.2", - "@nestjs/schematics": "^10.1.2", - "@nestjs/testing": "^10.3.10", - "@swc/core": "^1.6.13", - "@swc/jest": "^0.2.36", - "@types/dotenv-flow": "^3.3.3", - "@types/express": "^4.17.21", - "@types/jest": "29.5.12", - "@types/node": "^20.14.10", - "@types/supertest": "^6.0.2", - "@typescript-eslint/eslint-plugin": "^7.16.1", - "@typescript-eslint/parser": "^7.16.1", - "date-fns": "^3.6.0", - "eslint": "^8.57.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jest": "^28.6.0", - "eslint-plugin-prettier": "^5.1.3", - "express": "^4.19.2", - "jest": "^29.7.0", - "jest-mock-extended": "^3.0.7", - "prettier": "^3.3.3", - "prisma": "^5.16.2", - "readme-package-icons": "^1.1.14", - "rimraf": "^6.0.1", - "source-map-support": "^0.5.21", - "supertest": "^7.0.0", - "ts-loader": "^9.5.1", - "ts-node": "^10.9.2", - "ts-paths-transform": "^2.0.4", - "tsconfig-paths": "^4.2.0", - "typescript": "^5.5.3", - "webpack": "^5.93.0" - }, - "engines": { - "node": "20.x", - "bun": "1.1.x" - }, - "prisma": { - "seed": "ts-node prisma/seed.ts" - } + "name": "nest-prisma-monorepo", + "version": "0.0.1", + "description": "", + "private": true, + "repository": "https://github.com/jpb06/nest-prisma-monorepo.git", + "author": "jpb06 ", + "license": "MIT", + "scripts": { + "update-deps": "bunx npm-check-updates --root --format group -i", + "prebuild": "rimraf dist", + "build": "bun build:hiking-app && bun build:projects-app", + "build:hiking-app": "nest build hiking-app ", + "build:projects-app": "nest build projects-app", + "prisma:gen": "bun prisma:gen:users && bun prisma:gen:projects && bun prisma:gen:hiking", + "prisma:migrate": "bun prisma:migrate:users && bun prisma:migrate:projects && bun prisma:migrate:hiking", + "prisma:gen:users": "prisma generate --schema prisma/users/users-schema.prisma", + "prisma:gen:projects": "prisma generate --schema prisma/projects/projects-schema.prisma", + "prisma:gen:hiking": "prisma generate --schema prisma/hiking/hiking-schema.prisma", + "prisma:migrate:users": "prisma migrate dev --schema prisma/users/users-schema.prisma", + "prisma:migrate:projects": "prisma migrate dev --schema prisma/projects/projects-schema.prisma", + "prisma:migrate:hiking": "prisma migrate dev --schema prisma/hiking/hiking-schema.prisma", + "postinstall": "bun prisma:gen", + "docker": "docker compose down && docker compose up postgres", + "db:seed": "prisma db seed", + "dev": "nest start --watch", + "dev:db": "bun prisma:migrate && bun db:seed", + "start": "nest start", + "start:debug": "nest start --debug --watch", + "start:prod": "node dist/main", + "test": "jest", + "test:dev": "jest --watch", + "test:dev:cov": "jest --watchAll --coverage", + "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", + "test:e2e": "jest --config ./apps/nest-prisma-monorepo/test/jest-e2e.json", + "test:ci": "jest --ci --coverage", + "format": "biome format --write .", + "format-ci": "biome format .", + "lint": "biome lint .", + "lint-fix": "biome lint --write .", + "type-check": "tsc --noEmit", + "sync-icons": "bun generateReadmeIcons -h 50" + }, + "dependencies": { + "@nestjs/common": "^10.4.12", + "@nestjs/core": "^10.4.12", + "@nestjs/platform-express": "^10.4.12", + "@nestjs/swagger": "^8.0.7", + "@prisma/client": "^6.0.0", + "class-transformer": "^0.5.1", + "class-validator": "^0.14.1", + "dotenv-flow": "^4.1.0", + "reflect-metadata": "^0.2.2", + "rxjs": "^7.8.1", + "swagger-ui-express": "^5.0.1" + }, + "devDependencies": { + "@biomejs/biome": "^1.9.4", + "@nestjs/cli": "^10.4.8", + "@nestjs/schematics": "^10.2.3", + "@nestjs/testing": "^10.4.12", + "@swc/core": "^1.9.3", + "@swc/jest": "^0.2.37", + "@types/dotenv-flow": "^3.3.3", + "@types/express": "^5.0.0", + "@types/jest": "29.5.14", + "@types/node": "^22.10.1", + "@types/supertest": "^6.0.2", + "date-fns": "^4.1.0", + "express": "^4.21.1", + "jest": "^29.7.0", + "jest-mock-extended": "^3.0.7", + "prisma": "^6.0.0", + "readme-package-icons": "^1.1.16", + "rimraf": "^6.0.1", + "source-map-support": "^0.5.21", + "supertest": "^7.0.0", + "ts-loader": "^9.5.1", + "ts-node": "^10.9.2", + "ts-paths-transform": "^2.0.5", + "tsconfig-paths": "^4.2.0", + "typescript": "^5.7.2", + "webpack": "^5.96.1" + }, + "engines": { + "node": "20.x", + "bun": "1.1.x" + }, + "prisma": { + "seed": "ts-node prisma/seed.ts" + } } diff --git a/tsconfig.build.json b/tsconfig.build.json index 64f86c6..4491981 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,4 +1,4 @@ { - "extends": "./tsconfig.json", - "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] + "extends": "./tsconfig.json", + "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] } diff --git a/tsconfig.json b/tsconfig.json index f835fcd..3e553fc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,50 +1,50 @@ { - "compilerOptions": { - "allowJs": false, - "alwaysStrict": true, - "allowSyntheticDefaultImports": true, - "baseUrl": "./", - "declaration": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "incremental": true, - "isolatedModules": true, - "module": "commonjs", - "strictPropertyInitialization": false, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": false, - "typeRoots": ["./types", "./node_modules/@types"], - "outDir": "./dist", - "removeComments": true, - "sourceMap": true, - "skipLibCheck": true, - "strict": true, - "strictNullChecks": true, - "target": "es2021", - "paths": { - "@apps/hiking-app": ["apps/hiking-app/src"], - "@apps/hiking-app/*": ["apps/hiking-app/src/*"], - "@apps/projects-app": ["apps/projects-app/src"], - "@apps/projects-app/*": ["apps/projects-app/src/*"], - "@libs/boostraper": ["libs/boostraper/src"], - "@libs/boostraper/*": ["libs/boostraper/src/*"], - "@libs/databases": ["libs/databases/src"], - "@libs/databases/*": ["libs/databases/src/*"], - "@libs/decorators": ["libs/decorators/src"], - "@libs/decorators/*": ["libs/decorators/src/*"], - "@libs/filters": ["libs/filters/src"], - "@libs/filters/*": ["libs/filters/src/*"], - "@libs/pipes": ["libs/pipes/src"], - "@libs/pipes/*": ["libs/pipes/src/*"], - "@libs/rxjs": ["libs/rxjs/src"], - "@libs/rxjs/*": ["libs/rxjs/src/*"], - "@libs/tests": ["libs/tests/src"], - "@libs/tests/*": ["libs/tests/src/*"] - } - } + "compilerOptions": { + "allowJs": false, + "alwaysStrict": true, + "allowSyntheticDefaultImports": true, + "baseUrl": "./", + "declaration": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "incremental": true, + "isolatedModules": true, + "module": "commonjs", + "strictPropertyInitialization": false, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": false, + "typeRoots": ["./types", "./node_modules/@types"], + "outDir": "./dist", + "removeComments": true, + "sourceMap": true, + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "target": "es2021", + "paths": { + "@apps/hiking-app": ["apps/hiking-app/src"], + "@apps/hiking-app/*": ["apps/hiking-app/src/*"], + "@apps/projects-app": ["apps/projects-app/src"], + "@apps/projects-app/*": ["apps/projects-app/src/*"], + "@libs/boostraper": ["libs/boostraper/src"], + "@libs/boostraper/*": ["libs/boostraper/src/*"], + "@libs/databases": ["libs/databases/src"], + "@libs/databases/*": ["libs/databases/src/*"], + "@libs/decorators": ["libs/decorators/src"], + "@libs/decorators/*": ["libs/decorators/src/*"], + "@libs/filters": ["libs/filters/src"], + "@libs/filters/*": ["libs/filters/src/*"], + "@libs/pipes": ["libs/pipes/src"], + "@libs/pipes/*": ["libs/pipes/src/*"], + "@libs/rxjs": ["libs/rxjs/src"], + "@libs/rxjs/*": ["libs/rxjs/src/*"], + "@libs/tests": ["libs/tests/src"], + "@libs/tests/*": ["libs/tests/src/*"] + } + } }