File tree Expand file tree Collapse file tree 6 files changed +65
-6
lines changed
Expand file tree Collapse file tree 6 files changed +65
-6
lines changed Original file line number Diff line number Diff line change 1+ .git/
2+ .github/
3+ .idea/
4+ .yarn/
5+ coverage/
6+ dist/
7+ node_modules/
8+ test/
9+
Original file line number Diff line number Diff line change 1+ FROM node:20 AS build
2+
3+ WORKDIR /usr/src
4+
5+ COPY package.json yarn.lock ./
6+ RUN yarn
7+
8+ COPY . .
9+ RUN yarn build
10+
11+ FROM node:20-alpine
12+ WORKDIR /app
13+
14+ RUN npm install -g pm2
15+
16+ COPY package.json yarn.lock ./
17+ RUN yarn --production
18+
19+ COPY --from=build /usr/src/dist ./
20+
21+ EXPOSE 3000
22+ CMD ["pm2-runtime" , "main.js" ]
Original file line number Diff line number Diff line change 1+ version : ' 3.8'
2+
3+ services :
4+ mongo :
5+ image : mongo:8
6+ ports :
7+ - " 27017:27017"
8+ volumes :
9+ - mongo-data:/data/db
10+
11+ engine :
12+ build : .
13+ ports :
14+ - " 3000:3000"
15+ depends_on :
16+ - mongo
17+ environment :
18+ - DB=mongodb://mongo:27017/letsflow
19+ volumes :
20+ - ./scenarios:/app/scenarios:ro
21+ - ./schemas:/app/schemas:ro
22+
23+ volumes :
24+ mongo-data :
25+
Original file line number Diff line number Diff line change 8787 },
8888 "coverageDirectory" : " ../coverage" ,
8989 "testEnvironment" : " node"
90- },
91- "packageManager" : " yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
90+ }
9291}
Original file line number Diff line number Diff line change 11import { Injectable , OnModuleInit } from '@nestjs/common' ;
22import { ConfigService } from './common/config/config.service' ;
33import Ajv from 'ajv' ;
4+ import * as path from 'path' ;
5+ import * as fs from 'fs' ;
46
57@Injectable ( )
68export class AppService implements OnModuleInit {
@@ -22,8 +24,8 @@ export class AppService implements OnModuleInit {
2224 }
2325
2426 private initInfo ( ) {
25- // eslint-disable-next-line @typescript-eslint/no-var-requires
26- const packageInfo = require ( '../package.json' ) ;
27+ const packagePath = path . join ( process . cwd ( ) , 'package.json' ) ;
28+ const packageInfo = JSON . parse ( fs . readFileSync ( packagePath , 'utf-8' ) ) ;
2729
2830 this . info = {
2931 name : packageInfo . name ,
Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ import { INestApplication } from '@nestjs/common';
44import { DocumentBuilder , SwaggerModule } from '@nestjs/swagger' ;
55import { ConfigService } from './common/config/config.service' ;
66import { NestExpressApplication } from '@nestjs/platform-express' ;
7+ import * as path from 'path' ;
8+ import * as fs from 'fs' ;
79
810async function swagger ( app : INestApplication , config : ConfigService ) {
9- // eslint-disable-next-line @typescript-eslint/no-var-requires
10- const { description, version } = require ( '../package.json' ) ;
11+ const packagePath = path . join ( process . cwd ( ) , 'package.json' ) ;
12+ const { description, version } = JSON . parse ( fs . readFileSync ( packagePath , 'utf-8' ) ) ;
1113
1214 const options = new DocumentBuilder ( )
1315 . setTitle ( 'LetsFlow' )
You can’t perform that action at this time.
0 commit comments