Skip to content

Commit e31093d

Browse files
committed
Use the @ alias and more changes
1 parent 16bc873 commit e31093d

File tree

9 files changed

+54
-9
lines changed

9 files changed

+54
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test and Deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: '18'
17+
cache: 'npm'
18+
19+
- run: npm ci
20+
- run: npm run build
21+
- run: npm test
22+
23+
deploy:
24+
needs: test
25+
runs-on: ubuntu-latest
26+
if: github.ref == 'refs/heads/main'
27+
steps:
28+
- uses: actions/checkout@v3
29+
30+
- name: Deploy to Heroku
31+
uses: akhileshns/[email protected]
32+
with:
33+
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
34+
heroku_app_name: 'duel-api'
35+
heroku_email: '[email protected]'

nest-cli.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"collection": "@nestjs/schematics",
44
"sourceRoot": "src",
55
"compilerOptions": {
6-
"deleteOutDir": true
6+
"deleteOutDir": true,
7+
"webpack": true,
8+
"tsConfigPath": "tsconfig.json"
79
}
810
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"start:debug": "nest start --debug --watch",
1010
"start:prod": "node dist/main",
1111
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
12-
"heroku-postbuild": "npm run build"
12+
"heroku-postbuild": "npm run build",
13+
"deploy": "git push origin main && git push heroku main",
14+
"deploy:force": "git push origin main && git push heroku main --force"
1315
},
1416
"dependencies": {
1517
"@nestjs/common": "^10.0.0",

src/app.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Module } from '@nestjs/common';
22
import { ConfigModule, ConfigService } from '@nestjs/config';
33
import { TypeOrmModule } from '@nestjs/typeorm';
4-
import { ProcessedDataModule } from './modules/processed-data/processed-data.module';
5-
import { getDatabaseConfig } from './config/database.config';
4+
import { ProcessedDataModule } from '@/modules/processed-data/processed-data.module';
5+
import { getDatabaseConfig } from '@/config/database.config';
66

77
@Module({
88
imports: [

src/modules/processed-data/processed-data.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from '@nestjs/common';
99
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
1010
import { ProcessedDataService } from './processed-data.service';
11-
import { ProcessedData } from '../../entities/processed-data.entity';
11+
import { ProcessedData } from '@/entities/processed-data.entity';
1212
import { QueryProcessedDataDto } from './dto/query-processed-data.dto';
1313

1414
@ApiTags('processed-data')

src/modules/processed-data/processed-data.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Module } from '@nestjs/common';
22
import { TypeOrmModule } from '@nestjs/typeorm';
33
import { ProcessedDataController } from './processed-data.controller';
44
import { ProcessedDataService } from './processed-data.service';
5-
import { ProcessedData } from '../../entities/processed-data.entity';
5+
import { ProcessedData } from '@/entities/processed-data.entity';
66

77
@Module({
88
imports: [TypeOrmModule.forFeature([ProcessedData])],

src/modules/processed-data/processed-data.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Injectable } from '@nestjs/common';
22
import { InjectRepository } from '@nestjs/typeorm';
33
import { Repository, SelectQueryBuilder } from 'typeorm';
4-
import { ProcessedData } from '../../entities/processed-data.entity';
4+
import { ProcessedData } from '@/entities/processed-data.entity';
55
import { QueryProcessedDataDto } from './dto/query-processed-data.dto';
66

77
@Injectable()

test/app.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Test, TestingModule } from '@nestjs/testing';
22
import { INestApplication } from '@nestjs/common';
33
import * as request from 'supertest';
44
import { App } from 'supertest/types';
5-
import { AppModule } from './../src/app.module';
5+
import { AppModule } from '@/app.module';
66

77
describe('AppController (e2e)', () => {
88
let app: INestApplication<App>;

tsconfig.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
"forceConsistentCasingInFileNames": true,
1717
"noImplicitAny": false,
1818
"strictBindCallApply": false,
19-
"noFallthroughCasesInSwitch": false
19+
"noFallthroughCasesInSwitch": false,
20+
"paths": {
21+
"@/*": ["src/*"],
22+
"@/entities/*": ["src/entities/*"],
23+
"@/modules/*": ["src/modules/*"],
24+
"@/config/*": ["src/config/*"]
25+
}
2026
}
2127
}

0 commit comments

Comments
 (0)