Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logger has been moved and implemented as an internal lib #449

Merged
merged 8 commits into from
Sep 22, 2023
Merged
2 changes: 1 addition & 1 deletion apps/backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ThrottlerModule } from '@nestjs/throttler';
import { AuthModule } from './auth/auth.module';
import { AppCacheModule } from './cache/cache.module';
import { AppConfigModule, AppConfigService } from '@reduced.to/config';
import { AppLoggerModule } from './logger/logger.module';
import { AppLoggerModule } from '@reduced.to/logger';
import { NovuModule } from './novu/novu.module';
import { PrismaService } from '@reduced.to/prisma';
import { UniqueConstraint } from './shared/decorators/unique/unique.decorator';
Expand Down
3 changes: 2 additions & 1 deletion apps/backend/src/shortener/shortener.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ShortenerController } from './shortener.controller';
import { Test } from '@nestjs/testing';
import { ShortenerDto } from './dto';
import { Request } from 'express';
import { AppLoggerModule } from '../logger/logger.module';
import { AppLoggerModule } from '@reduced.to/logger';

describe('ShortenerController', () => {
let shortenerController: ShortenerController;
Expand Down Expand Up @@ -97,3 +97,4 @@ describe('ShortenerController', () => {
});
});
});
import { reduce } from 'rxjs';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it by mistake

2 changes: 1 addition & 1 deletion apps/backend/src/shortener/shortener.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ShortenerDto } from './dto';
import { ShortenerService } from './shortener.service';
import { UserContext } from '../auth/interfaces/user-context';
import { OptionalJwtAuthGuard } from '../auth/guards/optional-jwt-auth.guard';
import { AppLoggerSerivce } from '../logger/logger.service';
import { AppLoggerSerivce } from '@reduced.to/logger';

@Controller({
path: 'shortener',
Expand Down
18 changes: 18 additions & 0 deletions libs/logger/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions libs/logger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# logger

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

## Running unit tests

Run `nx test logger` to execute the unit tests via [Jest](https://jestjs.io).
11 changes: 11 additions & 0 deletions libs/logger/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'logger',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/libs/logger',
};
30 changes: 30 additions & 0 deletions libs/logger/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "logger",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "logger/src",
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["logger/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/config/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"tags": []
}
2 changes: 2 additions & 0 deletions libs/logger/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './lib/logger.module';
export * from './lib/logger.service';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Global, Module } from '@nestjs/common';
import { AppLoggerSerivce } from './logger.service';
import { AppLoggerSerivce } from '@reduced.to/logger';

@Global()
@Module({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AppConfigModule } from '@reduced.to/config';
import { AppLoggerSerivce } from './logger.service';
import { AppLoggerSerivce } from '@reduced.to/logger';

describe('LoggerService', () => {
let service: AppLoggerSerivce;
Expand Down
16 changes: 16 additions & 0 deletions libs/logger/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs"
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
11 changes: 11 additions & 0 deletions libs/logger/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"include": ["src/**/*.ts"]
}
9 changes: 9 additions & 0 deletions libs/logger/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"]
}
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"baseUrl": ".",
"paths": {
"@reduced.to/config": ["libs/config/src/index.ts"],
"@reduced.to/logger": ["libs/logger/src/index.ts"],
"@reduced.to/prisma": ["libs/prisma/src/index.ts"],
"@reduced.to/queue-manager": ["libs/queue-manager/src/index.ts"]
}
Expand Down
Loading