├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── README.md ├── nest-cli.json ├── package-lock.json ├── package.json ├── src ├── app.controller.ts ├── app.module.ts ├── auth │ ├── auth.constant.ts │ ├── auth.controller.spec.ts │ ├── auth.controller.ts │ ├── auth.module.ts │ ├── auth.service.spec.ts │ ├── auth.service.ts │ ├── jwt.strategy.ts │ └── local.strategy.ts ├── main.ts ├── profile │ ├── profile.controller.spec.ts │ ├── profile.controller.ts │ └── profile.module.ts └── user │ ├── dto │ ├── create-user.dto.ts │ └── update-user.dto.ts │ ├── entity │ └── user.entity.ts │ ├── user.controller.spec.ts │ ├── user.controller.ts │ ├── user.module.ts │ ├── user.service.spec.ts │ └── user.service.ts ├── test ├── app.e2e-spec.ts └── jest-e2e.json ├── tsconfig.build.json └── tsconfig.json /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', 3 | parserOptions: { 4 | project: 'tsconfig.json', 5 | tsconfigRootDir : __dirname, 6 | sourceType: 'module', 7 | }, 8 | plugins: ['@typescript-eslint/eslint-plugin'], 9 | extends: [ 10 | 'plugin:@typescript-eslint/recommended', 11 | 'plugin:prettier/recommended', 12 | ], 13 | root: true, 14 | env: { 15 | node: true, 16 | jest: true, 17 | }, 18 | ignorePatterns: ['.eslintrc.js'], 19 | rules: { 20 | '@typescript-eslint/interface-name-prefix': 'off', 21 | '@typescript-eslint/explicit-function-return-type': 'off', 22 | '@typescript-eslint/explicit-module-boundary-types': 'off', 23 | '@typescript-eslint/no-explicit-any': 'off', 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | pnpm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | lerna-debug.log* 13 | 14 | # OS 15 | .DS_Store 16 | 17 | # Tests 18 | /coverage 19 | /.nyc_output 20 | 21 | # IDEs and editors 22 | /.idea 23 | .project 24 | .classpath 25 | .c9/ 26 | *.launch 27 | .settings/ 28 | *.sublime-workspace 29 | 30 | # IDE - VSCode 31 | .vscode/* 32 | !.vscode/settings.json 33 | !.vscode/tasks.json 34 | !.vscode/launch.json 35 | !.vscode/extensions.json -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Nest Logo 3 |

