mirror of
https://github.com/hknsh/project-knedita.git
synced 2024-11-28 09:31:16 +00:00
feat: added biome on pre-commit
This commit is contained in:
parent
6f7aafef81
commit
66681673bc
41 changed files with 2530 additions and 772 deletions
|
@ -1,5 +1,5 @@
|
||||||
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
|
if (process.env.NODE_ENV === "production" || process.env.CI === "true") {
|
||||||
process.exit(0)
|
process.exit(0);
|
||||||
}
|
}
|
||||||
const husky = (await import('husky')).default
|
const husky = (await import("husky")).default;
|
||||||
console.log(husky())
|
console.log(husky());
|
||||||
|
|
1
.husky/pre-commit
Normal file
1
.husky/pre-commit
Normal file
|
@ -0,0 +1 @@
|
||||||
|
lint-staged
|
4
.vscode/extensions.json
vendored
4
.vscode/extensions.json
vendored
|
@ -1,5 +1,3 @@
|
||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": ["biomejs.biome"]
|
||||||
"biomejs.biome"
|
|
||||||
]
|
|
||||||
}
|
}
|
|
@ -1,3 +1,3 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: ['@commitlint/config-conventional'],
|
extends: ["@commitlint/config-conventional"],
|
||||||
};
|
};
|
||||||
|
|
1753
package-lock.json
generated
1753
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -61,6 +61,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.5.3",
|
"@biomejs/biome": "1.5.3",
|
||||||
|
"@commitlint/cli": "^18.6.0",
|
||||||
|
"@commitlint/config-conventional": "^18.6.0",
|
||||||
"@nestjs/cli": "^10.0.0",
|
"@nestjs/cli": "^10.0.0",
|
||||||
"@nestjs/schematics": "^10.0.0",
|
"@nestjs/schematics": "^10.0.0",
|
||||||
"@nestjs/testing": "^10.0.0",
|
"@nestjs/testing": "^10.0.0",
|
||||||
|
@ -81,6 +83,7 @@
|
||||||
"eslint-plugin-prettier": "^5.0.0",
|
"eslint-plugin-prettier": "^5.0.0",
|
||||||
"husky": "^9.0.7",
|
"husky": "^9.0.7",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
|
"lint-staged": "^15.2.1",
|
||||||
"prettier": "^3.0.0",
|
"prettier": "^3.0.0",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"supertest": "^6.3.3",
|
"supertest": "^6.3.3",
|
||||||
|
@ -108,5 +111,8 @@
|
||||||
],
|
],
|
||||||
"coverageDirectory": "../coverage",
|
"coverageDirectory": "../coverage",
|
||||||
"testEnvironment": "node"
|
"testEnvironment": "node"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"**.{js|ts|json}": "biome check --apply --no-errors-on-unmatched"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
|
import { FastifyMulterModule } from "@nest-lab/fastify-multer";
|
||||||
import { Module } from "@nestjs/common";
|
import { Module } from "@nestjs/common";
|
||||||
import { UserModule } from "./users/users.module";
|
import { ConfigModule } from "@nestjs/config";
|
||||||
import { APP_GUARD, APP_PIPE } from "@nestjs/core";
|
import { APP_GUARD, APP_PIPE } from "@nestjs/core";
|
||||||
|
import { ThrottlerGuard, ThrottlerModule } from "@nestjs/throttler";
|
||||||
|
import { S3Module } from "nestjs-s3";
|
||||||
|
import { ThrottlerStorageRedisService } from "nestjs-throttler-storage-redis";
|
||||||
import { ZodValidationPipe } from "nestjs-zod";
|
import { ZodValidationPipe } from "nestjs-zod";
|
||||||
import { AuthModule } from "./auth/auth.module";
|
import { AuthModule } from "./auth/auth.module";
|
||||||
import { ConfigModule } from "@nestjs/config";
|
|
||||||
import { JwtAuthGuard } from "./auth/jwt-auth.guard";
|
import { JwtAuthGuard } from "./auth/jwt-auth.guard";
|
||||||
import { ThrottlerGuard, ThrottlerModule } from "@nestjs/throttler";
|
|
||||||
import { ThrottlerStorageRedisService } from "nestjs-throttler-storage-redis";
|
|
||||||
import { KweeksModule } from "./kweeks/kweeks.module";
|
import { KweeksModule } from "./kweeks/kweeks.module";
|
||||||
import { FastifyMulterModule } from "@nest-lab/fastify-multer";
|
import { UserModule } from "./users/users.module";
|
||||||
import { S3Module } from "nestjs-s3";
|
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {
|
import {
|
||||||
Controller,
|
|
||||||
Request,
|
|
||||||
Post,
|
|
||||||
UseGuards,
|
|
||||||
Body,
|
Body,
|
||||||
|
Controller,
|
||||||
HttpCode,
|
HttpCode,
|
||||||
|
Post,
|
||||||
|
Request,
|
||||||
|
UseGuards,
|
||||||
} from "@nestjs/common";
|
} from "@nestjs/common";
|
||||||
import {
|
import {
|
||||||
ApiOkResponse,
|
ApiOkResponse,
|
||||||
|
@ -12,10 +12,10 @@ import {
|
||||||
ApiTags,
|
ApiTags,
|
||||||
ApiUnauthorizedResponse,
|
ApiUnauthorizedResponse,
|
||||||
} from "@nestjs/swagger";
|
} from "@nestjs/swagger";
|
||||||
import { LocalAuthGuard } from "./local-auth.guard";
|
import { Public } from "src/public.decorator";
|
||||||
import { AuthService } from "./auth.service";
|
import { AuthService } from "./auth.service";
|
||||||
import { LoginUserDTO } from "./dto/login.dto";
|
import { LoginUserDTO } from "./dto/login.dto";
|
||||||
import { Public } from "src/public.decorator";
|
import { LocalAuthGuard } from "./local-auth.guard";
|
||||||
|
|
||||||
@ApiTags("Auth")
|
@ApiTags("Auth")
|
||||||
@Controller("auth")
|
@Controller("auth")
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Module } from "@nestjs/common";
|
import { Module } from "@nestjs/common";
|
||||||
import { AuthService } from "./auth.service";
|
import { JwtModule } from "@nestjs/jwt";
|
||||||
import { PassportModule } from "@nestjs/passport";
|
import { PassportModule } from "@nestjs/passport";
|
||||||
import { LocalStrategy } from "./local.strategy";
|
|
||||||
import { UserModule } from "src/users/users.module";
|
import { UserModule } from "src/users/users.module";
|
||||||
import { AuthController } from "./auth.controller";
|
import { AuthController } from "./auth.controller";
|
||||||
import { JwtModule } from "@nestjs/jwt";
|
import { AuthService } from "./auth.service";
|
||||||
import { JwtStrategy } from "./jwt.strategy";
|
import { JwtStrategy } from "./jwt.strategy";
|
||||||
|
import { LocalStrategy } from "./local.strategy";
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [AuthController],
|
controllers: [AuthController],
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Injectable } from "@nestjs/common";
|
import { Injectable } from "@nestjs/common";
|
||||||
import { UserService } from "src/users/users.service";
|
import { JwtService } from "@nestjs/jwt";
|
||||||
import * as bcrypt from "bcrypt";
|
import * as bcrypt from "bcrypt";
|
||||||
import { UserModel } from "src/users/models/user.model";
|
import { UserModel } from "src/users/models/user.model";
|
||||||
import { JwtService } from "@nestjs/jwt";
|
import { UserService } from "src/users/users.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Injectable, UnauthorizedException } from "@nestjs/common";
|
import { Injectable, UnauthorizedException } from "@nestjs/common";
|
||||||
import { PassportStrategy } from "@nestjs/passport";
|
import { PassportStrategy } from "@nestjs/passport";
|
||||||
import { Strategy } from "passport-local";
|
import { Strategy } from "passport-local";
|
||||||
import { AuthService } from "./auth.service";
|
|
||||||
import { UserModel } from "src/users/models/user.model";
|
import { UserModel } from "src/users/models/user.model";
|
||||||
|
import { AuthService } from "./auth.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LocalStrategy extends PassportStrategy(Strategy) {
|
export class LocalStrategy extends PassportStrategy(Strategy) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { PartialType } from '@nestjs/swagger';
|
import { PartialType } from "@nestjs/swagger";
|
||||||
import { CreateKweekDto } from './create-kweek.dto';
|
import { CreateKweekDto } from "./create-kweek.dto";
|
||||||
|
|
||||||
export class UpdateKweekDto extends PartialType(CreateKweekDto) {}
|
export class UpdateKweekDto extends PartialType(CreateKweekDto) {}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Module } from "@nestjs/common";
|
import { Module } from "@nestjs/common";
|
||||||
import { KweeksService } from "./kweeks.service";
|
|
||||||
import { KweeksController } from "./kweeks.controller";
|
|
||||||
import { PrismaModule } from "src/prisma/prisma.module";
|
import { PrismaModule } from "src/prisma/prisma.module";
|
||||||
|
import { KweeksController } from "./kweeks.controller";
|
||||||
|
import { KweeksService } from "./kweeks.service";
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [PrismaModule],
|
imports: [PrismaModule],
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from "@nestjs/common";
|
import { Injectable } from "@nestjs/common";
|
||||||
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
import { CreateKweekDTO } from "./dto/create-kweek.dto";
|
import { CreateKweekDTO } from "./dto/create-kweek.dto";
|
||||||
import { UpdateKweekDto } from "./dto/update-kweek.dto";
|
import { UpdateKweekDto } from "./dto/update-kweek.dto";
|
||||||
import { PrismaService } from "src/prisma/prisma.service";
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class KweeksService {
|
export class KweeksService {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
|
import * as helmet from "@fastify/helmet";
|
||||||
import { NestFactory } from "@nestjs/core";
|
import { NestFactory } from "@nestjs/core";
|
||||||
import { SwaggerModule, DocumentBuilder } from "@nestjs/swagger";
|
|
||||||
import { AppModule } from "./app.module";
|
|
||||||
import { patchNestJsSwagger } from "nestjs-zod";
|
|
||||||
import {
|
import {
|
||||||
FastifyAdapter,
|
FastifyAdapter,
|
||||||
NestFastifyApplication,
|
NestFastifyApplication,
|
||||||
} from "@nestjs/platform-fastify";
|
} from "@nestjs/platform-fastify";
|
||||||
import * as helmet from "@fastify/helmet";
|
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
|
||||||
|
import { patchNestJsSwagger } from "nestjs-zod";
|
||||||
|
import { AppModule } from "./app.module";
|
||||||
|
|
||||||
// TODO: File Upload (Posts and User Profile Image)
|
// TODO: File Upload (Posts and User Profile Image)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { File, FileInterceptor } from "@nest-lab/fastify-multer";
|
||||||
import {
|
import {
|
||||||
Body,
|
Body,
|
||||||
Controller,
|
Controller,
|
||||||
|
@ -22,17 +23,16 @@ import {
|
||||||
ApiTags,
|
ApiTags,
|
||||||
ApiUnauthorizedResponse,
|
ApiUnauthorizedResponse,
|
||||||
} from "@nestjs/swagger";
|
} from "@nestjs/swagger";
|
||||||
import { UserService } from "./users.service";
|
|
||||||
import { CreateUserDTO } from "./dto/create-user.dto";
|
|
||||||
import { Public } from "src/public.decorator";
|
import { Public } from "src/public.decorator";
|
||||||
import { UpdateNameDTO } from "./dto/update-name.dto";
|
|
||||||
import { User } from "./types/user.type";
|
|
||||||
import { UpdateEmailDTO } from "./dto/update-email.dto";
|
|
||||||
import { UpdatePasswordDTO } from "./dto/update-password.dto";
|
|
||||||
import { File, FileInterceptor } from "@nest-lab/fastify-multer";
|
|
||||||
import { BufferValidator } from "src/validators/buffer-validator.pipe";
|
import { BufferValidator } from "src/validators/buffer-validator.pipe";
|
||||||
import UploadImageSchema from "./schemas/upload-image.schema";
|
|
||||||
import UploadImageValidator from "src/validators/upload-image.validator";
|
import UploadImageValidator from "src/validators/upload-image.validator";
|
||||||
|
import { CreateUserDTO } from "./dto/create-user.dto";
|
||||||
|
import { UpdateEmailDTO } from "./dto/update-email.dto";
|
||||||
|
import { UpdateNameDTO } from "./dto/update-name.dto";
|
||||||
|
import { UpdatePasswordDTO } from "./dto/update-password.dto";
|
||||||
|
import UploadImageSchema from "./schemas/upload-image.schema";
|
||||||
|
import { User } from "./types/user.type";
|
||||||
|
import { UserService } from "./users.service";
|
||||||
|
|
||||||
@ApiTags("Users")
|
@ApiTags("Users")
|
||||||
@Controller("users")
|
@Controller("users")
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Module } from "@nestjs/common";
|
import { Module } from "@nestjs/common";
|
||||||
import { UserController } from "./users.controller";
|
|
||||||
import { UserService } from "./users.service";
|
|
||||||
import { PrismaModule } from "src/prisma/prisma.module";
|
import { PrismaModule } from "src/prisma/prisma.module";
|
||||||
import { S3Service } from "./s3.service";
|
import { S3Service } from "./s3.service";
|
||||||
|
import { UserController } from "./users.controller";
|
||||||
|
import { UserService } from "./users.service";
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [PrismaModule],
|
imports: [PrismaModule],
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
|
import { File } from "@nest-lab/fastify-multer";
|
||||||
import {
|
import {
|
||||||
BadRequestException,
|
BadRequestException,
|
||||||
Injectable,
|
Injectable,
|
||||||
NotFoundException,
|
NotFoundException,
|
||||||
} from "@nestjs/common";
|
} from "@nestjs/common";
|
||||||
import { CreateUserDTO } from "./dto/create-user.dto";
|
|
||||||
import { PrismaService } from "src/prisma/prisma.service";
|
|
||||||
import { UserModel } from "./models/user.model";
|
|
||||||
import * as bcrypt from "bcrypt";
|
import * as bcrypt from "bcrypt";
|
||||||
import { User } from "./types/user.type";
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
import { File } from "@nest-lab/fastify-multer";
|
import { CreateUserDTO } from "./dto/create-user.dto";
|
||||||
|
import { UserModel } from "./models/user.model";
|
||||||
import { S3Service } from "./s3.service";
|
import { S3Service } from "./s3.service";
|
||||||
|
import { User } from "./types/user.type";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserService {
|
export class UserService {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Test, TestingModule } from '@nestjs/testing';
|
import { INestApplication } from "@nestjs/common";
|
||||||
import { INestApplication } from '@nestjs/common';
|
import { Test, TestingModule } from "@nestjs/testing";
|
||||||
import * as request from 'supertest';
|
import * as request from "supertest";
|
||||||
import { AppModule } from './../src/app.module';
|
import { AppModule } from "./../src/app.module";
|
||||||
|
|
||||||
describe('AppController (e2e)', () => {
|
describe("AppController (e2e)", () => {
|
||||||
let app: INestApplication;
|
let app: INestApplication;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
@ -15,10 +15,10 @@ describe('AppController (e2e)', () => {
|
||||||
await app.init();
|
await app.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('/ (GET)', () => {
|
it("/ (GET)", () => {
|
||||||
return request(app.getHttpServer())
|
return request(app.getHttpServer())
|
||||||
.get('/')
|
.get("/")
|
||||||
.expect(200)
|
.expect(200)
|
||||||
.expect('Hello World!');
|
.expect("Hello World!");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue