From 32efbfc604890f390f34cbc5681e4147e501a4f9 Mon Sep 17 00:00:00 2001 From: Chafik H'nini Date: Sun, 10 Nov 2024 19:07:20 +0100 Subject: [PATCH] refactor: simplify read version from package.json --- spec/generate-swagger.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/generate-swagger.ts b/spec/generate-swagger.ts index 2317610..65a6f1f 100644 --- a/spec/generate-swagger.ts +++ b/spec/generate-swagger.ts @@ -6,8 +6,7 @@ import { type ExtendedSpecConfig, generateSpec } from 'tsoa'; const basePath = join('/app'); const pkgJsonPath = join(basePath, 'package.json'); -const pkgJsonBuff = await readFile(pkgJsonPath); -const pkgJson = pkgJsonBuff.toString(); +const pkgJson = await readFile(pkgJsonPath, 'utf-8'); const { version }: { version: string } = JSON.parse(pkgJson); const specBasePath = join(basePath, 'spec');