Skip to content

Commit 642a416

Browse files
committed
fix: resolve Docker build and lint errors
- Fix package.json import in swagger.config.ts (use readFileSync instead of import) - Fix package.json import in generate-openapi.ts - Fix prettier formatting in main.ts swagger-ui setup - Addresses CI failures from PR #2592
1 parent e02109f commit 642a416

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

scripts/generate-openapi.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import { readFileSync, writeFileSync } from 'fs';
2+
import { join } from 'path';
13
import swaggerJsdoc from 'swagger-jsdoc';
2-
import { writeFileSync } from 'fs';
3-
import { version } from '../package.json';
4+
5+
const packageJson = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf-8'));
6+
const { version } = packageJson;
47

58
const options: swaggerJsdoc.Options = {
69
definition: {

src/config/swagger.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import { readFileSync } from 'fs';
2+
import { join } from 'path';
13
import swaggerJsdoc from 'swagger-jsdoc';
2-
import { version } from '../package.json';
4+
5+
const packageJson = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf-8'));
6+
const { version } = packageJson;
37

48
const options: swaggerJsdoc.Options = {
59
definition: {

src/main.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@ async function bootstrap() {
7373
app.use('/store', express.static(join(ROOT_DIR, 'store')));
7474

7575
// Swagger UI
76-
app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec, {
77-
customCss: '.swagger-ui .topbar { display: none }',
78-
customSiteTitle: 'Evolution API Documentation',
79-
}));
76+
app.use(
77+
'/docs',
78+
swaggerUi.serve,
79+
swaggerUi.setup(swaggerSpec, {
80+
customCss: '.swagger-ui .topbar { display: none }',
81+
customSiteTitle: 'Evolution API Documentation',
82+
}),
83+
);
8084

8185
// OpenAPI JSON endpoint
8286
app.get('/openapi.json', (req, res) => {

0 commit comments

Comments
 (0)