4 | 5 | [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 6 | [circleci-url]: https://circleci.com/gh/nestjs/nest 7 | 8 |

A progressive Node.js framework for building efficient and scalable server-side applications.

9 |

10 | NPM Version 11 | Package License 12 | NPM Downloads 13 | CircleCI 14 | Coverage 15 | Discord 16 | Backers on Open Collective 17 | Sponsors on Open Collective 18 | 19 | Support us 20 | 21 |

22 | 24 | 25 | ## Description 26 | 27 | [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. 28 | 29 | ## Installation 30 | 31 | ```bash 32 | $ npm install 33 | ``` 34 | 35 | ## Running the app 36 | 37 | ```bash 38 | # development 39 | $ npm run start 40 | 41 | # watch mode 42 | $ npm run start:dev 43 | 44 | # production mode 45 | $ npm run start:prod 46 | ``` 47 | 48 | ## Test 49 | 50 | ```bash 51 | # unit tests 52 | $ npm run test 53 | 54 | # e2e tests 55 | $ npm run test:e2e 56 | 57 | # test coverage 58 | $ npm run test:cov 59 | ``` 60 | 61 | ## Support 62 | 63 | Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). 64 | 65 | ## Stay in touch 66 | 67 | - Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) 68 | - Website - [https://nestjs.com](https://nestjs.com/) 69 | - Twitter - [@nestframework](https://twitter.com/nestframework) 70 | 71 | ## License 72 | 73 | Nest is [MIT licensed](LICENSE). 74 | -------------------------------------------------------------------------------- /nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/nest-cli", 3 | "collection": "@nestjs/schematics", 4 | "sourceRoot": "src" 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-app", 3 | "version": "0.0.1", 4 | "description": "", 5 | "author": "", 6 | "private": true, 7 | "license": "UNLICENSED", 8 | "scripts": { 9 | "prebuild": "rimraf dist", 10 | "build": "nest build", 11 | "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", 12 | "start": "nest start", 13 | "start:dev": "nest start --watch", 14 | "start:debug": "nest start --debug --watch", 15 | "start:prod": "node dist/main", 16 | "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", 17 | "test": "jest", 18 | "test:watch": "jest --watch", 19 | "test:cov": "jest --coverage", 20 | "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", 21 | "test:e2e": "jest --config ./test/jest-e2e.json" 22 | }, 23 | "dependencies": { 24 | "@nestjs/common": "^8.0.0", 25 | "@nestjs/core": "^8.0.0", 26 | "@nestjs/jwt": "^8.0.1", 27 | "@nestjs/passport": "^8.2.2", 28 | "@nestjs/platform-express": "^8.0.0", 29 | "@nestjs/typeorm": "^8.1.4", 30 | "bcrypt": "^5.0.1", 31 | "class-transformer": "^0.5.1", 32 | "class-validator": "^0.13.2", 33 | "mysql2": "^2.3.3", 34 | "passport": "^0.6.0", 35 | "passport-jwt": "^4.0.0", 36 | "passport-local": "^1.0.0", 37 | "reflect-metadata": "^0.1.13", 38 | "rimraf": "^3.0.2", 39 | "rxjs": "^7.2.0", 40 | "typeorm": "^0.3.6" 41 | }, 42 | "devDependencies": { 43 | "@nestjs/cli": "^8.0.0", 44 | "@nestjs/schematics": "^8.0.0", 45 | "@nestjs/testing": "^8.0.0", 46 | "@types/express": "^4.17.13", 47 | "@types/jest": "27.5.0", 48 | "@types/node": "^16.0.0", 49 | "@types/passport-jwt": "^3.0.6", 50 | "@types/supertest": "^2.0.11", 51 | "@typescript-eslint/eslint-plugin": "^5.0.0", 52 | "@typescript-eslint/parser": "^5.0.0", 53 | "eslint": "^8.0.1", 54 | "eslint-config-prettier": "^8.3.0", 55 | "eslint-plugin-prettier": "^4.0.0", 56 | "jest": "28.0.3", 57 | "prettier": "^2.3.2", 58 | "source-map-support": "^0.5.20", 59 | "supertest": "^6.1.3", 60 | "ts-jest": "28.0.1", 61 | "ts-loader": "^9.2.3", 62 | "ts-node": "^10.0.0", 63 | "tsconfig-paths": "4.0.0", 64 | "typescript": "^4.3.5" 65 | }, 66 | "jest": { 67 | "moduleFileExtensions": [ 68 | "js", 69 | "json", 70 | "ts" 71 | ], 72 | "rootDir": "src", 73 | "testRegex": ".*\\.spec\\.ts$", 74 | "transform": { 75 | "^.+\\.(t|j)s$": "ts-jest" 76 | }, 77 | "collectCoverageFrom": [ 78 | "**/*.(t|j)s" 79 | ], 80 | "coverageDirectory": "../coverage", 81 | "testEnvironment": "node" 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller } from '@nestjs/common'; 2 | 3 | @Controller() 4 | export class AppController {} 5 | -------------------------------------------------------------------------------- /src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { TypeOrmModule } from '@nestjs/typeorm'; 3 | import { AppController } from './app.controller'; 4 | import { AuthModule } from './auth/auth.module'; 5 | import { User } from './user/entity/user.entity'; 6 | import { UserModule } from './user/user.module'; 7 | import { ProfileModule } from './profile/profile.module'; 8 | 9 | @Module({ 10 | controllers: [AppController], 11 | imports: [ 12 | UserModule, 13 | TypeOrmModule.forRoot({ 14 | type: 'mysql', 15 | host: '127.0.0.1', 16 | port: 3306, 17 | username: 'root', 18 | password: null, 19 | database: 'nestjs', 20 | entities: [User], 21 | synchronize: true, 22 | }), 23 | AuthModule, 24 | ProfileModule, 25 | ], 26 | }) 27 | export class AppModule {} 28 | -------------------------------------------------------------------------------- /src/auth/auth.constant.ts: -------------------------------------------------------------------------------- 1 | export const jwtConstants = { 2 | secret: 'secretKey', 3 | }; 4 | -------------------------------------------------------------------------------- /src/auth/auth.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { AuthController } from './auth.controller'; 3 | 4 | describe('AuthController', () => { 5 | let controller: AuthController; 6 | 7 | beforeEach(async () => { 8 | const module: TestingModule = await Test.createTestingModule({ 9 | controllers: [AuthController], 10 | }).compile(); 11 | 12 | controller = module.get(AuthController); 13 | }); 14 | 15 | it('should be defined', () => { 16 | expect(controller).toBeDefined(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /src/auth/auth.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Post, Request, UseGuards } from '@nestjs/common'; 2 | import { AuthGuard } from '@nestjs/passport'; 3 | import { AuthService } from './auth.service'; 4 | 5 | @Controller('auth') 6 | export class AuthController { 7 | constructor(private authService: AuthService) {} 8 | 9 | @UseGuards(AuthGuard('local')) 10 | @Post('/login') 11 | async login(@Request() req: any) { 12 | return this.authService.login(req.user); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { JwtModule } from '@nestjs/jwt'; 3 | import { PassportModule } from '@nestjs/passport'; 4 | import { UserModule } from 'src/user/user.module'; 5 | import { jwtConstants } from './auth.constant'; 6 | import { AuthController } from './auth.controller'; 7 | import { AuthService } from './auth.service'; 8 | import { JwtStrategy } from './jwt.strategy'; 9 | import { LocalStrategy } from './local.strategy'; 10 | 11 | @Module({ 12 | controllers: [AuthController], 13 | imports: [ 14 | UserModule, 15 | PassportModule, 16 | JwtModule.register({ 17 | secret: jwtConstants.secret, 18 | signOptions: { expiresIn: '60s' }, 19 | }), 20 | ], 21 | providers: [AuthService, LocalStrategy, JwtStrategy], 22 | }) 23 | export class AuthModule {} 24 | -------------------------------------------------------------------------------- /src/auth/auth.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { AuthService } from './auth.service'; 3 | 4 | describe('AuthService', () => { 5 | let service: AuthService; 6 | 7 | beforeEach(async () => { 8 | const module: TestingModule = await Test.createTestingModule({ 9 | providers: [AuthService], 10 | }).compile(); 11 | 12 | service = module.get(AuthService); 13 | }); 14 | 15 | it('should be defined', () => { 16 | expect(service).toBeDefined(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /src/auth/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { JwtService } from '@nestjs/jwt'; 3 | import { UserService } from 'src/user/user.service'; 4 | 5 | @Injectable() 6 | export class AuthService { 7 | constructor( 8 | private userService: UserService, 9 | private jwtService: JwtService, 10 | ) {} 11 | 12 | async validateUser(email: string, password: string) { 13 | const user = await this.userService.findByEmail(email); 14 | if (user && user.password === password) { 15 | return user; 16 | } 17 | 18 | return null; 19 | } 20 | 21 | async login(user: any) { 22 | const payload = { email: user.email, sub: user.id }; 23 | return { 24 | access_token: this.jwtService.sign(payload), 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/auth/jwt.strategy.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { PassportStrategy } from '@nestjs/passport'; 3 | import { ExtractJwt, Strategy } from 'passport-jwt'; 4 | import { jwtConstants } from './auth.constant'; 5 | 6 | @Injectable() 7 | export class JwtStrategy extends PassportStrategy(Strategy) { 8 | constructor() { 9 | super({ 10 | jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), 11 | ignoreExpiration: false, 12 | secretOrKey: jwtConstants.secret, 13 | }); 14 | } 15 | 16 | async validate(payload: any) { 17 | return { id: payload.sub, email: payload.email }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/auth/local.strategy.ts: -------------------------------------------------------------------------------- 1 | import { Injectable, UnauthorizedException } from '@nestjs/common'; 2 | import { PassportStrategy } from '@nestjs/passport'; 3 | import { Strategy } from 'passport-local'; 4 | import { AuthService } from './auth.service'; 5 | 6 | @Injectable() 7 | export class LocalStrategy extends PassportStrategy(Strategy) { 8 | constructor(private authService: AuthService) { 9 | super({ usernameField: 'email' }); 10 | } 11 | 12 | async validate(email: string, password: string): Promise { 13 | const user = await this.authService.validateUser(email, password); 14 | if (!user) { 15 | throw new UnauthorizedException(); 16 | } 17 | return user; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { ValidationPipe } from '@nestjs/common'; 2 | import { NestFactory } from '@nestjs/core'; 3 | import { AppModule } from './app.module'; 4 | 5 | async function bootstrap() { 6 | const app = await NestFactory.create(AppModule); 7 | app.useGlobalPipes( 8 | new ValidationPipe({ 9 | whitelist: true, 10 | }), 11 | ); 12 | await app.listen(3000); 13 | } 14 | bootstrap(); 15 | -------------------------------------------------------------------------------- /src/profile/profile.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { ProfileController } from './profile.controller'; 3 | 4 | describe('ProfileController', () => { 5 | let controller: ProfileController; 6 | 7 | beforeEach(async () => { 8 | const module: TestingModule = await Test.createTestingModule({ 9 | controllers: [ProfileController], 10 | }).compile(); 11 | 12 | controller = module.get(ProfileController); 13 | }); 14 | 15 | it('should be defined', () => { 16 | expect(controller).toBeDefined(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /src/profile/profile.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, UseGuards } from '@nestjs/common'; 2 | import { AuthGuard } from '@nestjs/passport'; 3 | 4 | @Controller('profile') 5 | export class ProfileController { 6 | @UseGuards(AuthGuard('jwt')) 7 | @Get() 8 | profile() { 9 | return { message: 'I am protected route' }; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/profile/profile.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { ProfileController } from './profile.controller'; 3 | 4 | @Module({ 5 | controllers: [ProfileController], 6 | }) 7 | export class ProfileModule {} 8 | -------------------------------------------------------------------------------- /src/user/dto/create-user.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsEmail, IsString } from 'class-validator'; 2 | import { Unique } from 'typeorm'; 3 | 4 | @Unique(['email']) 5 | export class CreateUserDto { 6 | @IsString() 7 | name: string; 8 | 9 | @IsEmail() 10 | email: string; 11 | 12 | @IsString() 13 | password: string; 14 | } 15 | -------------------------------------------------------------------------------- /src/user/dto/update-user.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsEmail, IsString } from 'class-validator'; 2 | 3 | export class UpdateUserDto { 4 | @IsString() 5 | name: string; 6 | 7 | @IsEmail() 8 | email: string; 9 | 10 | @IsString() 11 | password: string; 12 | } 13 | -------------------------------------------------------------------------------- /src/user/entity/user.entity.ts: -------------------------------------------------------------------------------- 1 | import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; 2 | 3 | @Entity() 4 | export class User { 5 | @PrimaryGeneratedColumn() 6 | id: number; 7 | 8 | @Column() 9 | name: string; 10 | 11 | @Column() 12 | email: string; 13 | 14 | @Column() 15 | password: string; 16 | } 17 | -------------------------------------------------------------------------------- /src/user/user.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { UserController } from './user.controller'; 3 | 4 | describe('UserController', () => { 5 | let controller: UserController; 6 | 7 | beforeEach(async () => { 8 | const module: TestingModule = await Test.createTestingModule({ 9 | controllers: [UserController], 10 | }).compile(); 11 | 12 | controller = module.get(UserController); 13 | }); 14 | 15 | it('should be defined', () => { 16 | expect(controller).toBeDefined(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /src/user/user.controller.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Body, 3 | Controller, 4 | Delete, 5 | Get, 6 | Param, 7 | ParseIntPipe, 8 | Patch, 9 | Post, 10 | } from '@nestjs/common'; 11 | import { CreateUserDto } from './dto/create-user.dto'; 12 | import { UpdateUserDto } from './dto/update-user.dto'; 13 | import { UserService } from './user.service'; 14 | 15 | @Controller('user') 16 | export class UserController { 17 | constructor(private userService: UserService) {} 18 | 19 | @Get() 20 | getUsers() { 21 | return this.userService.get(); 22 | } 23 | 24 | @Post() 25 | store(@Body() createUserDto: CreateUserDto) { 26 | return this.userService.create(createUserDto); 27 | } 28 | 29 | @Patch('/:userId') 30 | update( 31 | @Body() updateUserDto: UpdateUserDto, 32 | @Param('userId', ParseIntPipe) userId: number, 33 | ) { 34 | return this.userService.update(updateUserDto, userId); 35 | } 36 | 37 | @Get('/:userId') 38 | getUser(@Param('userId', ParseIntPipe) userId: number) { 39 | return this.userService.show(userId); 40 | } 41 | 42 | @Delete('/:userId') 43 | deleteUser(@Param('userId', ParseIntPipe) userId: number) { 44 | return this.userService.delete(userId); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/user/user.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { TypeOrmModule } from '@nestjs/typeorm'; 3 | import { User } from './entity/user.entity'; 4 | import { UserController } from './user.controller'; 5 | import { UserService } from './user.service'; 6 | 7 | @Module({ 8 | controllers: [UserController], 9 | providers: [UserService], 10 | exports: [UserService], 11 | imports: [TypeOrmModule.forFeature([User])], 12 | }) 13 | export class UserModule {} 14 | -------------------------------------------------------------------------------- /src/user/user.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { UserService } from './user.service'; 3 | 4 | describe('UserService', () => { 5 | let service: UserService; 6 | 7 | beforeEach(async () => { 8 | const module: TestingModule = await Test.createTestingModule({ 9 | providers: [UserService], 10 | }).compile(); 11 | 12 | service = module.get(UserService); 13 | }); 14 | 15 | it('should be defined', () => { 16 | expect(service).toBeDefined(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /src/user/user.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { InjectRepository } from '@nestjs/typeorm'; 3 | import { Repository } from 'typeorm'; 4 | import { CreateUserDto } from './dto/create-user.dto'; 5 | import { UpdateUserDto } from './dto/update-user.dto'; 6 | import { User } from './entity/user.entity'; 7 | 8 | @Injectable() 9 | export class UserService { 10 | constructor( 11 | @InjectRepository(User) 12 | private userRepository: Repository, 13 | ) {} 14 | 15 | get(): Promise { 16 | return this.userRepository.find(); 17 | } 18 | 19 | create(createUserDto: CreateUserDto) { 20 | return this.userRepository.save(createUserDto); 21 | } 22 | 23 | update(updateUserDto: UpdateUserDto, userId: number) { 24 | return this.userRepository.update(userId, updateUserDto); 25 | } 26 | 27 | show(id: number) { 28 | return this.userRepository.findOne({ where: { id } }); 29 | } 30 | 31 | findByEmail(email: string) { 32 | return this.userRepository.findOne({ where: { email } }); 33 | } 34 | 35 | delete(userId: number) { 36 | return this.userRepository.delete(userId); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { INestApplication } from '@nestjs/common'; 3 | import * as request from 'supertest'; 4 | import { AppModule } from './../src/app.module'; 5 | 6 | describe('AppController (e2e)', () => { 7 | let app: INestApplication; 8 | 9 | beforeEach(async () => { 10 | const moduleFixture: TestingModule = await Test.createTestingModule({ 11 | imports: [AppModule], 12 | }).compile(); 13 | 14 | app = moduleFixture.createNestApplication(); 15 | await app.init(); 16 | }); 17 | 18 | it('/ (GET)', () => { 19 | return request(app.getHttpServer()) 20 | .get('/') 21 | .expect(200) 22 | .expect('Hello World!'); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "es2017", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | --------------------------------------------------------------------------------