Skip to content
Snippets Groups Projects
Unverified Commit 45c91dc1 authored by Konstantin Tsabolov's avatar Konstantin Tsabolov
Browse files

chore: update dependencies, fix style

* Upgraded the dependencies to the latest versions
* Switched output to ESM format
* Switched NestJS and Jest to SWC to improve speed of building and testing
* Refactored TSConfig to remove tsconfig-paths
* Updated imports in all files to reflect the change in TSConfig
* Changed the linting rules (removed AirBnB config)
* Fixed Prettier installation (added ignore file)
* Fixed typing errors (mainly usage of any's)
* Fixed the non-working E2E test

P.S. None of the mentioned makes sense alone, therefore a huge commit :man_shrugging:
parent 9c2cfed8
No related branches found
No related tags found
2 merge requests!9feat(ssi): Establish a trusted connection with yourself,!8Project house-keeping, refactoring and reorganizing
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import PrismaService from './prisma.service';
import PrismaService from './prisma.service.js';
@Module({
imports: [ConfigModule],
......
......@@ -7,19 +7,18 @@ export default class PrismaService
extends PrismaClient
implements OnModuleInit, OnModuleDestroy
{
constructor(private configService: ConfigService) {
super();
}
async onModuleInit() {
const prisma = new PrismaClient({
constructor(configService: ConfigService) {
super({
datasources: {
db: {
url: this.configService.get('DATABASE_URL'),
url: configService.get('DATABASE_URL'),
},
},
});
await prisma.$connect();
}
async onModuleInit() {
await this.$connect();
}
async onModuleDestroy() {
......
import { ecsFormat } from '@elastic/ecs-winston-format';
import { existsSync, mkdirSync } from 'fs';
import winston, { Logger } from 'winston';
import ecsFormat from '@elastic/ecs-winston-format';
import { LoggerConfig } from '@common/constants';
import { LoggerConfig } from '../common/constants.js';
if (!existsSync(LoggerConfig.lOG_DIR)) {
mkdirSync(LoggerConfig.lOG_DIR);
}
// const esTransportOpts = {
// clientOpts: { node: 'http://localhost:9200/' },
// };
// const esTransport = new ElasticsearchTransport(esTransportOpts);
// esTransport.on('error', (error) => {
// console.error(error);
// });
const logger: Logger = winston.createLogger({
format: ecsFormat({ convertReqRes: true }),
transports: [
new winston.transports.Console(),
// new winston.transports.File({
// // path to log file
// filename: LoggerConfig.FILE_PATH,
// }),
// Path to Elasticsearch
// esTransport,
],
transports: [new winston.transports.Console()],
});
logger.on('error', (error) => {
......
......@@ -22,7 +22,10 @@ export default class Nats {
}
}
public static async subscribe(subject: string, cb: (...args: any[]) => any) {
public static async subscribe(
subject: string,
cb: (...args: unknown[]) => unknown,
) {
if (this.nc) {
const sub = this.nc.subscribe(subject);
(async () => {
......
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}
/** @type {import('jest').Config} */
import config from '../jest.config.js';
export default {
...config,
rootDir: '.',
testRegex: '.*\\.e2e-spec\\.ts$',
};
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"composite": true,
"removeComments": false,
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"target": "es6",
"sourceMap": true,
"incremental": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"strictNullChecks": true,
"skipLibCheck": true,
"paths": {
"@src/*":["src/*"],
"@client/*":["src/client/*"],
"@config/*":["config/*"],
"@utils/*" :["src/utils/*"],
"@common/*":["src/common/*"],
"@principal/*":["src/principal/*"],
"@health/*":["src/health/*"],
"@DB/*":["src/prisma/*"]
}
"rootDir": "./src"
},
"include": [
"**/*.ts",
"src",
"config",
],
"include": ["src"],
"exclude": ["node_modules", "./dist/**/*"]
}
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment